diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index b3265733e..9b1dbb231 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -169,10 +169,10 @@ $([MSBuild]::NormalizeDirectory('$(PrereqsDir)', 'keys')) $([MSBuild]::NormalizeDirectory('$(PrereqsDir)', 'packages')) - - $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'ArcadeBootstrapPackage')) - $(NuGetPackageRoot) + + $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'BootstrapPackages')) + $(NuGetPackageRoot) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'toolset', 'VSSdkResolvers')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'Symbols')) diff --git a/src/SourceBuild/content/build.sh b/src/SourceBuild/content/build.sh index a56de7c8f..9a4ce0298 100755 --- a/src/SourceBuild/content/build.sh +++ b/src/SourceBuild/content/build.sh @@ -225,7 +225,7 @@ function Build { if [ "$test" == "true" ]; then "$CLI_ROOT/dotnet" msbuild "$scriptroot/build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildTests.binlog" -flp:"LogFile=$scriptroot/artifacts/log/$configuration/BuildTests.log" -clp:v=m $properties else - "$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/tools/init-build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.binlog" -flp:LogFile="$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.log" /t:ExtractToolPackage,BuildMSBuildSdkResolver $properties + "$CLI_ROOT/dotnet" msbuild "$scriptroot/eng/tools/init-build.proj" -bl:"$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.binlog" -flp:LogFile="$scriptroot/artifacts/log/$configuration/BuildMSBuildSdkResolver.log" /t:ExtractToolsetPackages,BuildMSBuildSdkResolver $properties # kill off the MSBuild server so that on future invocations we pick up our custom SDK Resolver "$CLI_ROOT/dotnet" build-server shutdown @@ -351,20 +351,46 @@ if [[ "$sourceOnly" == "true" ]]; then exit 1 fi + # Extract toolset packages + + # Ensure that by default, the bootstrap version of the toolset SDK is used. Source-build infra + # projects use bootstrap toolset SDKs, and would fail to find it in the build. The repo + # projects overwrite this so that they use the source-built toolset SDK instad. + + # 1. Microsoft.DotNet.Arcade.Sdk arcadeSdkLine=$(grep -m 1 'MicrosoftDotNetArcadeSdkVersion' "$packageVersionsPath") - versionPattern="(.*)" - if [[ $arcadeSdkLine =~ $versionPattern ]]; then + arcadeSdkPattern="(.*)" + if [[ $arcadeSdkLine =~ $arcadeSdkPattern ]]; then export ARCADE_BOOTSTRAP_VERSION=${BASH_REMATCH[1]} - # Ensure that by default, the bootstrap version of the Arcade SDK is used. Source-build infra - # projects use bootstrap Arcade SDK, and would fail to find it in the build. The repo - # projects overwrite this so that they use the source-built Arcade SDK instad. export SOURCE_BUILT_SDK_ID_ARCADE=Microsoft.DotNet.Arcade.Sdk export SOURCE_BUILT_SDK_VERSION_ARCADE=$ARCADE_BOOTSTRAP_VERSION - export SOURCE_BUILT_SDK_DIR_ARCADE=$packagesRestoredDir/ArcadeBootstrapPackage/microsoft.dotnet.arcade.sdk/$ARCADE_BOOTSTRAP_VERSION + export SOURCE_BUILT_SDK_DIR_ARCADE=$packagesRestoredDir/BootstrapPackages/microsoft.dotnet.arcade.sdk/$ARCADE_BOOTSTRAP_VERSION fi - echo "Found bootstrap SDK $SDK_VERSION, bootstrap Arcade $ARCADE_BOOTSTRAP_VERSION" + # 2. Microsoft.Build.NoTargets + notargetsSdkLine=$(grep -m 1 'Microsoft.Build.NoTargets' "$scriptroot/global.json") + notargetsSdkPattern="\"Microsoft\.Build\.NoTargets\" *: *\"(.*)\"" + if [[ $notargetsSdkLine =~ $notargetsSdkPattern ]]; then + export NOTARGETS_BOOTSTRAP_VERSION=${BASH_REMATCH[1]} + + export SOURCE_BUILT_SDK_ID_NOTARGETS=Microsoft.Build.NoTargets + export SOURCE_BUILT_SDK_VERSION_NOTARGETS=$NOTARGETS_BOOTSTRAP_VERSION + export SOURCE_BUILT_SDK_DIR_NOTARGETS=$packagesRestoredDir/BootstrapPackages/microsoft.build.notargets/$NOTARGETS_BOOTSTRAP_VERSION + fi + + # 3. Microsoft.Build.Traversal + traversalSdkLine=$(grep -m 1 'Microsoft.Build.Traversal' "$scriptroot/global.json") + traversalSdkPattern="\"Microsoft\.Build\.Traversal\" *: *\"(.*)\"" + if [[ $traversalSdkLine =~ $traversalSdkPattern ]]; then + export TRAVERSAL_BOOTSTRAP_VERSION=${BASH_REMATCH[1]} + + export SOURCE_BUILT_SDK_ID_TRAVERSAL=Microsoft.Build.Traversal + export SOURCE_BUILT_SDK_VERSION_TRAVERSAL=$TRAVERSAL_BOOTSTRAP_VERSION + export SOURCE_BUILT_SDK_DIR_TRAVERSAL=$packagesRestoredDir/BootstrapPackages/microsoft.build.traversal/$TRAVERSAL_BOOTSTRAP_VERSION + fi + + echo "Found bootstrap versions: SDK $SDK_VERSION, Arcade $ARCADE_BOOTSTRAP_VERSION, NoTargets $NOTARGETS_BOOTSTRAP_VERSION and Traversal $TRAVERSAL_BOOTSTRAP_VERSION" fi Build diff --git a/src/SourceBuild/content/eng/tools/init-build.proj b/src/SourceBuild/content/eng/tools/init-build.proj index efed2ac52..ef2c7f618 100644 --- a/src/SourceBuild/content/eng/tools/init-build.proj +++ b/src/SourceBuild/content/eng/tools/init-build.proj @@ -17,7 +17,7 @@ BuildMSBuildSdkResolver; RestoreUnifiedBuildValidationTests; BuildLeakDetection; - ExtractToolPackage; + ExtractToolsetPackages; GenerateRootFs; PoisonPrebuiltPackages" /> @@ -97,7 +97,7 @@ - - + - + + + + + + + - + diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.props b/src/SourceBuild/content/repo-projects/Directory.Build.props index 2778bbd4b..490d86580 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.props +++ b/src/SourceBuild/content/repo-projects/Directory.Build.props @@ -54,13 +54,6 @@ $([MSBuild]::ValueOrDefault('$(ARCADE_BOOTSTRAP_VERSION)', '$(ArcadeSdkVersion)')) - - - $([System.IO.File]::ReadAllText($(RepoRoot)global.json)) - $([System.Text.RegularExpressions.Regex]::Match($(VMRGlobalJsonContents), '"Microsoft.Build.NoTargets": "([^"]*)"').Groups.get_Item(1)) - $([System.Text.RegularExpressions.Regex]::Match($(VMRGlobalJsonContents), '"Microsoft.Build.Traversal": "([^"]*)"').Groups.get_Item(1)) - - - 0 @@ -201,7 +194,7 @@ @@ -221,8 +214,8 @@ RestoreConfigFile property. MSBuild uses NuGetSdkResolver to restore missing SDKs, which doesn't honor RestoreConfigFile property and uses NuGet.config file from repo's root which has online feeds. --> - - + +