Skip to content

Commit 5935e12

Browse files
authored
Add --os and --arch in VMR build script (#48591)
1 parent 9ad45c6 commit 5935e12

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ jobs:
243243

244244
- name: targetProperties
245245
${{ if and(ne(parameters.targetOS, ''), ne(parameters.targetArchitecture, '')) }}:
246-
value: /p:TargetOS=${{ parameters.targetOS }} /p:TargetArchitecture=${{ parameters.targetArchitecture }}
246+
value: -os ${{ parameters.targetOS }} -arch ${{ parameters.targetArchitecture }}
247247
${{ elseif ne(parameters.targetOS, '') }}:
248-
value: /p:TargetOS=${{ parameters.targetOS }}
248+
value: -os ${{ parameters.targetOS }}
249249
${{ else }}:
250-
value: /p:TargetArchitecture=${{ parameters.targetArchitecture }}
250+
value: -arch ${{ parameters.targetArchitecture }}
251251

252252
### Signing
253253
- name: _SignDiagnosticFilesArgs

src/SourceBuild/content/build.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ usage()
1313
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"
16+
echo " --os, --target-os <value> Target operating system: e.g. linux, osx, freebsd. Note: this is the base OS name, not the distro"
17+
echo " --arch, --target-arch <value> Target architecture: e.g. x64, x86, arm64, arm, riscv64"
1618
echo " --verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
1719
echo " --with-system-libs <libs> Use system versions of these libraries. Combine with a plus. eg brotli+libunwind+rapidjson+zlib"
1820
echo ""
@@ -87,8 +89,6 @@ projects=''
8789
ci=false
8890
exclude_ci_binary_log=false
8991
prepare_machine=false
90-
target_rid=
91-
system_libs=
9292

9393
properties=()
9494
while [[ $# > 0 ]]; do
@@ -103,11 +103,19 @@ while [[ $# > 0 ]]; do
103103
shift
104104
;;
105105
-rid|-target-rid)
106-
target_rid=$2
106+
properties+=( "/p:TargetRid=$2" )
107+
shift
108+
;;
109+
-os|-target-os)
110+
properties+=( "/p:TargetOS=$2" )
111+
shift
112+
;;
113+
-arch|-target-arch)
114+
properties+=( "/p:TargetArchitecture=$2" )
107115
shift
108116
;;
109117
-with-system-libs)
110-
system_libs=$2
118+
properties+=( "/p:UseSystemLibs=$2" )
111119
shift
112120
;;
113121
-verbosity|-v)
@@ -291,12 +299,6 @@ fi
291299
source $scriptroot/eng/common/native/init-os-and-arch.sh
292300
source $scriptroot/eng/common/native/init-distro-rid.sh
293301
initDistroRidGlobal "$os" "$arch" ""
294-
if [[ -n "$target_rid" ]]; then
295-
properties+=( "/p:TargetRid=$target_rid" )
296-
fi
297-
if [[ -n "$system_libs" ]]; then
298-
properties+=( "/p:UseSystemLibs=$system_libs" )
299-
fi
300302

301303
# Source-only settings
302304
if [[ "$sourceOnly" == "true" ]]; then

src/SourceBuild/content/eng/build.ps1

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Param(
33
# Common settings
44
[switch][Alias('bl')]$binaryLog,
55
[string][Alias('c')]$configuration = "Release",
6+
[string][Alias('rid')]$targetRid,
7+
[string][Alias('os')]$targetOS,
8+
[string][Alias('arch')]$targetArch,
69
[string][Alias('v')]$verbosity = "minimal",
710

811
# Actions
@@ -23,9 +26,12 @@ Param(
2326

2427
function Get-Usage() {
2528
Write-Host "Common settings:"
26-
Write-Host " -binaryLog Output binary log (short: -bl)"
27-
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c). [Default: Release]"
28-
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
29+
Write-Host " -binaryLog Output binary log (short: -bl)"
30+
Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c). [Default: Release]"
31+
Write-Host " -rid, -targetRid <value> Overrides the rid that is produced by the build. e.g. win-arm64, win-x64"
32+
Write-Host " -os, -targetOS <value> Target operating system: e.g. windows."
33+
Write-Host " -arch, -targetArch <value> Target architecture: e.g. x64, x86, arm64, arm, riscv64"
34+
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
2935
Write-Host ""
3036

3137
Write-Host "Actions:"
@@ -71,6 +77,18 @@ if ($projects) {
7177
$project = $projects
7278
}
7379

80+
if ($targetRid) {
81+
$arguments += "/p:TargetRid=$targetRid"
82+
}
83+
84+
if ($targetOS) {
85+
$arguments += "/p:TargetOS=$targetOS"
86+
}
87+
88+
if ($targetArch) {
89+
$arguments += "/p:TargetArchitecture=$targetArch"
90+
}
91+
7492
if ($sign) {
7593
$arguments += "/p:Sign=true"
7694
}

0 commit comments

Comments
 (0)