From 0a0217fe0cdd3654105d1c46be4e43eeae9c163e Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Mon, 11 Dec 2023 13:12:17 -0800 Subject: [PATCH] Enable Vertical build PoC as a more first-class concept (#14274) Co-authored-by: Viktor Hofer --- eng/common/build.ps1 | 3 + eng/common/build.sh | 8 ++ eng/common/tools.ps1 | 3 +- .../Microsoft.DotNet.Arcade.Sdk.csproj | 2 +- .../tools/Build.proj | 11 +- ...cludeFromBuild.BeforeCommonTargets.targets | 6 +- .../tools/Publish.proj | 2 +- .../tools/SourceBuild/AfterSourceBuild.proj | 4 +- .../SourceBuildArcadeBuild.targets | 29 +++-- .../tools/SourceBuild/git-clone-to-dir.ps1 | 111 ++++++++++++++++++ .../tools/Tests.props | 2 + .../tools/Tools.proj | 2 +- .../Microsoft.DotNet.AsmDiff.csproj | 2 + 13 files changed, 165 insertions(+), 20 deletions(-) create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/git-clone-to-dir.ps1 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 33a6f2d0e24..066044f62f2 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -19,6 +19,7 @@ Param( [switch] $pack, [switch] $publish, [switch] $clean, + [switch] $verticalBuild, [switch][Alias('bl')]$binaryLog, [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, @@ -58,6 +59,7 @@ function Print-Usage() { Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" Write-Host " -clean Clean the solution" + Write-Host " -verticalBuild Run in 'vertical build' infra mode." Write-Host "" Write-Host "Advanced settings:" @@ -120,6 +122,7 @@ function Build { /p:Deploy=$deploy ` /p:Test=$test ` /p:Pack=$pack ` + /p:ArcadeBuildVertical=$verticalBuild ` /p:IntegrationTest=$integrationTest ` /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` diff --git a/eng/common/build.sh b/eng/common/build.sh index 2c17ba529b9..5ce01dd161a 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -59,6 +59,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" restore=false build=false source_build=false +vertical_build=false rebuild=false test=false integration_test=false @@ -129,6 +130,12 @@ while [[ $# > 0 ]]; do restore=true pack=true ;; + -verticalbuild|-vb) + build=true + vertical_build=true + restore=true + pack=true + ;; -test|-t) test=true ;; @@ -220,6 +227,7 @@ function Build { /p:Restore=$restore \ /p:Build=$build \ /p:ArcadeBuildFromSource=$source_build \ + /p:ArcadeBuildVertical=$vertical_build \ /p:Rebuild=$rebuild \ /p:Test=$test \ /p:Pack=$pack \ diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e8def7e6a85..162dee2b936 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -827,7 +827,8 @@ function MSBuild-Core() { } } - $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" + # Be sure quote the path in case there are spaces in the dotnet installation location. + $env:ARCADE_BUILD_TOOL_COMMAND = "`"$($buildTool.Path)`" $cmdArgs" $exitCode = Exec-Process $buildTool.Path $cmdArgs diff --git a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj index 9dc910778ea..08bfeaa4120 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj +++ b/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj @@ -16,7 +16,7 @@ false <_GeneratedVersionFilePath>$(IntermediateOutputPath)DefaultVersions.Generated.props - $(NoWarn);3021;NU5105;SYSLIB0013 + $(NoWarn);3021;NU5105;NU5111;SYSLIB0013 diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj index 2bae0717032..29e73cbe51f 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Build.proj @@ -10,6 +10,7 @@ Configuration Build configuration: "Debug", "Release", etc. DotNetBuildFromSource Building the entire stack from source with no external dependencies. + DotNetBuildVertical Building the entire stack in "Vertical" PoC mode. This is a superset of DotNetBuildFromSource. DotNetOutputBlobFeedDir Directory to publish Source Build assets to (packages, symbol packages, installers, etc.). DotNetPublishUsingPipelines Publish assets to Build Asset Registry. DotNetSymbolServerTokenMsdl Personal access token for MSDL symbol server. Available from variable group DotNet-Symbol-Server-Pats. @@ -47,7 +48,7 @@ - + @@ -121,10 +122,10 @@ <_CommonProps Include="VersionsPropsPath=$(VersionsPropsPath)"/> - <_CommonProps Include="DisableWarnForInvalidRestoreProjects=true" Condition="'$(DotNetBuildFromSource)' == 'true'"/> + <_CommonProps Include="DisableWarnForInvalidRestoreProjects=true" Condition="'$(DotNetBuildFromSource)' == 'true' or '$(DotNetBuildVertical)' == 'true'"/> + Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(ArcadeBuildVertical)' == 'true'"/> + Condition="'$(DotNetBuildFromSourceFlavor)' != 'Product' and '$(ArcadeBuildVertical)' != 'true'" /> @@ -72,8 +72,9 @@ $(InnerBuildArgs) /p:ArcadeInnerBuildFromSource=true - - $(InnerBuildArgs) /p:DotNetBuildFromSource=true + + $(InnerBuildArgs) /p:DotNetBuildFromSource=true + $(InnerBuildArgs) /p:DotNetBuildVertical=true $(InnerBuildArgs) /p:RepoRoot=$(InnerSourceBuildRepoRoot) @@ -87,7 +88,7 @@ $(InnerBuildArgs) /p:SourceBuildOutputDir=$(SourceBuildOutputDir) $(InnerBuildArgs) /p:SourceBuiltBlobFeedDir=$(SourceBuiltBlobFeedDir) - $(InnerBuildArgs) /p:DotNetBuildOffline=true + $(InnerBuildArgs) /p:DotNetBuildOffline=true $(InnerBuildArgs) /p:DotNetPackageVersionPropsPath=$(DotNetPackageVersionPropsPath) $(InnerBuildArgs) /p:FullAssemblySigningSupported=$(FullAssemblySigningSupported) @@ -96,7 +97,7 @@ - + @@ -140,15 +141,27 @@ true <_GitCloneToDirArgs /> + + + + <_GitCloneToDirArgs>$(_GitCloneToDirArgs) -Source '$(RepoRoot)' + <_GitCloneToDirArgs>$(_GitCloneToDirArgs) -Dest '$(InnerSourceBuildRepoRoot)' + <_GitCloneToDirArgs Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == 'true'">$(_GitCloneToDirArgs) -CopyWip + <_GitCloneToDirArgs Condition="'$(CleanInnerSourceBuildRepoRoot)' == 'true'">$(_GitCloneToDirArgs) -Clean + + <_GitCloneToDirScriptCommand>powershell -ExecutionPolicy Unrestricted -NoProfile -command "& $(MSBuildThisFileDirectory)git-clone-to-dir.ps1 $(_GitCloneToDirArgs)" + + + <_GitCloneToDirArgs>$(_GitCloneToDirArgs) --source "$(RepoRoot)" <_GitCloneToDirArgs>$(_GitCloneToDirArgs) --dest "$(InnerSourceBuildRepoRoot)" <_GitCloneToDirArgs Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == 'true'">$(_GitCloneToDirArgs) --copy-wip <_GitCloneToDirArgs Condition="'$(CleanInnerSourceBuildRepoRoot)' == 'true'">$(_GitCloneToDirArgs) --clean - <_GitCloneToDirScriptFile>$(MSBuildThisFileDirectory)git-clone-to-dir.sh + <_GitCloneToDirScriptCommand>$(MSBuildThisFileDirectory)git-clone-to-dir.sh $(_GitCloneToDirArgs) - + true + + true diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj index 5d978ade3af..b7f3831ed7b 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj @@ -56,7 +56,7 @@ - + diff --git a/src/Microsoft.DotNet.AsmDiff/Microsoft.DotNet.AsmDiff.csproj b/src/Microsoft.DotNet.AsmDiff/Microsoft.DotNet.AsmDiff.csproj index 66c20be3a6b..3607971b8a4 100644 --- a/src/Microsoft.DotNet.AsmDiff/Microsoft.DotNet.AsmDiff.csproj +++ b/src/Microsoft.DotNet.AsmDiff/Microsoft.DotNet.AsmDiff.csproj @@ -8,6 +8,8 @@ true dotnet-asmdiff true + + true Open true