Skip to content
Open
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: 1 addition & 1 deletion eng/Version.Details.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props
<Project>
<PropertyGroup>
<!-- dotnet-arcade dependencies -->
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26211.1</MicrosoftDotNetArcadeSdkPackageVersion>
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.26225.1</MicrosoftDotNetArcadeSdkPackageVersion>
<!-- dotnet-msbuild dependencies -->
<MicrosoftBuildPackageVersion>18.6.1</MicrosoftBuildPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>18.6.1</MicrosoftBuildFrameworkPackageVersion>
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26211.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26225.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>a08169b890573cfd7f949ea9062c86a4db1aab1b</Sha>
<Sha>e822416a9237f26c9a62562fa6ce0f707da1dfe3</Sha>
</Dependency>
<Dependency Name="optimization.windows_nt-x64.MIBC.Runtime" Version="1.0.0-prerelease.26180.1">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
Expand Down
3 changes: 3 additions & 0 deletions eng/common/core-templates/job/onelocbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ parameters:
GitHubOrg: dotnet
MirrorRepo: ''
MirrorBranch: main
xLocCustomPowerShellScript: ''
condition: ''
JobNameSuffix: ''
is1ESPipeline: ''
Expand Down Expand Up @@ -97,6 +98,8 @@ jobs:
gitHubOrganization: ${{ parameters.GitHubOrg }}
mirrorRepo: ${{ parameters.MirrorRepo }}
mirrorBranch: ${{ parameters.MirrorBranch }}
${{ if ne(parameters.xLocCustomPowerShellScript, '') }}:
xLocCustomPowerShellScript: ${{ parameters.xLocCustomPowerShellScript }}
condition: ${{ parameters.condition }}

# Copy the locProject.json to the root of the Loc directory, then publish a pipeline artifact
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
arguments: -task SigningValidation -restore -msbuildEngine dotnet
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
/p:SignCheckExclusionsFile='$(System.DefaultWorkingDirectory)/eng/SignCheckExclusionsFile.txt'
${{ parameters.signingValidationAdditionalParameters }}
Expand Down
12 changes: 9 additions & 3 deletions eng/common/cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,19 @@ elseif(ILLUMOS)
locate_toolchain_exec(g++ CMAKE_CXX_COMPILER)
elseif(HAIKU)
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin")
set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}")
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp")

locate_toolchain_exec(gcc CMAKE_C_COMPILER)
locate_toolchain_exec(g++ CMAKE_CXX_COMPILER)
if ($ENV{CCC_CC} MATCHES ".*gcc.*")
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin")
locate_toolchain_exec(gcc CMAKE_C_COMPILER)
locate_toolchain_exec(g++ CMAKE_CXX_COMPILER)
else()
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64")
set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64")
endif()

# let CMake set up the correct search paths
include(Platform/Haiku)
Expand Down
2 changes: 1 addition & 1 deletion eng/common/sdk-task.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $warnAsError = if ($noWarnAsError) { $false } else { $true }

function Print-Usage() {
Write-Host "Common settings:"
Write-Host " -task <value> Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)"
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 " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"
Write-Host " -help Print help and exit"
Expand Down
2 changes: 1 addition & 1 deletion eng/common/sdk-task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

show_usage() {
echo "Common settings:"
echo " --task <value> Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)"
echo " --task <value> Name of Arcade task (name of a project in toolset directory of the Arcade SDK package)"
echo " --restore Restore dependencies"
echo " --verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"
echo " --help Print help and exit"
Expand Down
130 changes: 113 additions & 17 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ 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,6 +236,9 @@ 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 @@ -480,7 +489,6 @@ function LocateVisualStudio([object]$vsRequirements = $null){
if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') {
$vswhereVersion = $GlobalJson.tools.vswhere
} else {
# keep this in sync with the VSWhereVersion in DefaultVersions.props
$vswhereVersion = '3.1.7'
}

Expand Down Expand Up @@ -615,7 +623,17 @@ function GetNuGetPackageCachePath() {

# Returns a full path to an Arcade SDK task project file.
function GetSdkTaskProject([string]$taskName) {
return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj"
$toolsetDir = Split-Path (InitializeToolset) -Parent
$proj = Join-Path $toolsetDir "$taskName.proj"
if (Test-Path $proj) {
return $proj
}
# TODO: Remove this fallback once all supported versions use the new layout.
$legacyProj = Join-Path $toolsetDir "SdkTasks\$taskName.proj"
if (Test-Path $legacyProj) {
return $legacyProj
}
throw "Unable to find $taskName.proj in toolset at: $toolsetDir"
}

function InitializeNativeTools() {
Expand Down Expand Up @@ -652,35 +670,69 @@ function InitializeToolset() {
$nugetCache = GetNuGetPackageCachePath

$toolsetVersion = Read-ArcadeSdkVersion
$toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"
$toolsetToolsDir = Join-Path $ToolsetDir $toolsetVersion

if (Test-Path $toolsetLocationFile) {
$path = Get-Content $toolsetLocationFile -TotalCount 1
if (Test-Path $path) {
return $global:_InitializeToolset = $path
}
# Check if the toolset has already been extracted
$toolsetBuildProj = $null
$buildProjPath = Join-Path $toolsetToolsDir 'Build.proj'

if (Test-Path $buildProjPath) {
$toolsetBuildProj = $buildProjPath
}

if ($toolsetBuildProj -ne $null) {
return $global:_InitializeToolset = $toolsetBuildProj
}

if (-not $restore) {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Toolset version $toolsetVersion has not been restored."
ExitWithExitCode 1
}

$buildTool = InitializeBuildTool
$downloadArgs = @("package", "download", "Microsoft.DotNet.Arcade.Sdk@$toolsetVersion", "--verbosity", "minimal", "--prerelease", "--output", "$nugetCache")
$nugetConfig = $env:NUGET_CONFIG
if (-not $nugetConfig) {
# Search for any variation of nuget.config in the RepoRoot
$configFile = Get-ChildItem -Path $RepoRoot -File | Where-Object { $_.Name -ieq "nuget.config" } | Select-Object -First 1

$proj = Join-Path $ToolsetDir 'restore.proj'
$bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' }
if ($configFile) {
$nugetConfig = $configFile.FullName
}
}

'<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' | Set-Content $proj
if ($nugetConfig) {
$downloadArgs += "--configfile"
$downloadArgs += $nugetConfig
}
DotNet @downloadArgs

MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
$packageDir = Join-Path $nugetCache (Join-Path 'microsoft.dotnet.arcade.sdk' $toolsetVersion)
$packageToolsetDir = Join-Path $packageDir 'toolset'
$packageToolsDir = Join-Path $packageDir 'tools'

$path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1
if (!(Test-Path $path)) {
throw "Invalid toolset path: $path"
# TODO: Remove the tools/ check once all supported versions have the toolset folder.
if (!(Test-Path $packageToolsetDir) -and !(Test-Path $packageToolsDir)) {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Arcade SDK package does not contain a toolset or tools folder: $packageDir"
ExitWithExitCode 3
}

return $global:_InitializeToolset = $path
New-Item -ItemType Directory -Path $toolsetToolsDir -Force | Out-Null

# Copy toolset if present at the package root (new layout), otherwise fall back to tools
if (Test-Path $packageToolsetDir) {
Copy-Item -Path "$packageToolsetDir\*" -Destination $toolsetToolsDir -Recurse -Force
} else {
# TODO: Remove this fallback once all supported versions have the toolset folder.
Copy-Item -Path "$packageToolsDir\*" -Destination $toolsetToolsDir -Recurse -Force
}

if (Test-Path $buildProjPath) {
$toolsetBuildProj = $buildProjPath
} else {
throw "Unable to find Build.proj in toolset at: $toolsetToolsDir"
}

return $global:_InitializeToolset = $toolsetBuildProj
}

function ExitWithExitCode([int] $exitCode) {
Expand Down Expand Up @@ -741,6 +793,40 @@ function MSBuild() {
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.
Expand All @@ -765,6 +851,10 @@ function MSBuild-Core() {

$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 @@ -875,6 +965,12 @@ Create-Directory $ToolsetDir
Create-Directory $TempDir
Create-Directory $LogDir

# Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location
# under artifacts/log so they are captured as build artifacts in CI.
if (-not $env:MSBUILDDEBUGPATH) {
$env:MSBUILDDEBUGPATH = Join-Path $LogDir 'MsbuildDebugLogs'
}

Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir
Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir
Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir
Expand Down
Loading
Loading