From 8c7a5392d4a2f5588be9d7a6fc9ff61423557578 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Wed, 7 May 2025 08:25:37 +0200 Subject: [PATCH 1/3] Follow-up and fixes from outer/inner removal Follow-up on https://github.com/dotnet/dotnet/pull/176 Also noticed that the YML was wrong. I tested the change in SBRP and the syntax now works. Rename PrebuiltUsage to TrackPrebuiltUsage property names and the file itself. Fix the NuGetPackageRoot cache defines in RepoLayout.props. They need to be in sync with the ones in tools.sh / tools.ps1. Source-only builds should use the repo local cache unless the NUGET_PACKAGES env var is explicitly set. --- repo-projects/Directory.Build.props | 2 +- .../core-templates/steps/source-build.yml | 2 +- src/arcade/eng/common/tools.sh | 6 +- .../tools/AfterSolutionBuild.proj | 2 +- .../tools/RepoLayout.props | 6 +- ...age.targets => TrackPrebuiltUsage.targets} | 92 +++++++++---------- 6 files changed, 58 insertions(+), 52 deletions(-) rename src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/{PrebuiltUsage.targets => TrackPrebuiltUsage.targets} (61%) diff --git a/repo-projects/Directory.Build.props b/repo-projects/Directory.Build.props index 3b45fd206db..12d938b9597 100644 --- a/repo-projects/Directory.Build.props +++ b/repo-projects/Directory.Build.props @@ -149,7 +149,7 @@ $(CommonArgs) /p:DotNetBuildSourceOnly=true $(CommonArgs) /p:PreviouslySourceBuiltNupkgCacheDir="$(PreviouslySourceBuiltPackagesPath)" $(CommonArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)" - $(CommonArgs) /p:PrebuiltUsageReportDir="$(ArtifactsLogRepoDir)" + $(CommonArgs) /p:TrackPrebuiltUsageReportDir="$(ArtifactsLogRepoDir)" diff --git a/src/arcade/eng/common/core-templates/steps/source-build.yml b/src/arcade/eng/common/core-templates/steps/source-build.yml index 325231215d5..c7c062e88ee 100644 --- a/src/arcade/eng/common/core-templates/steps/source-build.yml +++ b/src/arcade/eng/common/core-templates/steps/source-build.yml @@ -71,7 +71,7 @@ steps: is1ESPipeline: ${{ parameters.is1ESPipeline }} args: displayName: Publish BuildLogs - targetPath: artifacts/log/$[ coalesce(variables._BuildConfig, 'Release') ]/ + targetPath: artifacts/log/${{ coalesce(variables._BuildConfig, 'Release') }} artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) continueOnError: true condition: succeededOrFailed() diff --git a/src/arcade/eng/common/tools.sh b/src/arcade/eng/common/tools.sh index d51f300c772..cc007b1f15a 100755 --- a/src/arcade/eng/common/tools.sh +++ b/src/arcade/eng/common/tools.sh @@ -5,6 +5,9 @@ # CI mode - set to true on CI server for PR validation build or official build. ci=${ci:-false} +# Build mode +source_build=${source_build:-false} + # Set to true to use the pipelines logger which will enable Azure logging output. # https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md # This flag is meant as a temporary opt-opt for the feature while validate it across @@ -58,7 +61,8 @@ use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} # True to use global NuGet cache instead of restoring packages to repository-local directory. -if [[ "$ci" == true ]]; then +# Keep in sync with NuGetPackageroot in Arcade SDK's RepositoryLayout.props. +if [[ "$ci" == true || "$source_build" == true ]]; then use_global_nuget_cache=${use_global_nuget_cache:-false} else use_global_nuget_cache=${use_global_nuget_cache:-true} diff --git a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSolutionBuild.proj b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSolutionBuild.proj index 54ede91854d..905457b6663 100644 --- a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSolutionBuild.proj +++ b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/AfterSolutionBuild.proj @@ -17,7 +17,7 @@ - + diff --git a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props index d0927a742da..560a37b056e 100644 --- a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props +++ b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props @@ -50,13 +50,15 @@ $([MSBuild]::NormalizeDirectory('$(VisualStudioSetupOutputPath)', 'DevDivPackages')) + $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)')) $([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)')) - - $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', '.prebuilt-packages')) + + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages')) $([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages')) diff --git a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/PrebuiltUsage.targets b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets similarity index 61% rename from src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/PrebuiltUsage.targets rename to src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets index b1f3d485a2b..3aae033ec1e 100644 --- a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/PrebuiltUsage.targets +++ b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets @@ -1,46 +1,46 @@ - - - - - $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ - - - - - - $(RepoRoot) - $(NuGetPackageRoot) - $(ArtifactsLogDir) - $(PrebuiltUsageReportDir)prebuilt-usage.xml - - - - - - - - - - - - - - - - - - + + + + + $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ + + + + + + $(RepoRoot) + $(NuGetPackageRoot) + $(ArtifactsLogDir) + $(TrackPrebuiltUsageReportDir)prebuilt-usage.xml + + + + + + + + + + + + + + + + + + From 1345c994382f55f9bd87ca6fc89950e53a2b6d32 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Wed, 7 May 2025 08:29:58 +0200 Subject: [PATCH 2/3] fix newlines --- .../tools/TrackPrebuiltUsage.targets | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets index 3aae033ec1e..fc4578574cd 100644 --- a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets +++ b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/TrackPrebuiltUsage.targets @@ -1,46 +1,46 @@ - - - - - $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ - - - - - - $(RepoRoot) - $(NuGetPackageRoot) - $(ArtifactsLogDir) - $(TrackPrebuiltUsageReportDir)prebuilt-usage.xml - - - - - - - - - - - - - - - - - - + + + + + $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ + + + + + + $(RepoRoot) + $(NuGetPackageRoot) + $(ArtifactsLogDir) + $(TrackPrebuiltUsageReportDir)prebuilt-usage.xml + + + + + + + + + + + + + + + + + + From ce8e059b85effe41d0e54dad4693acfd9dd13e97 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Wed, 7 May 2025 08:31:31 +0200 Subject: [PATCH 3/3] Update RepoLayout.props --- .../src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props index 560a37b056e..fef3395cf07 100644 --- a/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props +++ b/src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props @@ -57,8 +57,8 @@ $([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)')) - $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages')) - $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages')) $([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages'))