Skip to content

Commit 88d69ba

Browse files
authored
officialBuildId argument for build script (#1497)
1 parent f07a89b commit 88d69ba

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

build.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ set -e
1010
usage()
1111
{
1212
echo "Common settings:"
13-
echo " --binaryLog Create MSBuild binary log (short: -bl)"
13+
echo " --binaryLog Create MSBuild binary log (short: -bl)"
1414
echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
1515
echo " --rid, --target-rid <value> Overrides the rid that is produced by the build. e.g. alpine.3.18-arm64, fedora.37-x64, freebsd.13-arm64, ubuntu.19.10-x64"
1616
echo " --os, --target-os <value> Target operating system: e.g. linux, osx, freebsd. Note: this is the base OS name, not the distro"
1717
echo " --arch, --target-arch <value> Target architecture: e.g. x64, x86, arm64, arm, riscv64"
1818
echo " --branding <preview|rtm|default> Specify versioning for shipping packages/assets. 'preview' will produce assets suffixed with '.final', 'rtm' will not contain a pre-release suffix. Default or unspecified will use VMR repo defaults."
1919
echo " --verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
2020
echo " --with-system-libs <libs> Use system versions of these libraries. Combine with a plus. 'all' will use all supported libraries. e.g. brotli+libunwind+rapidjson+zlib"
21+
echo " --official-build-id <YYYYMMDD.X> Official build ID to use for the build. This is used to set the OfficialBuildId MSBuild property."
22+
2123
echo ""
2224

2325
echo "Actions:"
@@ -146,6 +148,15 @@ while [[ $# > 0 ]]; do
146148
properties+=( "/p:UseSystemLibs=$value" )
147149
shift
148150
;;
151+
-official-build-id)
152+
officialBuildId="$2"
153+
if [[ ! "$officialBuildId" =~ ^[0-9]{8}\.[0-9]{1,3}$ ]]; then
154+
echo "ERROR: Invalid official-build-id format. Expected format: YYYYYMMDD.X"
155+
#exit 1
156+
fi
157+
properties+=( "/p:OfficialBuildId=$officialBuildId" )
158+
shift
159+
;;
149160
-verbosity|-v)
150161
verbosity=$2
151162
shift

eng/build.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Param(
99
[string][Alias('v')]$verbosity = "minimal",
1010
[Parameter()][ValidateSet("preview", "rtm", "default")]
1111
[string]$branding = "default",
12+
[Parameter()][ValidatePattern("^\d{8}\.\d{1,3}$")]
13+
[string][Alias('obid')]$officialBuildId,
1214

1315
# Actions
1416
[switch]$clean,
@@ -31,13 +33,14 @@ Param(
3133

3234
function Get-Usage() {
3335
Write-Host "Common settings:"
34-
Write-Host " -binaryLog Output binary log (short: -bl)"
35-
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c). [Default: Release]"
36-
Write-Host " -rid, -targetRid <value> Overrides the rid that is produced by the build. e.g. win-arm64, win-x64"
37-
Write-Host " -os, -targetOS <value> Target operating system: e.g. windows."
38-
Write-Host " -arch, -targetArch <value> Target architecture: e.g. x64, x86, arm64, arm, riscv64"
39-
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
36+
Write-Host " -binaryLog Output binary log (short: -bl)"
37+
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c). [Default: Release]"
38+
Write-Host " -rid, -targetRid <value> Overrides the rid that is produced by the build. e.g. win-arm64, win-x64"
39+
Write-Host " -os, -targetOS <value> Target operating system: e.g. windows."
40+
Write-Host " -arch, -targetArch <value> Target architecture: e.g. x64, x86, arm64, arm, riscv64"
41+
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
4042
Write-Host " -branding <preview|rtm|default> Specify versioning for shipping packages/assets. 'preview' will produce assets suffixed with '.final', 'rtm' will not contain a pre-release suffix. Default or unspecified will use VMR repo defaults."
43+
Write-Host " -officialBuildId <YYYYMMDD.X> Official build ID to use for the build. This is used to set the OfficialBuildId MSBuild property."
4144
Write-Host ""
4245

4346
Write-Host "Actions:"
@@ -95,6 +98,7 @@ if ($branding) {
9598
"default" { $arguments += "" }
9699
}
97100
}
101+
if ($officialBuildId) { $arguments += "/p:OfficialBuildId=$officialBuildId" }
98102

99103
function Build {
100104
$toolsetBuildProj = InitializeToolset

eng/pipelines/templates/jobs/vmr-build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,24 @@ jobs:
232232
- name: brandingArgument
233233
value: $(commandPrefix)branding $(brandingType)
234234

235+
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), notin(variables['Build.Reason'], 'PullRequest')) }}:
236+
- name: officialBuildArgument
237+
${{ if eq(parameters.targetOS, 'windows') }}:
238+
value: $(commandPrefix)officialBuildId $(Build.BuildNumber)
239+
${{ else }}:
240+
value: $(commandPrefix)official-build-id $(Build.BuildNumber)
241+
- ${{ else }}:
242+
- name: officialBuildArgument
243+
value: ''
244+
235245
- name: useSystemLibrariesArgument
236246
${{ if eq(parameters.useSystemLibraries, 'true') }}:
237247
value: $(commandPrefix)with-system-libs all
238248
${{ else }}:
239249
value: ''
240250

241251
- name: baseArguments
242-
value: $(commandPrefix)ci $(cleanArgument) $(commandPrefix)prepareMachine -c ${{ parameters.configuration }} $(brandingArgument) $(useSystemLibrariesArgument)
252+
value: $(commandPrefix)ci $(cleanArgument) $(commandPrefix)prepareMachine -c ${{ parameters.configuration }} $(brandingArgument) $(useSystemLibrariesArgument) $(officialBuildArgument)
243253

244254
- name: baseProperties
245255
value: $(officialBuildProperties) /p:VerticalName=$(Agent.JobName)

eng/pipelines/templates/variables/vmr-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ variables:
7373

7474
- ${{ if eq(variables['isOfficialBuild'], true) }}:
7575
- name: officialBuildProperties
76-
value: '/p:OfficialBuildId=$(Build.BuildNumber) $(officialBuilderProperty)'
76+
value: '$(officialBuilderProperty)'
7777
- ${{ else }}:
7878
- name: officialBuildProperties
7979
value: ''

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy