Skip to content

Commit 92bc896

Browse files
authored
Introduce -productBuild and -sourceBuild switches (#61840)
* Introduce -productBuild and -sourceBuild switches * Set product_build true when source-building
1 parent 1a7ca4a commit 92bc896

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

.azure/pipelines/ci-public.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ stages:
632632
platform:
633633
name: 'Managed'
634634
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-build-amd64'
635-
buildScript: './eng/build.sh $(_InternalRuntimeDownloadArgs)'
635+
buildScript: './eng/build.sh'
636+
buildArguments: '--source-build $(_InternalRuntimeDownloadArgs)'
636637
jobProperties:
637638
timeoutInMinutes: 120
638639
variables:

.azure/pipelines/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,9 @@ extends:
676676
enableInternalSources: true
677677
platform:
678678
name: 'Managed'
679-
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8'
680-
buildScript: './eng/build.sh $(_InternalRuntimeDownloadArgs)'
679+
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9'
680+
buildScript: './eng/build.sh'
681+
buildArguments: '--source-build $(_InternalRuntimeDownloadArgs)'
681682
jobProperties:
682683
timeoutInMinutes: 120
683684
variables:

eng/build.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ Additional feed that can be used when downloading .NET runtimes and SDKs
9999
.PARAMETER RuntimeSourceFeedKey
100100
Key for feed that can be used when downloading .NET runtimes and SDKs
101101
102+
.PARAMETER ProductBuild
103+
Build the repository in product mode (short: -pb).
104+
102105
.EXAMPLE
103106
Building both native and managed projects.
104107
@@ -196,6 +199,10 @@ param(
196199
[Alias('DotNetRuntimeSourceFeedKey')]
197200
[string]$RuntimeSourceFeedKey,
198201

202+
# Product build
203+
[Alias('pb')]
204+
[switch]$ProductBuild,
205+
199206
# Capture the rest
200207
[Parameter(ValueFromRemainingArguments = $true)]
201208
[string[]]$MSBuildArguments
@@ -275,6 +282,8 @@ $MSBuildArguments += "/p:Publish=$Publish"
275282
$MSBuildArguments += "/p:TargetArchitecture=$Architecture"
276283
$MSBuildArguments += "/p:TargetOsName=win"
277284

285+
$MSBuildArguments += "/p:DotNetBuildRepo=$ProductBuild"
286+
278287
if (-not $Configuration) {
279288
$Configuration = if ($CI) { 'Release' } else { 'Debug' }
280289
}
@@ -352,10 +361,6 @@ Remove-Item variable:global:_DotNetInstallDir -ea Ignore
352361
Remove-Item variable:global:_ToolsetBuildProj -ea Ignore
353362
Remove-Item variable:global:_MSBuildExe -ea Ignore
354363

355-
# tools.ps1 expects the remaining arguments to be available via the $properties string array variable
356-
# TODO: Remove when https://github.com/dotnet/source-build/issues/4337 is implemented.
357-
[string[]] $properties = $MSBuildArguments
358-
359364
# Import Arcade
360365
. "$PSScriptRoot/common/tools.ps1"
361366

eng/build.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ target_arch='x64'
3535
configuration=''
3636
runtime_source_feed=''
3737
runtime_source_feed_key=''
38+
source_build=false
39+
product_build=false
3840

3941
if [ "$(uname)" = "Darwin" ]; then
4042
target_os_name='osx'
@@ -88,6 +90,9 @@ Options:
8890
--runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs
8991
--runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs
9092
93+
--sourceBuild|-sb Build the repository in source-only mode.
94+
--productBuild|-pb Build the repository in product-build mode.
95+
9196
Description:
9297
This build script installs required tools and runs an MSBuild command on this repository
9398
This script can be used to invoke various targets, such as targets to produce packages
@@ -247,6 +252,13 @@ while [[ $# -gt 0 ]]; do
247252
[ -z "${1:-}" ] && __error "Missing value for parameter --runtime-source-feed-key" && __usage
248253
runtime_source_feed_key="${1:-}"
249254
;;
255+
-sourcebuild|-source-build|-sb)
256+
source_build=true
257+
product_build=true
258+
;;
259+
-productbuild|-product-build|-pb)
260+
product_build=true
261+
;;
250262
*)
251263
msbuild_args[${#msbuild_args[*]}]="$1"
252264
;;
@@ -321,6 +333,11 @@ msbuild_args[${#msbuild_args[*]}]="-p:Sign=$run_sign"
321333
msbuild_args[${#msbuild_args[*]}]="-p:TargetArchitecture=$target_arch"
322334
msbuild_args[${#msbuild_args[*]}]="-p:TargetOsName=$target_os_name"
323335

336+
sourceBuildArg="/p:DotNetBuildSourceOnly=$source_build"
337+
productBuildArg="/p:DotNetBuildRepo=$product_build"
338+
msbuild_args[${#msbuild_args[*]}]=$sourceBuildArg
339+
msbuild_args[${#msbuild_args[*]}]=$productBuildArg
340+
324341
if [ -z "$configuration" ]; then
325342
if [ "$ci" = true ]; then
326343
configuration='Release'
@@ -359,10 +376,6 @@ if [ "$(uname)" = "Darwin" ]; then
359376
ulimit -n 10000
360377
fi
361378

362-
# tools.sh expects the remaining arguments to be available via the $properties string array variable
363-
# TODO: Remove when https://github.com/dotnet/source-build/issues/4337 is implemented.
364-
properties=$msbuild_args
365-
366379
# Import Arcade
367380
. "$DIR/common/tools.sh"
368381

0 commit comments

Comments
 (0)