Skip to content

Commit 0927e41

Browse files
Introduce -productBuild and -sourceBuild switches (dotnet#78519)
* Introduce -productBuild and -sourceBuild switches * Update eng/build.sh Co-authored-by: Viktor Hofer <[email protected]> * Update build.sh * Add new options for SB and PB switches * Remove leftover SB arg --------- Co-authored-by: Viktor Hofer <[email protected]>
1 parent 07b88d3 commit 0927e41

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

eng/build.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ param (
4343
[switch]$prepareMachine,
4444
[switch]$useGlobalNuGetCache = $true,
4545
[switch]$warnAsError = $false,
46-
[switch]$sourceBuild = $false,
46+
[switch][Alias('pb')]$productBuild = $false,
4747
[switch]$oop64bit = $true,
4848
[switch]$lspEditor = $false,
4949
[string]$solution = "Roslyn.sln",
@@ -112,7 +112,7 @@ function Print-Usage() {
112112
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
113113
Write-Host " -useGlobalNuGetCache Use global NuGet cache."
114114
Write-Host " -warnAsError Treat all warnings as errors"
115-
Write-Host " -sourceBuild Simulate building source-build"
115+
Write-Host " -productBuild Build the repository in product-build mode"
116116
Write-Host " -solution Solution to build (default is Roslyn.sln)"
117117
Write-Host ""
118118
Write-Host "Official build settings:"
@@ -210,7 +210,7 @@ function Process-Arguments() {
210210
$script:restore = $true
211211
}
212212

213-
if ($sourceBuild) {
213+
if ($productBuild) {
214214
$script:msbuildEngine = "dotnet"
215215
}
216216

@@ -260,9 +260,6 @@ function BuildSolution() {
260260
# Workaround for some machines in the AzDO pool not allowing long paths
261261
$ibcDir = $RepoRoot
262262

263-
# Set DotNetBuildSourceOnly to 'true' if we're simulating building for source-build.
264-
$buildFromSource = if ($sourceBuild) { "/p:DotNetBuildSourceOnly=true" } else { "" }
265-
266263
$generateDocumentationFile = if ($skipDocumentation) { "/p:GenerateDocumentationFile=false" } else { "" }
267264
$roslynUseHardLinks = if ($ci) { "/p:ROSLYNUSEHARDLINKS=true" } else { "" }
268265

@@ -287,9 +284,9 @@ function BuildSolution() {
287284
/p:IbcOptimizationDataDir=$ibcDir `
288285
/p:VisualStudioIbcDrop=$ibcDropName `
289286
/p:VisualStudioDropAccessToken=$officialVisualStudioDropAccessToken `
287+
/p:DotNetBuildRepo=$productBuild `
290288
$suppressExtensionDeployment `
291289
$msbuildWarnAsError `
292-
$buildFromSource `
293290
$generateDocumentationFile `
294291
$roslynUseHardLinks `
295292
@properties

eng/build.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ usage()
3737
echo " --skipDocumentation Skip generation of XML documentation files"
3838
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
3939
echo " --warnAsError Treat all warnings as errors"
40-
echo " --sourceBuild Simulate building for source-build"
40+
echo " --sourceBuild Build the repository in source-only mode"
41+
echo " --productBuild Build the repository in product-build mode."
4142
echo " --solution Solution to build (default is Compilers.slnf)"
4243
echo ""
4344
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
@@ -80,6 +81,7 @@ prepare_machine=false
8081
warn_as_error=false
8182
properties=""
8283
source_build=false
84+
product_build=false
8385
solution_to_build="Compilers.slnf"
8486

8587
args=""
@@ -173,8 +175,12 @@ while [[ $# > 0 ]]; do
173175
--warnaserror)
174176
warn_as_error=true
175177
;;
176-
--sourcebuild|-sb)
178+
--sourcebuild|--source-build|-sb)
177179
source_build=true
180+
product_build=true
181+
;;
182+
--productbuild|--product-build|-pb)
183+
product_build=true
178184
;;
179185
--solution)
180186
solution_to_build=$2
@@ -281,12 +287,6 @@ function BuildSolution {
281287
roslyn_use_hard_links="/p:ROSLYNUSEHARDLINKS=true"
282288
fi
283289

284-
local source_build_args=""
285-
if [[ "$source_build" == true ]]; then
286-
source_build_args="/p:DotNetBuildSourceOnly=true \
287-
/p:DotNetBuildRepo=true"
288-
fi
289-
290290
# Setting /p:TreatWarningsAsErrors=true is a workaround for https://github.com/Microsoft/msbuild/issues/3062.
291291
# We don't pass /warnaserror to msbuild (warn_as_error is set to false by default above), but set
292292
# /p:TreatWarningsAsErrors=true so that compiler reported warnings, other than IDE0055 are treated as errors.
@@ -308,7 +308,8 @@ function BuildSolution {
308308
/p:ContinuousIntegrationBuild=$ci \
309309
/p:TreatWarningsAsErrors=true \
310310
/p:TestRuntimeAdditionalArguments=$test_runtime_args \
311-
$source_build_args \
311+
/p:DotNetBuildSourceOnly=$source_build \
312+
/p:DotNetBuildRepo=$product_build \
312313
$test_runtime \
313314
$mono_tool \
314315
$generate_documentation_file \

0 commit comments

Comments
 (0)