Skip to content

Commit 4a9f641

Browse files
PR feedback
1 parent df1eddb commit 4a9f641

File tree

53 files changed

+246
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+246
-97
lines changed

Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion>
3+
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
44
</PropertyGroup>
55

66
<!-- Don't police what version of NetCoreApp we use -->

build/dependencies.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<HtmlAgilityPackPackageVersion>1.5.1</HtmlAgilityPackPackageVersion>
44
<MicrosoftDotNetPlatformAbstractionsVersion>2.0.0</MicrosoftDotNetPlatformAbstractionsVersion>
55
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
6-
<MicrosoftNETCoreApp21PackageVersion>2.1.0-rc1-26425-06</MicrosoftNETCoreApp21PackageVersion>
76
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
87
<MicrosoftWin32RegistryPackageVersion>4.4.0</MicrosoftWin32RegistryPackageVersion>
98
<MonoCecilPackageVersion>0.10.0-beta6</MonoCecilPackageVersion>

build/tasks/RepoTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="$(RepoTasksSdkPath)\Sdk.props" Condition="'$(RepoTasksSdkPath)' != '' "/>
33

44
<PropertyGroup>
5-
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
66
<DefineConstants>$(DefineConstants);BuildTools</DefineConstants>
77
<NoWarn>$(NoWarn);NU1603</NoWarn>
88
</PropertyGroup>

files/KoreBuild/KoreBuild.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ invoke_korebuild_command(){
4040
shift
4141

4242
if [ "$command" = "default-build" ]; then
43-
__install_tools "$tools_source" "$dot_net_home"
43+
__install_tools "$tools_source" "$dot_net_home" "$repo_path"
4444
__invoke_repository_build "$repo_path" "$@"
4545
elif [ "$command" = "msbuild" ]; then
4646
__invoke_repository_build "$repo_path" "$@"
4747
elif [ "$command" = "install-tools" ]; then
48-
__install_tools "$tools_source" "$dot_net_home"
48+
__install_tools "$tools_source" "$dot_net_home" "$repo_path"
4949
else
5050
__ensure_dotnet
5151

@@ -80,6 +80,7 @@ __invoke_repository_build() {
8080
__install_tools() {
8181
local tools_source=$1
8282
local install_dir=$2
83+
local repo_path=$3
8384
local tools_home="$install_dir/buildtools"
8485
local netfx_version='4.6.1'
8586

@@ -97,7 +98,7 @@ __install_tools() {
9798

9899
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
99100
chmod +x "$__korebuild_dir/scripts/get-dotnet.sh"; sync
100-
"$__korebuild_dir/scripts/get-dotnet.sh" $verbose_flag "$install_dir" \
101+
"$__korebuild_dir/scripts/get-dotnet.sh" $verbose_flag "$install_dir" "$repo_path"\
101102
|| return 1
102103

103104
# Set environment variables

files/KoreBuild/msbuild/KoreBuild.RepoTasks.Sdk/Sdk/Sdk.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<GenerateFullPaths Condition="'$(VSCODE_PID)' != ''">true</GenerateFullPaths>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
77

8-
<!-- Set explicitly to make it clear that this is not a console app, even though it targets netcoreapp2.2 -->
8+
<!-- Set explicitly to make it clear that this is not a console app, even though it targets netcoreapp2.0 -->
99
<OutputType>library</OutputType>
1010

1111
<!--

files/KoreBuild/scripts/KoreBuild.psm1

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,6 @@ function __install_shared_runtime($installScript, $installDir, [string]$arch, [s
423423
}
424424

425425
function __get_dotnet_sdk_version {
426-
if ($env:KOREBUILD_DOTNET_VERSION) {
427-
Write-Warning "dotnet SDK version overridden by KOREBUILD_DOTNET_VERSION"
428-
return $env:KOREBUILD_DOTNET_VERSION
429-
}
430-
431426
$globalObj = Get-Content(Join-Path $global:KoreBuildSettings.RepoPath "global.json") -Raw | ConvertFrom-Json
432427
return $globalObj.sdk.version
433428
}

files/KoreBuild/scripts/common.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,34 @@ __ensure_macos_version() {
5959
fi
6060
}
6161

62+
__machine_has() {
63+
hash "$1" > /dev/null 2>&1
64+
return $?
65+
}
66+
6267
__get_dotnet_sdk_version() {
68+
local repo_path=$1
6369
local src="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6470

65-
version=$(< "$src/../../../global.json" head -1 | grep -Po '"version":.*?[^\\]",' global.json)
66-
# environment override
67-
if [ ! -z "${KOREBUILD_DOTNET_VERSION:-}" ]; then
68-
version=${KOREBUILD_DOTNET_VERSION:-}
69-
__warn "Dotnet SDK version changed by KOREBUILD_DOTNET_VERSION"
71+
local global_json="$repo_path/global.json"
72+
local version
73+
74+
if __machine_has jq ; then
75+
if jq '.' "$global_json" >/dev/null ; then
76+
version="$(jq -r 'select(.sdk!=null) | .sdk.version' "$global_json")"
77+
else
78+
__warn "$global_json is invalid JSON. Its settings will be ignored."
79+
fi
80+
elif __machine_has python ; then
81+
if python -c "import json,codecs;obj=json.load(codecs.open('$global_json', 'r', 'utf-8-sig'))" >/dev/null ; then
82+
version="$(python -c "import json,codecs;obj=json.load(codecs.open('$global_json', 'r', 'utf-8-sig'));print(obj['sdk']['version'] if 'channel' in obj else '')")"
83+
else
84+
__warn "$config_file is invalid JSON. Its settings will be ignored."
85+
fi
86+
else
87+
__warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.'
7088
fi
89+
7190
echo $version
7291
}
7392

files/KoreBuild/scripts/get-dotnet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if [ ! -z "${KOREBUILD_SKIP_RUNTIME_INSTALL:-}" ]; then
6565
fi
6666

6767
channel='preview'
68-
version=$(__get_dotnet_sdk_version)
68+
version=$(__get_dotnet_sdk_version )
6969
runtime_channel='master'
7070
runtime_version=$(< "$__script_dir/../config/runtime.version" head -1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
7171

modules/BuildTools.Tasks/BuildTools.Tasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<DefineConstants>$(DefineConstants);BuildTools</DefineConstants>
55
<Description>MSBuild tasks. This package is intended for Microsoft use only</Description>
6-
<TargetFramework>netcoreapp2.2</TargetFramework>
6+
<TargetFramework>0</TargetFramework>
77
<RootNamespace>Microsoft.AspNetCore.BuildTools</RootNamespace>
88
<AssemblyName>Internal.AspNetCore.BuildTools.Tasks</AssemblyName>
99
</PropertyGroup>

modules/BuildTools.Tasks/FindUnusedReferences.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#if NETCOREAPP2_2
4+
#if NETCOREAPP2_0
55
using System;
66
using System.Collections.Generic;
77
using System.IO;

0 commit comments

Comments
 (0)