Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Documentation/DependencyFlowOnboardingWithoutArcade.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ If you only have one Azure DevOps job that publishes assets, then you can add th
scriptLocation: scriptPath
scriptPath: $(System.DefaultWorkingDirectory)/eng/common/sdk-task.ps1
arguments: -task PublishBuildAssets
-restore
-msbuildEngine dotnet
/p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests'
/p:MaestroApiEndpoint=https://maestro.dot.net"
Comment on lines 82 to 84
```
Expand Down
33 changes: 13 additions & 20 deletions eng/common/build.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string][Alias('c')]$configuration = "Debug",
[string]$platform = $null,
[string][Alias('c')]$configuration,
[string]$platform,
[string] $projects,
[string][Alias('v')]$verbosity = "minimal",
[string] $msbuildEngine = $null,
[bool] $warnAsError = $true,
[string] $warnNotAsError = '',
[bool] $nodeReuse = $true,
[string][Alias('v')]$verbosity,
[string] $msbuildEngine,
[bool] $warnAsError,
[string] $warnNotAsError,
[bool] $nodeReuse,
[switch] $buildCheck = $false,
[switch][Alias('r')]$restore,
[switch] $deployDeps,
Expand All @@ -28,8 +28,8 @@ Param(
[switch][Alias('nobl')]$excludeCIBinarylog,
[switch] $ci,
[switch] $prepareMachine,
[string] $runtimeSourceFeed = '',
[string] $runtimeSourceFeedKey = '',
[string] $runtimeSourceFeed,
[string] $runtimeSourceFeedKey,
[switch] $excludePrereleaseVS,
[switch] $nativeToolsOnMachine,
[switch] $help,
Expand Down Expand Up @@ -86,6 +86,10 @@ function Print-Usage() {
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
}

# Opt in to letting tools.ps1 own the CI/environment-aware defaults for the parameters it
# manages (e.g. binaryLog, nodeReuse, configuration); see tools.ps1 for details.
$importerBoundParameters = $PSBoundParameters

. $PSScriptRoot\tools.ps1

function InitializeCustomToolset {
Expand Down Expand Up @@ -169,17 +173,6 @@ try {
exit 0
}

if ($ci) {
if (-not $excludeCIBinarylog) {
$binaryLog = $true
}
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# 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.
if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") {
$nodeReuse = $false
}
}

if (-not [string]::IsNullOrEmpty($binaryLogName)) {
$binaryLog = $true
}
Expand Down
27 changes: 0 additions & 27 deletions eng/common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ restore=false
build=false
source_build=false
product_build=false
from_vmr=false
rebuild=false
test=false
integration_test=false
Expand All @@ -76,23 +75,12 @@ pack=false
publish=false
sign=false
public=false
ci=false
clean=false

warn_as_error=true
warn_not_as_error=''
node_reuse=true
build_check=false
binary_log=false
binary_log_name=''
exclude_ci_binary_log=false

projects=''
configuration=''
prepare_machine=false
verbosity='minimal'
runtime_source_feed=''
runtime_source_feed_key=''

properties=()
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -208,21 +196,6 @@ while [[ $# -gt 0 ]]; do
shift
done

if [[ -z "$configuration" ]]; then
if [[ "$source_build" = true ]]; then configuration="Release"; else configuration="Debug"; fi
fi

if [[ "$ci" == true ]]; then
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# 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.
if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then
node_reuse=false
fi
if [[ "$exclude_ci_binary_log" == false ]]; then
binary_log=true
fi
fi

. "$scriptroot/tools.sh"

function InitializeCustomToolset {
Expand Down
2 changes: 1 addition & 1 deletion eng/common/core-templates/job/publish-build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
scriptType: ps
scriptLocation: scriptPath
scriptPath: $(System.DefaultWorkingDirectory)/eng/common/sdk-task.ps1
arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet
arguments: -task PublishBuildAssets -msbuildEngine dotnet
/p:ManifestsPath='$(Build.StagingDirectory)/AssetManifests'
/p:IsAssetlessBuild=${{ parameters.isAssetlessBuild }}
/p:MaestroApiEndpoint=https://maestro.dot.net
Expand Down
2 changes: 1 addition & 1 deletion eng/common/core-templates/post-build/post-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ stages:
displayName: Validate
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -task SigningValidation -restore -msbuildEngine dotnet
arguments: -task SigningValidation -msbuildEngine dotnet
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
/p:SignCheckExclusionsFile='$(System.DefaultWorkingDirectory)/eng/SignCheckExclusionsFile.txt'
${{ parameters.signingValidationAdditionalParameters }}
Expand Down
6 changes: 5 additions & 1 deletion eng/common/darc-init.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
param (
$darcVersion = $null,
$versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20',
$verbosity = 'minimal',
$verbosity,
$toolpath = $null
)

# Opt in to letting tools.ps1 own the CI/environment-aware defaults for the parameters it
# manages (e.g. verbosity); see tools.ps1 for details.
$importerBoundParameters = $PSBoundParameters

. $PSScriptRoot\tools.ps1

function InstallDarcCli ($darcVersion, $toolpath) {
Expand Down
1 change: 0 additions & 1 deletion eng/common/darc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
source="${BASH_SOURCE[0]}"
darcVersion=''
versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20'
verbosity='minimal'

while [[ $# -gt 0 ]]; do
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
Expand Down
10 changes: 7 additions & 3 deletions eng/common/dotnet-install.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string] $verbosity = 'minimal',
[string] $verbosity,
[string] $architecture = '',
[string] $version = 'Latest',
[string] $runtime = 'dotnet',
[string] $RuntimeSourceFeed = '',
[string] $RuntimeSourceFeedKey = ''
[string] $RuntimeSourceFeed,
[string] $RuntimeSourceFeedKey
)

# Opt in to letting tools.ps1 own the CI/environment-aware defaults for the parameters it
# manages (e.g. verbosity, runtimeSourceFeed); see tools.ps1 for details.
$importerBoundParameters = $PSBoundParameters

. $PSScriptRoot\tools.ps1

if (-not [string]::IsNullOrEmpty($env:DOTNET_GLOBAL_INSTALL_DIR)) {
Expand Down
20 changes: 8 additions & 12 deletions eng/common/msbuild.ps1
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string] $verbosity = 'minimal',
[bool] $warnAsError = $true,
[bool] $nodeReuse = $true,
[string] $verbosity,
[bool] $warnAsError,
[bool] $nodeReuse,
[switch] $ci,
[switch] $prepareMachine,
[switch] $excludePrereleaseVS,
[string] $msbuildEngine = $null,
[string] $msbuildEngine,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs
)

# Opt in to letting tools.ps1 own the CI/environment-aware defaults for the parameters it
# manages (e.g. nodeReuse, warnAsError, verbosity); see tools.ps1 for details.
$importerBoundParameters = $PSBoundParameters

. $PSScriptRoot\tools.ps1

try {
if ($ci) {
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# 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.
if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") {
$nodeReuse = $false
}
}

MSBuild @extraArgs
}
catch {
Expand Down
12 changes: 0 additions & 12 deletions eng/common/msbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ while [[ -h "$source" ]]; do
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

verbosity='minimal'
warn_as_error=true
node_reuse=true
prepare_machine=false
extra_args=''

while (($# > 0)); do
Expand Down Expand Up @@ -50,13 +46,5 @@ done

. "$scriptroot/tools.sh"

if [[ "$ci" == true ]]; then
# Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED.
# 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.
if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then
node_reuse=false
fi
fi

MSBuild $extra_args
ExitWithExitCode 0
53 changes: 26 additions & 27 deletions eng/common/sdk-task.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[string] $configuration = 'Debug',
[string] $configuration,
[string] $task,
[string] $verbosity = 'minimal',
[string] $msbuildEngine = $null,
[switch] $restore,
[string] $verbosity,
[string] $msbuildEngine,
[switch] $noRestore,
[switch] $prepareMachine,
[switch][Alias('nobl')]$excludeCIBinaryLog,
[switch]$noWarnAsError,
Comment thread
ViktorHofer marked this conversation as resolved.
[switch] $help,
[string] $runtimeSourceFeed = '',
[string] $runtimeSourceFeedKey = '',
[string] $runtimeSourceFeed,
[string] $runtimeSourceFeedKey,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)

$ci = $true
$binaryLog = if ($excludeCIBinaryLog) { $false } else { $true }
$warnAsError = if ($noWarnAsError) { $false } else { $true }
$restore = -not $noRestore

# Opt in to letting tools.ps1 own the CI/environment-aware defaults for the parameters it
# manages (e.g. configuration, verbosity). The $binaryLog/$warnAsError values set above by
# assignment are preserved, because only declared-but-unpassed parameters are unbound.
$importerBoundParameters = $PSBoundParameters

. $PSScriptRoot\tools.ps1

function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -task <value> Name of Arcade task (name of a project in toolset directory of the Arcade SDK package)"
Write-Host " -restore Restore dependencies"
Write-Host " -noRestore Skip restoring dependencies"
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"
Write-Host " -help Print help and exit"
Write-Host ""
Expand All @@ -36,22 +42,6 @@ function Print-Usage() {
Write-Host "Command line arguments not listed above are passed thru to msbuild."
}

function Build([string]$target) {
$logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" }
$log = Join-Path $LogDir "$task$logSuffix.binlog"
$binaryLogArg = if ($binaryLog) { "/bl:$log" } else { "" }
$outputPath = Join-Path $ToolsetDir "$task\"

MSBuild $taskProject `
$binaryLogArg `
/t:$target `
/p:Configuration=$configuration `
/p:RepoRoot=$RepoRoot `
/p:BaseIntermediateOutputPath=$outputPath `
/v:$verbosity `
@properties
}

try {
if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
Print-Usage
Expand All @@ -75,11 +65,20 @@ try {
ExitWithExitCode 1
}

if ($restore) {
Build 'Restore'
}
$log = Join-Path $LogDir "$task.binlog"
$binaryLogArg = if ($binaryLog) { "/bl:$log" } else { "" }
$restoreArg = if ($restore) { "/restore" } else { "" }
$outputPath = Join-Path $ToolsetDir "$task\"

Build 'Execute'
MSBuild $taskProject `
$binaryLogArg `
$restoreArg `
/t:Execute `
/p:Configuration=$configuration `
/p:RepoRoot=$RepoRoot `
/p:BaseIntermediateOutputPath=$outputPath `
/v:$verbosity `
@properties
}
catch {
Write-Host $_.ScriptStackTrace
Expand Down
Loading
Loading