Skip to content
Merged
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
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26279.5">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26307.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2bc908b1bdb34e2c42982eb511679bb458ddac2c</Sha>
<Sha>76ee16fe3a80a4bf55c7d31dbdef2804e555cce0</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/common/core-templates/job/helix-job-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
toolArgs=(
--helix-base-uri '${{ parameters.helixBaseUri }}'
--polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}'
--max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 2))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully.
--max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully.
--stage-name '$(System.StageName)'
)
Expand Down
6 changes: 6 additions & 0 deletions eng/common/core-templates/job/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ jobs:
variables:
- name: AllowPtrToDetectTestRunRetryFiles
value: true
# Component Governance detection and CodeQL are not run in the public project
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: skipComponentGovernanceDetection
value: true
- name: Codeql.SkipTaskAutoInjection
value: true
- ${{ if ne(parameters.enableTelemetry, 'false') }}:
- name: DOTNET_CLI_TELEMETRY_PROFILE
value: '$(Build.Repository.Uri)'
Expand Down
24 changes: 24 additions & 0 deletions eng/common/core-templates/steps/enable-internal-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,56 @@ steps:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.legacyCredential, '') }}:
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token
env:
Token: ${{ parameters.legacyCredential }}
- task: Bash@3
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
targetType: inline
script: |
"$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token"
env:
Token: ${{ parameters.legacyCredential }}
# If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate.
# If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that
# may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token.
- ${{ else }}:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config
- task: Bash@3
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh
arguments: $(System.DefaultWorkingDirectory)/NuGet.config
- ${{ else }}:
- template: /eng/common/templates/steps/get-federated-access-token.yml
parameters:
federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }}
outputVariableName: 'dnceng-artifacts-feeds-read-access-token'
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token)
- task: Bash@3
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
displayName: Setup Internal Feeds
inputs:
filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh
arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token)
# This is required in certain scenarios to install the ADO credential provider.
# It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others
# (e.g. dotnet msbuild).
Expand Down
2 changes: 1 addition & 1 deletion eng/common/cross/build-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ elif [[ "$__CodeName" == "openbsd" ]]; then

echo "Creating versionless symlinks for shared libraries..."
# Find all versioned .so files and create the base .so symlink
for lib in "$__RootfsDir/usr/lib/libc++.so."* "$__RootfsDir/usr/lib/libc++abi.so."* "$__RootfsDir/usr/lib/libpthread.so."*; do
for lib in "$__RootfsDir"/usr/lib/lib*.so.*; do
if [ -f "$lib" ]; then
# Extract the filename (e.g., libc++.so.12.0)
VERSIONED_NAME=$(basename "$lib")
Expand Down
27 changes: 27 additions & 0 deletions eng/common/native/LocateNativeCompiler.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>
<!--
Opt-in target to detect compiler/linker from init-compiler.sh and set NativeAOT linker props.
Callers enable this by setting UseCommonLocateNativeCompilerTarget=true.
-->
<Target Name="LocateNativeCompiler"
Condition="'$(UseCommonLocateNativeCompilerTarget)' == 'true'"
BeforeTargets="SetupOSSpecificProps">
<PropertyGroup>
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
<SysRoot Condition="'$(CrossBuild)' == 'true'">$(ROOTFS_DIR)</SysRoot>
</PropertyGroup>

<Exec Command="sh -c 'build_arch=&quot;$(TargetArchitecture)&quot; compiler=&quot;$(CppCompilerAndLinker)&quot; . &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &amp;&amp; echo &quot;$CC;$LDFLAGS&quot;' 2>/dev/null"
EchoOff="true"
ConsoleToMsBuild="true"
StandardOutputImportance="Low">
<Output TaskParameter="ConsoleOutput" PropertyName="_CC_LDFLAGS" />
</Exec>

<PropertyGroup>
<CppLinker>$(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';'))))</CppLinker>
<_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1))))</_LDFLAGS>
<LinkerFlavor Condition="$(_LDFLAGS.Contains('lld'))">lld</LinkerFlavor>
</PropertyGroup>
</Target>
</Project>
8 changes: 4 additions & 4 deletions eng/common/native/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ case "$os" in
apt update

apt install -y build-essential gettext locales cmake llvm clang lld lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \
libssl-dev libkrb5-dev pigz cpio ninja-build
libssl-dev libkrb5-dev pigz cpio ninja-build file

localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ] || [ "$ID" = "centos" ]; then
pkg_mgr="$(command -v tdnf 2>/dev/null || command -v dnf)"
$pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build
$pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build file
elif [ "$ID" = "amzn" ]; then
dnf install -y cmake llvm lld lldb clang python libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build
dnf install -y cmake llvm lld lldb clang python libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build file
elif [ "$ID" = "alpine" ]; then
apk add build-base cmake bash curl clang llvm llvm-dev lld lldb-dev krb5-dev lttng-ust-dev icu-dev openssl-dev pigz cpio ninja
apk add build-base cmake bash curl clang llvm llvm-dev lld lldb-dev krb5-dev lttng-ust-dev icu-dev openssl-dev pigz cpio ninja file
else
echo "Unsupported distro. distro: $ID"
exit 1
Expand Down
5 changes: 0 additions & 5 deletions eng/common/templates/job/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ jobs:
- ${{ each step in parameters.steps }}:
- ${{ step }}

# we don't run CG in public
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true"
displayName: Set skipComponentGovernanceDetection variable

artifactPublishSteps:
- ${{ if ne(parameters.artifacts.publish, '') }}:
- ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}:
Expand Down
2 changes: 1 addition & 1 deletion eng/common/templates/vmr-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resources:
- repository: vmr
type: github
name: dotnet/dotnet
endpoint: dotnet
endpoint: public
ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into

stages:
Expand Down
135 changes: 42 additions & 93 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
}

# Keep repo builds isolated from machine-installed SDK state and workload advertising.
# This avoids preview SDK builds picking up mismatched workloads on CI images.
$env:DOTNET_MULTILEVEL_LOOKUP = '0'
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE = '1'

# Find the first path on %PATH% that contains the dotnet.exe
if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) {
$dotnetExecutable = GetExecutableFileName 'dotnet'
Expand Down Expand Up @@ -230,9 +224,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
Write-PipelinePrependPath -Path $dotnetRoot

Write-PipelineSetVariable -Name 'DOTNET_NOLOGO' -Value '1'
Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0'
Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1'
Write-PipelineSetVariable -Name 'DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE' -Value '1'

return $global:_DotNetInstallDir = $dotnetRoot
}
Expand Down Expand Up @@ -599,16 +590,16 @@ function GetDefaultMSBuildEngine() {
ExitWithExitCode 1
}

function GetNuGetPackageCachePath() {
function InitializeNuGetPackageCachePath() {
if ($env:NUGET_PACKAGES -eq $null) {
# Use local cache on CI to ensure deterministic build.
# Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116
# use global cache in dev builds to avoid cost of downloading packages.
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
if ($useGlobalNuGetCache) {
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
$userProfile = if (IsWindowsPlatform) { $env:UserProfile } else { $env:HOME }
$env:NUGET_PACKAGES = [IO.Path]::Combine($userProfile, '.nuget', 'packages') + [IO.Path]::DirectorySeparatorChar
} else {
$env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
$env:NUGET_PACKAGES = [IO.Path]::Combine($RepoRoot, '.packages') + [IO.Path]::DirectorySeparatorChar
}
}

Expand Down Expand Up @@ -657,8 +648,6 @@ function InitializeToolset() {
return $global:_InitializeToolset
}

$nugetCache = GetNuGetPackageCachePath

$toolsetVersion = Read-ArcadeSdkVersion
$toolsetToolsDir = Join-Path $ToolsetDir $toolsetVersion

Expand All @@ -679,7 +668,7 @@ function InitializeToolset() {
ExitWithExitCode 1
}

$downloadArgs = @("package", "download", "Microsoft.DotNet.Arcade.Sdk@$toolsetVersion", "--verbosity", "minimal", "--prerelease", "--output", "$nugetCache")
$downloadArgs = @("package", "download", "Microsoft.DotNet.Arcade.Sdk@$toolsetVersion", "--verbosity", "minimal", "--prerelease", "--output", "$nugetPackageCachePath")
$nugetConfig = $env:NUGET_CONFIG
if (-not $nugetConfig) {
# Search for any variation of nuget.config in the RepoRoot
Expand All @@ -696,7 +685,7 @@ function InitializeToolset() {
}
DotNet @downloadArgs

$packageDir = Join-Path $nugetCache (Join-Path 'microsoft.dotnet.arcade.sdk' $toolsetVersion)
$packageDir = Join-Path $nugetPackageCachePath (Join-Path 'microsoft.dotnet.arcade.sdk' $toolsetVersion)
$packageToolsetDir = Join-Path $packageDir 'toolset'

if (!(Test-Path $packageToolsetDir)) {
Expand Down Expand Up @@ -747,60 +736,6 @@ function Stop-Processes() {
# Terminates the script if the build fails.
#
function MSBuild() {
if ($ci) {
InitializeToolset | Out-Null

$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20
$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20
Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20'
Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20'

Enable-Nuget-EnhancedRetry
}

MSBuild-Core @args
}

#
# Executes a dotnet command with arguments passed to the function.
# Terminates the script if the command fails.
#
function DotNet() {
$dotnetRoot = InitializeDotNetCli -install:$restore
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')

$cmdArgs = ""
foreach ($arg in $args) {
if ($null -ne $arg -and $arg.Trim() -ne "") {
if ($arg.EndsWith('\')) {
$arg = $arg + "\"
}
$cmdArgs += " `"$arg`""
}
}

$env:ARCADE_BUILD_TOOL_COMMAND = "`"$dotnetPath`" $cmdArgs"

$exitCode = Exec-Process $dotnetPath $cmdArgs

if ($exitCode -ne 0) {
Write-Host "dotnet command failed with exit code $exitCode. Check errors above." -ForegroundColor Red

if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) {
Write-PipelineSetResult -Result "Failed" -Message "dotnet command execution failed."
ExitWithExitCode 0
} else {
ExitWithExitCode $exitCode
}
}
}

#
# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function.
# The arguments are automatically quoted.
# Terminates the script if the build fails.
#
function MSBuild-Core() {
if ($ci) {
if (!$binaryLog -and !$excludeCIBinarylog) {
Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.'
Expand All @@ -813,16 +748,10 @@ function MSBuild-Core() {
}
}

Enable-Nuget-EnhancedRetry

$buildTool = InitializeBuildTool

$cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci"

if ($ci -and $buildTool.Tool -eq 'dotnet') {
$cmdArgs += ' /p:MSBuildEnableWorkloadResolver=false'
}

# Add -mt flag for MSBuild multithreaded mode if enabled via environment variable
if ($env:MSBUILD_MT_ENABLED -eq "1") {
$cmdArgs += ' -mt'
Expand Down Expand Up @@ -876,6 +805,40 @@ function MSBuild-Core() {
}
}

#
# Executes a dotnet command with arguments passed to the function.
# Terminates the script if the command fails.
#
function DotNet() {
$dotnetRoot = InitializeDotNetCli -install:$restore
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')

$cmdArgs = ""
foreach ($arg in $args) {
if ($null -ne $arg -and $arg.Trim() -ne "") {
if ($arg.EndsWith('\')) {
$arg = $arg + "\"
}
$cmdArgs += " `"$arg`""
}
}

$env:ARCADE_BUILD_TOOL_COMMAND = "`"$dotnetPath`" $cmdArgs"

$exitCode = Exec-Process $dotnetPath $cmdArgs

if ($exitCode -ne 0) {
Write-Host "dotnet command failed with exit code $exitCode. Check errors above." -ForegroundColor Red

if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) {
Write-PipelineSetResult -Result "Failed" -Message "dotnet command execution failed."
ExitWithExitCode 0
} else {
ExitWithExitCode $exitCode
}
}
}

function GetMSBuildBinaryLogCommandLineArgument($arguments) {
foreach ($argument in $arguments) {
if ($argument -ne $null) {
Expand Down Expand Up @@ -960,19 +923,5 @@ if (!$disableConfigureToolsetImport) {
}
}

#
# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic.
#
function Enable-Nuget-EnhancedRetry() {
if ($ci) {
Write-Host "Setting NUGET enhanced retry environment variables"
$env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true'
$env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6
$env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000
$env:NUGET_RETRY_HTTP_429 = 'true'
Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true'
Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6'
Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000'
Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true'
}
}
# Initialize the nuget package cache vars
$nugetPackageCachePath = InitializeNuGetPackageCachePath
Loading