Skip to content

Commit ea3b9d1

Browse files
committed
Sync the entire eng/common
1 parent b15898e commit ea3b9d1

38 files changed

Lines changed: 1253 additions & 641 deletions

eng/common/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# `eng/common`
2+
3+
Files under `eng/common` come from [Arcade](https://github.com/dotnet/arcade).
4+
Edits in `eng/common` will be overwritten by automation unless the changes are made directly in the Arcade repository.
5+
For more information, see the [Arcade documentation](https://github.com/dotnet/arcade/tree/main/Documentation).

eng/common/SetupNugetSources.ps1

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# This script adds internal feeds required to build commits that depend on internal package sources. For instance,
2-
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. Similarly,
3-
# dotnet-eng-internal and dotnet-tools-internal are added if dotnet-eng and dotnet-tools are present.
4-
# In addition, this script also enables disabled internal Maestro (darc-int*) feeds.
2+
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables
3+
# disabled internal Maestro (darc-int*) feeds.
54
#
65
# Optionally, this script also adds a credential entry for each of the internal feeds if supplied.
76
#
@@ -33,6 +32,11 @@ $ErrorActionPreference = "Stop"
3332
Set-StrictMode -Version 2.0
3433
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
3534

35+
# This script only consumes helper functions from tools.ps1 to configure NuGet feeds.
36+
# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring
37+
# a bootstrap SDK) is not triggered as a side effect of feed configuration.
38+
$disableConfigureToolsetImport = $true
39+
3640
. $PSScriptRoot\tools.ps1
3741

3842
# Adds or enables the package source with the given name
@@ -174,16 +178,4 @@ foreach ($dotnetVersion in $dotnetVersions) {
174178
}
175179
}
176180

177-
# Check for dotnet-eng and add dotnet-eng-internal if present
178-
$dotnetEngSource = $sources.SelectSingleNode("add[@key='dotnet-eng']")
179-
if ($dotnetEngSource -ne $null) {
180-
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "dotnet-eng-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-eng-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
181-
}
182-
183-
# Check for dotnet-tools and add dotnet-tools-internal if present
184-
$dotnetToolsSource = $sources.SelectSingleNode("add[@key='dotnet-tools']")
185-
if ($dotnetToolsSource -ne $null) {
186-
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "dotnet-tools-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
187-
}
188-
189181
$doc.Save($filename)

eng/common/SetupNugetSources.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env bash
22

33
# This script adds internal feeds required to build commits that depend on internal package sources. For instance,
4-
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. Similarly,
5-
# dotnet-eng-internal and dotnet-tools-internal are added if dotnet-eng and dotnet-tools are present.
6-
# In addition, this script also enables disabled internal Maestro (darc-int*) feeds.
4+
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables
5+
# disabled internal Maestro (darc-int*) feeds.
76
#
87
# Optionally, this script also adds a credential entry for each of the internal feeds if supplied.
98
#
@@ -41,6 +40,11 @@ while [[ -h "$source" ]]; do
4140
done
4241
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
4342

43+
# This script only consumes helper functions from tools.sh to configure NuGet feeds.
44+
# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring
45+
# a bootstrap SDK) is not triggered as a side effect of feed configuration.
46+
disable_configure_toolset_import=1
47+
4448
. "$scriptroot/tools.sh"
4549

4650
if [ ! -f "$ConfigFile" ]; then
@@ -174,18 +178,6 @@ for DotNetVersion in ${DotNetVersions[@]} ; do
174178
fi
175179
done
176180

177-
# Check for dotnet-eng and add dotnet-eng-internal if present
178-
grep -i "<add key=\"dotnet-eng\"" $ConfigFile > /dev/null
179-
if [ "$?" == "0" ]; then
180-
AddOrEnablePackageSource "dotnet-eng-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-eng-internal/nuget/$FeedSuffix"
181-
fi
182-
183-
# Check for dotnet-tools and add dotnet-tools-internal if present
184-
grep -i "<add key=\"dotnet-tools\"" $ConfigFile > /dev/null
185-
if [ "$?" == "0" ]; then
186-
AddOrEnablePackageSource "dotnet-tools-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/$FeedSuffix"
187-
fi
188-
189181
# I want things split line by line
190182
PrevIFS=$IFS
191183
IFS=$'\n'

eng/common/build.ps1

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Param(
66
[string][Alias('v')]$verbosity = "minimal",
77
[string] $msbuildEngine = $null,
88
[bool] $warnAsError = $true,
9+
[string] $warnNotAsError = '',
910
[bool] $nodeReuse = $true,
1011
[switch] $buildCheck = $false,
1112
[switch][Alias('r')]$restore,
@@ -23,6 +24,7 @@ Param(
2324
[switch][Alias('pb')]$productBuild,
2425
[switch]$fromVMR,
2526
[switch][Alias('bl')]$binaryLog,
27+
[string][Alias('bln')]$binaryLogName = '',
2628
[switch][Alias('nobl')]$excludeCIBinarylog,
2729
[switch] $ci,
2830
[switch] $prepareMachine,
@@ -45,6 +47,7 @@ function Print-Usage() {
4547
Write-Host " -platform <value> Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild"
4648
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
4749
Write-Host " -binaryLog Output binary log (short: -bl)"
50+
Write-Host " -binaryLogName <value> Binary log file name or path; implies -binaryLog (short: -bln)"
4851
Write-Host " -help Print help and exit"
4952
Write-Host ""
5053

@@ -70,6 +73,7 @@ function Print-Usage() {
7073
Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)"
7174
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
7275
Write-Host " -warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
76+
Write-Host " -warnNotAsError <value> Sets a semi-colon delimited list of warning codes that should not be treated as errors"
7377
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
7478
Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio"
7579
Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)"
@@ -100,7 +104,19 @@ function Build {
100104
$toolsetBuildProj = InitializeToolset
101105
InitializeCustomToolset
102106

103-
$bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' }
107+
$bl = ''
108+
if ($binaryLog) {
109+
$binaryLogPath = if ([string]::IsNullOrEmpty($binaryLogName)) {
110+
Join-Path $LogDir 'Build.binlog'
111+
} elseif ([System.IO.Path]::IsPathRooted($binaryLogName)) {
112+
$binaryLogName
113+
} else {
114+
Join-Path $LogDir $binaryLogName
115+
}
116+
117+
Create-Directory (Split-Path -Parent $binaryLogPath)
118+
$bl = '/bl:' + $binaryLogPath
119+
}
104120
$platformArg = if ($platform) { "/p:Platform=$platform" } else { '' }
105121
$check = if ($buildCheck) { '/check' } else { '' }
106122

@@ -157,7 +173,15 @@ try {
157173
if (-not $excludeCIBinarylog) {
158174
$binaryLog = $true
159175
}
160-
$nodeReuse = $false
176+
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
177+
# Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on.
178+
if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") {
179+
$nodeReuse = $false
180+
}
181+
}
182+
183+
if (-not [string]::IsNullOrEmpty($binaryLogName)) {
184+
$binaryLog = $true
161185
}
162186

163187
if ($nativeToolsOnMachine) {

eng/common/build.sh

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ usage()
1313
echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
1414
echo " --verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
1515
echo " --binaryLog Create MSBuild binary log (short: -bl)"
16+
echo " --binaryLogName <value> Binary log file name or path; implies --binaryLog (short: -bln)"
1617
echo " --help Print help and exit (short: -h)"
1718
echo ""
1819

@@ -42,6 +43,7 @@ usage()
4243
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
4344
echo " --nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
4445
echo " --warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
46+
echo " --warnNotAsError <value> Sets a semi-colon delimited list of warning codes that should not be treated as errors"
4547
echo " --buildCheck <value> Sets /check msbuild parameter"
4648
echo " --fromVMR Set when building from within the VMR"
4749
echo ""
@@ -78,11 +80,12 @@ ci=false
7880
clean=false
7981

8082
warn_as_error=true
83+
warn_not_as_error=''
8184
node_reuse=true
8285
build_check=false
8386
binary_log=false
87+
binary_log_name=''
8488
exclude_ci_binary_log=false
85-
pipelines_log=false
8689

8790
projects=''
8891
configuration=''
@@ -92,7 +95,7 @@ runtime_source_feed=''
9295
runtime_source_feed_key=''
9396

9497
properties=()
95-
while [[ $# > 0 ]]; do
98+
while [[ $# -gt 0 ]]; do
9699
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
97100
case "$opt" in
98101
-help|-h)
@@ -113,12 +116,14 @@ while [[ $# > 0 ]]; do
113116
-binarylog|-bl)
114117
binary_log=true
115118
;;
119+
-binarylogname|-bln)
120+
binary_log=true
121+
binary_log_name=$2
122+
shift
123+
;;
116124
-excludecibinarylog|-nobl)
117125
exclude_ci_binary_log=true
118126
;;
119-
-pipelineslog|-pl)
120-
pipelines_log=true
121-
;;
122127
-restore|-r)
123128
restore=true
124129
;;
@@ -176,6 +181,10 @@ while [[ $# > 0 ]]; do
176181
warn_as_error=$2
177182
shift
178183
;;
184+
-warnnotaserror)
185+
warn_not_as_error=$2
186+
shift
187+
;;
179188
-nodereuse)
180189
node_reuse=$2
181190
shift
@@ -204,8 +213,11 @@ if [[ -z "$configuration" ]]; then
204213
fi
205214

206215
if [[ "$ci" == true ]]; then
207-
pipelines_log=true
208-
node_reuse=false
216+
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
217+
# Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on.
218+
if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then
219+
node_reuse=false
220+
fi
209221
if [[ "$exclude_ci_binary_log" == false ]]; then
210222
binary_log=true
211223
fi
@@ -231,7 +243,17 @@ function Build {
231243

232244
local bl=""
233245
if [[ "$binary_log" == true ]]; then
234-
bl="/bl:\"$log_dir/Build.binlog\""
246+
local binary_log_path=""
247+
if [[ -z "$binary_log_name" ]]; then
248+
binary_log_path="$log_dir/Build.binlog"
249+
elif [[ "$binary_log_name" = /* ]]; then
250+
binary_log_path="$binary_log_name"
251+
else
252+
binary_log_path="$log_dir/$binary_log_name"
253+
fi
254+
255+
mkdir -p "$(dirname "$binary_log_path")"
256+
bl="/bl:\"$binary_log_path\""
235257
fi
236258

237259
local check=""

0 commit comments

Comments
 (0)