From 6a10678d7e25e956fe052e10d27f63ee2194564e Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Fri, 21 Apr 2023 14:15:36 +0100 Subject: [PATCH] (build) Only build projects required by Chocolatey Due to the builds starting to fail both internally and on GitHub Actions, we need to make some changes to the way the build is done. The suspicion is that due to a new version of Visual Studio, or perhaps the SDK, the part of the build the deals with the building of the Visual Studio Extension is failing. Since we don't actually need this project to be built for what Chocolatey needs, let reduce the amount of projects that are built, being very specific about which projects are compiled. This has been achieved by adding a new -ChocolateyBuild parameter, which is passed into MSBuild as a parameter, and which then chooses only the projects that we want/need. This has been tested locally, and proven to complete, so time to try it out on CI... --- .github/workflows/build.yml | 2 +- .teamcity/settings.kts | 2 +- build.ps1 | 38 +++++++++++++++++--- build/build.proj | 40 ++++++++++++++++++++- build/common.project.props | 72 +++++++++++++++++++++++++++++++++++-- 5 files changed, 144 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8d13ee0f82..531b0006bfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,4 +13,4 @@ jobs: - name: Configure .Net and other dependencies run: .\configure.ps1 - name: Build - run: .\build.ps1 -CI -SkipUnitTest \ No newline at end of file + run: .\build.ps1 -CI -SkipUnitTest -ChocolateyBuild \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 420aec88dfc..bd78eda4431 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -51,7 +51,7 @@ object ChocolateyNugetClient : BuildType({ name = "Build" scriptMode = script { content = """ - .\build.ps1 -CI -SkipUnitTest -BuildNumber %build.counter% -ReleaseLabel beta -BuildDate (Get-Date -Format "yyyyMMdd") + .\build.ps1 -CI -SkipUnitTest -ChocolateyBuild -BuildNumber %build.counter% -ReleaseLabel beta -BuildDate (Get-Date -Format "yyyyMMdd") """.trimIndent() } } diff --git a/build.ps1 b/build.ps1 index 6353dedbc78..db0f90d95f6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -55,7 +55,11 @@ param ( [switch]$PackageEndToEnd, [switch]$SkipDelaySigning, [switch]$Binlog, - [switch]$IncludeApex + [switch]$IncludeApex, + ################################## + # Chocolatey Specific Modification + ################################## + [switch]$ChocolateyBuild ) . "$PSScriptRoot\build\common.ps1" @@ -111,7 +115,13 @@ Invoke-BuildStep 'Running Restore' { Trace-Log ". `"$MSBuildExe`" $restoreArgs" & $MSBuildExe @restoreArgs - $restoreArgs = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:IncludeApex=$IncludeApex", "/v:m", "/m" + ######################################## + # Start Chocolatey Specific Modification + ######################################## + $restoreArgs = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:IncludeApex=$IncludeApex", "/p:ChocolateyBuild=$ChocolateyBuild", "/v:m", "/m" + ######################################## + # End Chocolatey Specific Modification + ######################################## if ($BuildNumber) { @@ -142,7 +152,13 @@ Invoke-BuildStep 'Running Restore' { Invoke-BuildStep $VSMessage { - $buildArgs = 'build\build.proj', "/t:$VSTarget", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:IncludeApex=$IncludeApex", '/v:m', '/m' + ######################################## + # Start Chocolatey Specific Modification + ######################################## + $buildArgs = 'build\build.proj', "/t:$VSTarget", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:IncludeApex=$IncludeApex", "/p:ChocolateyBuild=$ChocolateyBuild", '/v:m', '/m' + ######################################## + # End Chocolatey Specific Modification + ######################################## if ($BuildNumber) { @@ -191,7 +207,13 @@ Invoke-BuildStep 'Creating the EndToEnd test package' { Invoke-BuildStep 'Running Restore RTM' { # Restore for VS - $restoreArgs = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:BuildRTM=true", "/p:ReleaseLabel=$ReleaseLabel", "/p:ExcludeTestProjects=true", "/v:m", "/m" + ######################################## + # Start Chocolatey Specific Modification + ######################################## + $restoreArgs = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:BuildRTM=true", "/p:ReleaseLabel=$ReleaseLabel", "/p:ExcludeTestProjects=true", "/p:ChocolateyBuild=$ChocolateyBuild", "/v:m", "/m" + ######################################## + # End Chocolatey Specific Modification + ######################################## if ($BuildNumber) { @@ -224,7 +246,13 @@ Invoke-BuildStep 'Running Restore RTM' { Invoke-BuildStep 'Packing RTM' { # Build and (If not $SkipUnitTest) Pack, Core unit tests, and Unit tests for VS - $packArgs = "build\build.proj", "/t:BuildVS`;Pack", "/p:Configuration=$Configuration", "/p:BuildRTM=true", "/p:ReleaseLabel=$ReleaseLabel", "/p:ExcludeTestProjects=true", "/v:m", "/m" + ######################################## + # Start Chocolatey Specific Modification + ######################################## + $packArgs = "build\build.proj", "/t:BuildVS`;Pack", "/p:Configuration=$Configuration", "/p:BuildRTM=true", "/p:ReleaseLabel=$ReleaseLabel", "/p:ExcludeTestProjects=true", "/p:ChocolateyBuild=$ChocolateyBuild", "/v:m", "/m" + ######################################## + # End Chocolatey Specific Modification + ######################################## if ($BuildNumber) { diff --git a/build/build.proj b/build/build.proj index f154b58cc96..2c5d475f59e 100644 --- a/build/build.proj +++ b/build/build.proj @@ -165,6 +165,31 @@ Properties="$(CommonMSBuildProperties)" /> + + + + + + + + + + + - + + + + + + - + + + + + + + + + + + + + + + + - + + +