Specify dotnet version under tools.dotnet
This commit is contained in:
Родитель
d7e611bc29
Коммит
c6c5095261
|
@ -20,7 +20,7 @@ steps:
|
|||
-configuration $(BuildConfiguration)
|
||||
/p:PB_PublishBlobFeedKey=$(PB_PublishBlobFeedKey)
|
||||
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
|
||||
/p:DotNetSignType=$(SignType)
|
||||
/p:DotNetSignType=$(SignType)
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
displayName: Build
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<SystemValueTupleVersion>4.3.0</SystemValueTupleVersion>
|
||||
|
||||
<MicrosoftDiaSymReaderNativeVersion>1.7.0</MicrosoftDiaSymReaderNativeVersion>
|
||||
<MicrosoftDotNetSignToolVersion>1.0.0-prerelease-63201-04</MicrosoftDotNetSignToolVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -79,14 +79,14 @@ 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 (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.sdk.version)"))) {
|
||||
if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) {
|
||||
$dotnetRoot = $env:DOTNET_INSTALL_DIR
|
||||
} else {
|
||||
$dotnetRoot = Join-Path $RepoRoot ".dotnet"
|
||||
$env:DOTNET_INSTALL_DIR = $dotnetRoot
|
||||
|
||||
if ($restore) {
|
||||
InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version
|
||||
InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ function InitializeVisualStudioBuild {
|
|||
}
|
||||
|
||||
function LocateVisualStudio {
|
||||
$vswhereVersion = $GlobalJson.vswhere.version
|
||||
$vswhereVersion = $GlobalJson.tools.vswhere
|
||||
$toolsRoot = Join-Path $RepoRoot ".tools"
|
||||
$vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion"
|
||||
$vsWhereExe = Join-Path $vsWhereDir "vswhere.exe"
|
||||
|
@ -152,7 +152,9 @@ function LocateVisualStudio {
|
|||
}
|
||||
|
||||
function GetBuildCommand() {
|
||||
if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {
|
||||
$tools = $GlobalJson.tools
|
||||
|
||||
if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) {
|
||||
$dotnetRoot = InitializeDotNetCli
|
||||
|
||||
# by default build with dotnet cli:
|
||||
|
@ -160,7 +162,7 @@ function GetBuildCommand() {
|
|||
$buildArgs = "msbuild"
|
||||
}
|
||||
|
||||
if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) {
|
||||
if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) {
|
||||
$vsInstallDir = InitializeVisualStudioBuild
|
||||
|
||||
# Presence of vswhere.version indicates the repo needs to build using VS msbuild:
|
||||
|
@ -169,7 +171,7 @@ function GetBuildCommand() {
|
|||
}
|
||||
|
||||
if ($buildDriver -eq $null) {
|
||||
Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
|
||||
Write-Host "/global.json must either specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
|
@ -132,13 +132,9 @@ while (($# > 0)); do
|
|||
esac
|
||||
done
|
||||
|
||||
# ReadJson [filename] [json key]
|
||||
# Result: Sets 'readjsonvalue' to the value of the provided json key
|
||||
# Note: this method may return unexpected results if there are duplicate
|
||||
# keys in the json
|
||||
function ReadJson {
|
||||
local file=$1
|
||||
local key=$2
|
||||
# ReadVersionFromJson [json key]
|
||||
function ReadGlobalVersion {
|
||||
local key=$1
|
||||
|
||||
local unamestr="$(uname)"
|
||||
local sedextended='-r'
|
||||
|
@ -146,11 +142,14 @@ function ReadJson {
|
|||
sedextended='-E'
|
||||
fi;
|
||||
|
||||
readjsonvalue="$(grep -m 1 "\"$key\"" $file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')"
|
||||
if [[ ! "$readjsonvalue" ]]; then
|
||||
echo "Error: Cannot find \"$key\" in $file" >&2;
|
||||
local version="$(grep -m 1 "\"$key\"" $global_json_file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')"
|
||||
if [[ ! "$version" ]]; then
|
||||
echo "Error: Cannot find \"$key\" in $global_json_file" >&2;
|
||||
ExitWithExitCode 1
|
||||
fi;
|
||||
|
||||
# return value
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
function InitializeDotNetCli {
|
||||
|
@ -165,8 +164,8 @@ function InitializeDotNetCli {
|
|||
export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir"
|
||||
fi
|
||||
|
||||
ReadJson "$global_json_file" "version"
|
||||
local dotnet_sdk_version="$readjsonvalue"
|
||||
|
||||
local dotnet_sdk_version=`ReadGlobalVersion "dotnet"`
|
||||
local dotnet_root=""
|
||||
|
||||
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
|
||||
|
@ -220,8 +219,7 @@ function GetDotNetInstallScript {
|
|||
}
|
||||
|
||||
function InitializeToolset {
|
||||
ReadJson $global_json_file "Microsoft.DotNet.Arcade.Sdk"
|
||||
local toolset_version=$readjsonvalue
|
||||
local toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"`
|
||||
local toolset_location_file="$toolset_dir/$toolset_version.txt"
|
||||
|
||||
if [[ -a "$toolset_location_file" ]]; then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "2.1.400-preview-009088"
|
||||
"tools": {
|
||||
"dotnet": "2.1.400-preview-009088"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-prerelease-63202-02"
|
||||
|
|
Загрузка…
Ссылка в новой задаче