Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2019-05-17 03:03:15 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-05-17 03:03:15 +0300
commit871e6f58465c973e2e128369875e9d1a55869786 (patch)
treec4c38794d52f43fe033617e6d5cb5db9c2199195 /eng/common
parent6d404e4ede503816a227a558efef592b718b76fd (diff)
Manual DARC update from build '20190516.4'
Diffstat (limited to 'eng/common')
-rw-r--r--eng/common/PublishToPackageFeed.proj2
-rw-r--r--eng/common/build.ps14
-rwxr-xr-xeng/common/build.sh22
-rw-r--r--eng/common/cross/build-rootfs.sh67
-rw-r--r--eng/common/darc-init.ps111
-rwxr-xr-xeng/common/darc-init.sh15
-rw-r--r--eng/common/init-tools-native.ps16
-rw-r--r--eng/common/init-tools-native.sh12
-rw-r--r--eng/common/templates/job/job.yml3
-rw-r--r--eng/common/tools.ps164
-rw-r--r--eng/common/tools.sh51
11 files changed, 186 insertions, 71 deletions
diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj
index 6d8b6b42fb2..9120b2d2129 100644
--- a/eng/common/PublishToPackageFeed.proj
+++ b/eng/common/PublishToPackageFeed.proj
@@ -48,12 +48,12 @@
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'ENTITYFRAMEWORKCORE'">https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'ASPNETEXTENSIONS'">https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'CORECLR'">https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json</TargetStaticFeed>
- <TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'MONO'">https://dotnetfeed.blob.core.windows.net/mono-mono/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'CORESDK'">https://dotnetfeed.blob.core.windows.net/dotnet-sdk/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'TOOLSINTERNAL'">https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'TOOLSET'">https://dotnetfeed.blob.core.windows.net/dotnet-toolset/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'WINDOWSDESKTOP'">https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json</TargetStaticFeed>
<TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'NUGETCLIENT'">https://dotnetfeed.blob.core.windows.net/nuget-nugetclient/index.json</TargetStaticFeed>
+ <TargetStaticFeed Condition="'$(ArtifactsCategory.ToUpper())' == 'ASPNETENTITYFRAMEWORK6'">https://dotnetfeed.blob.core.windows.net/aspnet-entityframework6/index.json</TargetStaticFeed>
</PropertyGroup>
<Error
diff --git a/eng/common/build.ps1 b/eng/common/build.ps1
index d0147db4bd5..d7e3799ebd9 100644
--- a/eng/common/build.ps1
+++ b/eng/common/build.ps1
@@ -122,6 +122,10 @@ try {
. $configureToolsetScript
}
+ if (($restore) -and ($null -eq $env:DisableNativeToolsetInstalls)) {
+ InitializeNativeTools
+ }
+
Build
}
catch {
diff --git a/eng/common/build.sh b/eng/common/build.sh
index 40b1e8ec73e..ce846d888df 100755
--- a/eng/common/build.sh
+++ b/eng/common/build.sh
@@ -35,7 +35,7 @@ usage()
echo " --nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
echo " --warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
echo ""
- echo "Command line arguments starting with '/p:' are passed through to MSBuild."
+ echo "Command line arguments not listed above are passed thru to msbuild."
echo "Arguments can also be passed in with a single hyphen."
}
@@ -137,22 +137,8 @@ while [[ $# > 0 ]]; do
node_reuse=$2
shift
;;
- -p:*|/p:*)
- properties="$properties $1"
- ;;
- -m:*|/m:*)
- properties="$properties $1"
- ;;
- -bl:*|/bl:*)
- properties="$properties $1"
- ;;
- -dl:*|/dl:*)
- properties="$properties $1"
- ;;
*)
- echo "Invalid argument: $1"
- usage
- exit 1
+ properties="$properties $1"
;;
esac
@@ -218,4 +204,8 @@ if [[ -n "${useInstalledDotNetCli:-}" ]]; then
use_installed_dotnet_cli="$useInstalledDotNetCli"
fi
+if [[ "$restore" == true && -z ${DisableNativeToolsetInstalls:-} ]]; then
+ InitializeNativeTools
+fi
+
Build
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 805948ca83c..34d3d2ba1fe 100644
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -2,21 +2,21 @@
usage()
{
- echo "Usage: $0 [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount]"
+ echo "Usage: $0 [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount] --rootfsdir <directory>]"
echo "BuildArch can be: arm(default), armel, arm64, x86"
- echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial, zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
- echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8, lldb3.9, lldb4.0, no-lldb. Ignored for alpine"
+ echo "LinuxCodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
+ echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine"
echo "--skipunmount - optional, will skip the unmount of rootfs folder."
exit 1
}
-__LinuxCodeName=trusty
+__LinuxCodeName=xenial
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
__InitialDir=$PWD
__BuildArch=arm
__UbuntuArch=armhf
__UbuntuRepo="http://ports.ubuntu.com/"
-__LLDB_Package="lldb-3.6-dev"
+__LLDB_Package="liblldb-3.9-dev"
__SkipUnmount=0
# base development support
@@ -53,8 +53,12 @@ __AlpinePackages+=" openssl-dev"
__AlpinePackages+=" zlib-dev"
__UnprocessedBuildArgs=
-for i in "$@" ; do
- lowerI="$(echo $i | awk '{print tolower($0)}')"
+while :; do
+ if [ $# -le 0 ]; then
+ break
+ fi
+
+ lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-?|-h|--help)
usage
@@ -95,38 +99,49 @@ for i in "$@" ; do
lldb4.0)
__LLDB_Package="liblldb-4.0-dev"
;;
+ lldb5.0)
+ __LLDB_Package="liblldb-5.0-dev"
+ ;;
+ lldb6.0)
+ __LLDB_Package="liblldb-6.0-dev"
+ ;;
no-lldb)
unset __LLDB_Package
;;
- vivid)
+ trusty) # Ubuntu 14.04
if [ "$__LinuxCodeName" != "jessie" ]; then
- __LinuxCodeName=vivid
+ __LinuxCodeName=trusty
fi
;;
- wily)
- if [ "$__LinuxCodeName" != "jessie" ]; then
- __LinuxCodeName=wily
- fi
- ;;
- xenial)
+ xenial) # Ubuntu 16.04
if [ "$__LinuxCodeName" != "jessie" ]; then
__LinuxCodeName=xenial
fi
;;
- zesty)
+ zesty) # Ubuntu 17.04
if [ "$__LinuxCodeName" != "jessie" ]; then
__LinuxCodeName=zesty
fi
;;
- bionic)
+ bionic) # Ubuntu 18.04
if [ "$__LinuxCodeName" != "jessie" ]; then
__LinuxCodeName=bionic
fi
;;
- jessie)
+ jessie) # Debian 8
__LinuxCodeName=jessie
__UbuntuRepo="http://ftp.debian.org/debian/"
;;
+ stretch) # Debian 9
+ __LinuxCodeName=stretch
+ __UbuntuRepo="http://ftp.debian.org/debian/"
+ __LLDB_Package="liblldb-6.0-dev"
+ ;;
+ buster) # Debian 10
+ __LinuxCodeName=buster
+ __UbuntuRepo="http://ftp.debian.org/debian/"
+ __LLDB_Package="liblldb-6.0-dev"
+ ;;
tizen)
if [ "$__BuildArch" != "armel" ]; then
echo "Tizen is available only for armel."
@@ -144,10 +159,16 @@ for i in "$@" ; do
--skipunmount)
__SkipUnmount=1
;;
+ --rootfsdir|-rootfsdir)
+ shift
+ __RootfsDir=$1
+ ;;
*)
- __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
+ __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
;;
esac
+
+ shift
done
if [ "$__BuildArch" == "armel" ]; then
@@ -155,12 +176,14 @@ if [ "$__BuildArch" == "armel" ]; then
fi
__UbuntuPackages+=" ${__LLDB_Package:-}"
-__RootfsDir="$__CrossDir/rootfs/$__BuildArch"
-
-if [[ -n "$ROOTFS_DIR" ]]; then
+if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then
__RootfsDir=$ROOTFS_DIR
fi
+if [ -z "$__RootfsDir" ]; then
+ __RootfsDir="$__CrossDir/rootfs/$__BuildArch"
+fi
+
if [ -d "$__RootfsDir" ]; then
if [ $__SkipUnmount == 0 ]; then
umount $__RootfsDir/*
diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1
index 81ffd16779c..dea7cdd903b 100644
--- a/eng/common/darc-init.ps1
+++ b/eng/common/darc-init.ps1
@@ -1,5 +1,6 @@
param (
- $darcVersion = $null
+ $darcVersion = $null,
+ $versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16"
)
$verbosity = "m"
@@ -16,13 +17,13 @@ function InstallDarcCli ($darcVersion) {
Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g"
}
- # Until we can anonymously query the BAR API for the latest arcade-services
- # build applied to the PROD channel, this is hardcoded.
+ # If the user didn't explicitly specify the darc version,
+ # query the Maestro API for the correct version of darc to install.
if (-not $darcVersion) {
- $darcVersion = '1.1.0-beta.19205.4'
+ $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
}
- $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json'
+ $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json'
Write-Host "Installing Darc CLI version $darcVersion..."
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed."
diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh
index bd7eb463986..abdd0bc05a1 100755
--- a/eng/common/darc-init.sh
+++ b/eng/common/darc-init.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
source="${BASH_SOURCE[0]}"
-darcVersion="1.1.0-beta.19205.4"
+darcVersion=''
+versionEndpoint="https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16"
while [[ $# > 0 ]]; do
opt="$(echo "$1" | awk '{print tolower($0)}')"
@@ -10,6 +11,10 @@ while [[ $# > 0 ]]; do
darcVersion=$2
shift
;;
+ --versionendpoint)
+ versionEndpoint=$2
+ shift
+ ;;
*)
echo "Invalid argument: $1"
usage
@@ -33,6 +38,10 @@ verbosity=m
. "$scriptroot/tools.sh"
+if [ -z "$darcVersion" ]; then
+ darcVersion=$(curl -X GET "$versionEndpoint" -H "accept: text/plain")
+fi
+
function InstallDarcCli {
local darc_cli_package_name="microsoft.dotnet.darc"
@@ -45,9 +54,9 @@ function InstallDarcCli {
echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g)
fi
- local arcadeServicesSource="https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json"
+ local arcadeServicesSource="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json"
- echo "Installing Darc CLI version $toolset_version..."
+ echo "Installing Darc CLI version $darcVersion..."
echo "You may need to restart your command shell if this is the first dotnet tool you have installed."
echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g)
}
diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1
index 495a563a758..a4306bd37e1 100644
--- a/eng/common/init-tools-native.ps1
+++ b/eng/common/init-tools-native.ps1
@@ -41,9 +41,13 @@ Param (
[switch] $Force = $False,
[int] $DownloadRetries = 5,
[int] $RetryWaitTimeInSeconds = 30,
- [string] $GlobalJsonFile = "$PSScriptRoot\..\..\global.json"
+ [string] $GlobalJsonFile
)
+if (!$GlobalJsonFile) {
+ $GlobalJsonFile = Join-Path (Get-Item $PSScriptRoot).Parent.Parent.FullName "global.json"
+}
+
Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"
diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh
index 54b70f678ba..fc72d13948e 100644
--- a/eng/common/init-tools-native.sh
+++ b/eng/common/init-tools-native.sh
@@ -9,7 +9,7 @@ clean=false
force=false
download_retries=5
retry_wait_time_seconds=30
-global_json_file="${scriptroot}/../../global.json"
+global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json"
declare -A native_assets
. $scriptroot/native/common-library.sh
@@ -71,6 +71,7 @@ function ReadGlobalJsonNativeTools {
local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}')
native_tools_list=${native_tools_list//[\" ]/}
native_tools_list=${native_tools_list//,/$'\n'}
+ native_tools_list="$(echo -e "${native_tools_list}" | tr -d '[:space:]')"
local old_IFS=$IFS
while read -r line; do
@@ -116,8 +117,6 @@ else
installer_command+=" --clean"
fi
- echo "Installing $tool version $tool_version"
- echo "Executing '$installer_command'"
$installer_command
if [[ $? != 0 ]]; then
@@ -127,19 +126,16 @@ else
done
fi
-if [[ ! -z $clean ]]; then
+if [[ $clean = true ]]; then
exit 0
fi
if [[ -d $install_bin ]]; then
echo "Native tools are available from $install_bin"
- if [[ !-z BUILD_BUILDNUMBER ]]; then
- echo "##vso[task.prependpath]$install_bin"
- fi
+ echo "##vso[task.prependpath]$install_bin"
else
echo "Native tools install directory does not exist, installation failed" >&2
exit 1
fi
exit 0
-
diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml
index 7839b70bb70..1814e0ab612 100644
--- a/eng/common/templates/job/job.yml
+++ b/eng/common/templates/job/job.yml
@@ -90,6 +90,9 @@ jobs:
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
variables:
+ - ${{ if eq(parameters.enableTelemetry, 'true') }}:
+ - name: DOTNET_CLI_TELEMETRY_PROFILE
+ value: '$(Build.Repository.Uri)'
- ${{ each variable in parameters.variables }}:
# handle name-value variable syntax
# example:
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 5c4a129c863..9ca177b82a3 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -11,6 +11,12 @@
# Binary log must be enabled on CI.
[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci }
+# Set to true to use the pipelines logger which will enable Azure logging output.
+# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
+# This flag is meant as a temporary opt-opt for the feature while validate it across
+# our consumers. It will be deleted in the future.
+[bool]$pipelinesLog = if (Test-Path variable:pipelinesLog) { $pipelinesLog } else { $ci }
+
# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes).
[bool]$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false }
@@ -108,7 +114,7 @@ function InitializeDotNetCli([bool]$install) {
}
# Find the first path on %PATH% that contains the dotnet.exe
- if ($useInstalledDotNetCli -and ($env:DOTNET_INSTALL_DIR -eq $null)) {
+ if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) {
$dotnetCmd = Get-Command "dotnet.exe" -ErrorAction SilentlyContinue
if ($dotnetCmd -ne $null) {
$env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent
@@ -119,7 +125,7 @@ function InitializeDotNetCli([bool]$install) {
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
- if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) {
+ if ((-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) {
$dotnetRoot = $env:DOTNET_INSTALL_DIR
} else {
$dotnetRoot = Join-Path $RepoRoot ".dotnet"
@@ -152,7 +158,7 @@ function InitializeDotNetCli([bool]$install) {
}
function GetDotNetInstallScript([string] $dotnetRoot) {
- $installScript = "$dotnetRoot\dotnet-install.ps1"
+ $installScript = Join-Path $dotnetRoot "dotnet-install.ps1"
if (!(Test-Path $installScript)) {
Create-Directory $dotnetRoot
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript
@@ -162,9 +168,21 @@ function GetDotNetInstallScript([string] $dotnetRoot) {
}
function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = "") {
+ InstallDotNet $dotnetRoot $version $architecture
+}
+
+function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { $installScript = GetDotNetInstallScript $dotnetRoot
$installScript = GetDotNetInstallScript $dotnetRoot
- $archArg = if ($architecture) { $architecture } else { "<auto>" }
- & $installScript -Version $version -InstallDir $dotnetRoot -Architecture $archArg
+ $installParameters = @{
+ Version = $version
+ InstallDir = $dotnetRoot
+ }
+
+ if ($architecture) { $installParameters.Architecture = $architecture }
+ if ($runtime) { $installParameters.Runtime = $runtime }
+ if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles }
+
+ & $installScript @installParameters
if ($lastExitCode -ne 0) {
Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red
ExitWithExitCode $lastExitCode
@@ -340,7 +358,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
- $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild" }
+ $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild"; Tool = "dotnet"; Framework = "netcoreapp2.1" }
} elseif ($msbuildEngine -eq "vs") {
try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
@@ -349,7 +367,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
- $buildTool = @{ Path = $msbuildPath; Command = "" }
+ $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" }
} else {
Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red
ExitWithExitCode 1
@@ -391,6 +409,16 @@ function GetSdkTaskProject([string]$taskName) {
return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj"
}
+function InitializeNativeTools() {
+ if (Get-Member -InputObject $GlobalJson -Name "native-tools") {
+ $nativeArgs=""
+ if ($ci) {
+ $nativeArgs = "-InstallDirectory $ToolsDir"
+ }
+ Invoke-Expression "& `"$PSScriptRoot/init-tools-native.ps1`" $nativeArgs"
+ }
+}
+
function InitializeToolset() {
if (Test-Path variable:global:_ToolsetBuildProj) {
return $global:_ToolsetBuildProj
@@ -419,7 +447,8 @@ function InitializeToolset() {
$bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" }
'<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' | Set-Content $proj
- MSBuild $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
+
+ MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
$path = Get-Content $toolsetLocationFile -TotalCount 1
if (!(Test-Path $path)) {
@@ -449,6 +478,23 @@ function Stop-Processes() {
# Terminates the script if the build fails.
#
function MSBuild() {
+ if ($pipelinesLog) {
+ $buildTool = InitializeBuildTool
+ $toolsetBuildProject = InitializeToolset
+ $path = Split-Path -parent $toolsetBuildProject
+ $path = Join-Path $path (Join-Path $buildTool.Framework "Microsoft.DotNet.Arcade.Sdk.dll")
+ $args += "/logger:$path"
+ }
+
+ MSBuild-Core @args
+}
+
+#
+# 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) {
throw "Binary log must be enabled in CI build."
@@ -512,6 +558,8 @@ $ToolsDir = Join-Path $RepoRoot ".tools"
$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration
$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration
$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json
+# true if global.json contains a "runtimes" section
+$globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false }
Create-Directory $ToolsetDir
Create-Directory $TempDir
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index ecdece1f855..df3eb8bce07 100644
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -101,7 +101,7 @@ function InitializeDotNetCli {
fi
# Find the first path on $PATH that contains the dotnet.exe
- if [[ "$use_installed_dotnet_cli" == true && -z "${DOTNET_INSTALL_DIR:-}" ]]; then
+ if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then
local dotnet_path=`command -v dotnet`
if [[ -n "$dotnet_path" ]]; then
ResolvePath "$dotnet_path"
@@ -115,10 +115,11 @@ function InitializeDotNetCli {
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
- if [[ -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
+ if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
dotnet_root="$DOTNET_INSTALL_DIR"
else
dotnet_root="$repo_root/.dotnet"
+
export DOTNET_INSTALL_DIR="$dotnet_root"
if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
@@ -149,16 +150,34 @@ function InitializeDotNetCli {
function InstallDotNetSdk {
local root=$1
local version=$2
+ local architecture=""
+ if [[ $# == 3 ]]; then
+ architecture=$3
+ fi
+ InstallDotNet "$root" "$version" $architecture
+}
+function InstallDotNet {
+ local root=$1
+ local version=$2
+
GetDotNetInstallScript "$root"
local install_script=$_GetDotNetInstallScript
- local arch_arg=""
- if [[ $# == 3 ]]; then
- arch_arg="--architecture $3"
+ local archArg=''
+ if [[ -n "${3:-}" ]]; then
+ archArg="--architecture $3"
+ fi
+ local runtimeArg=''
+ if [[ -n "${4:-}" ]]; then
+ runtimeArg="--runtime $4"
fi
- bash "$install_script" --version $version --install-dir "$root" $arch_arg || {
+ local skipNonVersionedFilesArg=""
+ if [[ "$#" -ge "5" ]]; then
+ skipNonVersionedFilesArg="--skip-non-versioned-files"
+ fi
+ bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || {
local exit_code=$?
echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
@@ -212,6 +231,17 @@ function GetNuGetPackageCachePath {
_GetNuGetPackageCachePath=$NUGET_PACKAGES
}
+function InitializeNativeTools() {
+ if grep -Fq "native-tools" $global_json_file
+ then
+ local nativeArgs=""
+ if [[ "$ci" == true ]]; then
+ nativeArgs="-InstallDirectory $tools_dir"
+ fi
+ "$_script_dir/init-tools-native.sh" $nativeArgs
+ fi
+}
+
function InitializeToolset {
if [[ -n "${_InitializeToolset:-}" ]]; then
return
@@ -307,10 +337,17 @@ eng_root=`cd -P "$_script_dir/.." && pwd`
repo_root=`cd -P "$_script_dir/../.." && pwd`
artifacts_dir="$repo_root/artifacts"
toolset_dir="$artifacts_dir/toolset"
+tools_dir="$repo_root/.tools"
log_dir="$artifacts_dir/log/$configuration"
temp_dir="$artifacts_dir/tmp/$configuration"
global_json_file="$repo_root/global.json"
+# determine if global.json contains a "runtimes" entry
+global_json_has_runtimes=false
+dotnetlocal_key=`grep -m 1 "runtimes" "$global_json_file"` || true
+if [[ -n "$dotnetlocal_key" ]]; then
+ global_json_has_runtimes=true
+fi
# HOME may not be defined in some scenarios, but it is required by NuGet
if [[ -z $HOME ]]; then
@@ -325,4 +362,4 @@ mkdir -p "$log_dir"
if [[ $ci == true ]]; then
export TEMP="$temp_dir"
export TMP="$temp_dir"
-fi
+fi \ No newline at end of file