Remove dependency on .NET Core 2.0 from build tools

This commit is contained in:
Nate McMaster 2018-07-03 11:37:12 -07:00
Родитель d1b6240ad6
Коммит 4d5cf0b527
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A778D9601BD78810
35 изменённых файлов: 31 добавлений и 168 удалений

Просмотреть файл

@ -1,6 +1,5 @@
<Project>
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -2,7 +2,6 @@
<PropertyGroup>
<HtmlAgilityPackPackageVersion>1.5.1</HtmlAgilityPackPackageVersion>
<MicrosoftDotNetPlatformAbstractionsVersion>2.0.0</MicrosoftDotNetPlatformAbstractionsVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<MicrosoftWin32RegistryPackageVersion>4.4.0</MicrosoftWin32RegistryPackageVersion>

Просмотреть файл

@ -2,7 +2,7 @@
<Import Project="$(RepoTasksSdkPath)\Sdk.props" Condition="'$(RepoTasksSdkPath)' != '' "/>
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DefineConstants>$(DefineConstants);BuildTools</DefineConstants>
<NoWarn>$(NoWarn);NU1603</NoWarn>
</PropertyGroup>

Просмотреть файл

@ -1 +0,0 @@
2.0.7

Просмотреть файл

@ -5,7 +5,7 @@
<GenerateFullPaths Condition="'$(VSCODE_PID)' != ''">true</GenerateFullPaths>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- Set explicitly to make it clear that this is not a console app, even though it targets netcoreapp2.0 -->
<!-- Set explicitly to make it clear that this is not a console app, even though it targets netcoreapp2.1 -->
<OutputType>library</OutputType>
<!--

Просмотреть файл

@ -205,27 +205,7 @@ function Install-Tools(
& chmod +x $scriptPath
}
$channel = "preview"
$runtimeChannel = "master"
$version = __get_dotnet_sdk_version
$runtimeVersion = Get-Content (Join-Paths $PSScriptRoot ('..', 'config', 'runtime.version'))
if ($env:KOREBUILD_DOTNET_CHANNEL) {
$channel = $env:KOREBUILD_DOTNET_CHANNEL
Write-Warning "dotnet channel overridden by KOREBUILD_DOTNET_CHANNEL"
}
if ($env:KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL) {
$runtimeChannel = $env:KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL
Write-Warning "dotnet shared runtime channel overridden by KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL"
}
if ($env:KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION) {
$runtimeVersion = $env:KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION
Write-Warning "dotnet shared runtime version overridden by KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION"
}
if ($runtimeVersion) {
__install_shared_runtime $scriptPath $installDir -arch $arch -version $runtimeVersion -channel $runtimeChannel -SkipNonVersionedFiles
}
# Install the main CLI
if (!(Test-Path (Join-Paths $installDir ('sdk', $version, 'dotnet.dll')))) {

Просмотреть файл

@ -63,41 +63,16 @@ if [ ! -z "${KOREBUILD_SKIP_RUNTIME_INSTALL:-}" ]; then
exit 0
fi
channel='preview'
version=$(__get_dotnet_sdk_version)
runtime_channel='master'
runtime_version=$(< "$__script_dir/../config/runtime.version" head -1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
# environment overrides
if [ ! -z "${KOREBUILD_DOTNET_CHANNEL:-}" ]; then
channel=${KOREBUILD_DOTNET_CHANNEL:-}
__warn "dotnet channel was overridden by KOREBUILD_DOTNET_CHANNEL."
fi
if [ ! -z "${KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL:-}" ]; then
runtime_channel=${KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL:-}
__warn "dotnet shared runtime channel overridden by KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL"
fi
if [ ! -z "${KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION:-}" ]; then
runtime_version=${KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION:-}
__warn "dotnet shared runtime version overridden by KOREBUILD_DOTNET_SHARED_RUNTIME_VERSION"
fi
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
chmod +x "$__script_dir/dotnet-install.sh"; sync
if [ "$runtime_version" != "" ]; then
__install_shared_runtime "$install_dir" "$runtime_version" "$runtime_channel"
fi
version=$(__get_dotnet_sdk_version)
__verbose "Installing .NET Core SDK $version"
if [ ! -f "$install_dir/sdk/$version/dotnet.dll" ]; then
"$__script_dir/dotnet-install.sh" \
--install-dir "$install_dir" \
--architecture x64 \
--channel "$channel" \
--version "$version" \
$verbose_flag
else

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup>
<DefineConstants>$(DefineConstants);BuildTools</DefineConstants>
<Description>MSBuild tasks. This package is intended for Microsoft use only</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>Microsoft.AspNetCore.BuildTools</RootNamespace>
<AssemblyName>Internal.AspNetCore.BuildTools.Tasks</AssemblyName>
</PropertyGroup>

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if NETCOREAPP2_0
#if NETCOREAPP2_1
using System;
using System.Collections.Generic;
using System.IO;

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if NETCOREAPP2_0
#if NETCOREAPP2_1
using System.IO;
using Microsoft.AspNetCore.BuildTools.Utilities;

Просмотреть файл

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.BuildTools
#if NET46
// MSBuild.exe only runs on Windows. This task doesn't support xbuild, only dotnet-msbuild and MSBuild.exe.
PlatformName = "Windows";
#elif NETCOREAPP2_0
#elif NETCOREAPP2_1
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
PlatformName = "Windows";

Просмотреть файл

@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.BuildTools
var entry = zip.CreateEntryFromFile(file.ItemSpec, entryName);
#if NET46
#elif NETCOREAPP2_0
#elif NETCOREAPP2_1
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// This isn't required when creating a zip on Windows. unzip will check which

Просмотреть файл

@ -27,7 +27,7 @@
<Sdk Name="Microsoft.DotNet.GlobalTools.Sdk" Version="$(Version)" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Internal.AspNetCore.KoreBuild.Tasks</AssemblyName>
</PropertyGroup>

Просмотреть файл

@ -2,11 +2,10 @@
<PropertyGroup>
<Description>Verifies Asp.Net Core NuGet packages.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>NuGetPackageVerifier</AssemblyName>
<RootNamespace>NuGetPackageVerifier</RootNamespace>
<OutputType>exe</OutputType>
<RuntimeFrameworkVersion>$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>NuGetPackageVerifier.Task</AssemblyName>
</PropertyGroup>

Просмотреть файл

@ -37,16 +37,6 @@ if ($DotNetSdkVersion -and $PSCmdlet.ShouldProcess("Update dotnet SDK to $DotNet
}
}
if ($DotNetRuntimeVersion -and $PSCmdlet.ShouldProcess("Update dotnet runtime to $DotNetRuntimeVersion")) {
$path = "$PSScriptRoot/../files/KoreBuild/config/runtime.version"
$currentVersion = (Get-Content -path $path -Encoding Ascii).Trim()
if ($currentVersion -ne $DotNetRuntimeVersion) {
$DotNetRuntimeVersion | Set-Content -path $path -Encoding Ascii
if ($git) { & git add $path }
$updates += "runtime to $DotNetRuntimeVersion"
}
}
$message = "Updating $($updates -join ' and ')"
if ($updates -and $git -and ($Force -or $PSCmdlet.ShouldContinue("Commit: $message", "Create a new commit with these changes?"))) {
& $git commit -m $message @GitCommitArgs

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<PackageId>Internal.AspNetCore.Sdk</PackageId>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
<DefineConstants>$(DefineConstants);SDK</DefineConstants>
<Serviceable>false</Serviceable>
<Description>Build targets and extensions to Microsoft.NET.Sdk. This package is intended for Microsoft use only.</Description>

Просмотреть файл

@ -13,7 +13,7 @@
</metadata>
<files>
<file src="_._" target="lib\netstandard1.0\_._" />
<file src="bin\$config$\netcoreapp2.0\Internal.AspNetCore.Sdk.dll" target="tools\netcoreapp2.0\Internal.AspNetCore.Sdk.dll" />
<file src="bin\$config$\netcoreapp2.1\Internal.AspNetCore.Sdk.dll" target="tools\netcoreapp2.1\Internal.AspNetCore.Sdk.dll" />
<file src="bin\$config$\net46\Internal.AspNetCore.Sdk.dll" target="tools\net46\Internal.AspNetCore.Sdk.dll" />
<file src="..\..\modules\BuildTools.Tasks\BuildTools.Tasks.props" target="build\" />
<file src="build\" target="build\" />

Просмотреть файл

@ -50,7 +50,7 @@ Usage: this should be imported once via NuGet at the top of the file.
<!-- Detect this package inclusion. For use by other targets and properties. -->
<InternalAspNetCoreSdkImported>true</InternalAspNetCoreSdkImported>
<_BuildTasksPrefix>Sdk_</_BuildTasksPrefix>
<_BuildToolsAssemblyTfm Condition="'$(MSBuildRuntimeType)' == 'Core'">netcoreapp2.0</_BuildToolsAssemblyTfm>
<_BuildToolsAssemblyTfm Condition="'$(MSBuildRuntimeType)' == 'Core'">netcoreapp2.1</_BuildToolsAssemblyTfm>
<_BuildToolsAssemblyTfm Condition="'$(MSBuildRuntimeType)' != 'Core'">net46</_BuildToolsAssemblyTfm>
<_BuildToolsAssembly>$(MSBuildThisFileDirectory)..\tools\$(_BuildToolsAssemblyTfm)\Internal.AspNetCore.Sdk.dll</_BuildToolsAssembly>
</PropertyGroup>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<PackageId>Internal.AspNetCore.SiteExtension.Sdk</PackageId>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net46</TargetFrameworks>
<Serviceable>false</Serviceable>
<Description>Build targets and extensions to Microsoft.NET.Sdk. This package is intended for Microsoft use only.</Description>
<NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile>

Просмотреть файл

@ -10,7 +10,7 @@
</metadata>
<files>
<file src="_._" target="lib\netstandard1.0\_._" />
<file src="bin\$config$\netcoreapp2.0\Internal.AspNetCore.SiteExtension.Sdk.dll" target="tools\netcoreapp2.0\Internal.AspNetCore.SiteExtension.Sdk.dll" />
<file src="bin\$config$\netcoreapp2.1\Internal.AspNetCore.SiteExtension.Sdk.dll" target="tools\netcoreapp2.1\Internal.AspNetCore.SiteExtension.Sdk.dll" />
<file src="bin\$config$\net46\Internal.AspNetCore.SiteExtension.Sdk.dll" target="tools\net46\Internal.AspNetCore.SiteExtension.Sdk.dll" />
<file src="build\" target="build\" />
<file src="content\" target="content\" />

Просмотреть файл

@ -4,7 +4,7 @@
-->
<Project TreatAsLocalProperty="TaskFolder;TaskAssembly">
<PropertyGroup>
<TaskFolder Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.0</TaskFolder>
<TaskFolder Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.1</TaskFolder>
<TaskFolder Condition=" '$(MSBuildRuntimeType)' != 'Core' ">net46</TaskFolder>
<TaskAssembly>$(MSBuildThisFileDirectory)..\tools\$(TaskFolder)\Internal.AspNetCore.SiteExtension.Sdk.dll</TaskAssembly>
</PropertyGroup>

Просмотреть файл

@ -3,7 +3,7 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile>
<Serviceable>false</Serviceable>
<NoPackageAnalysis>true</NoPackageAnalysis>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -6,7 +6,6 @@
<Project>
<PropertyGroup>
<RestoreSources>$([MSBuild]::Escape($(RestoreSources)))</RestoreSources>
<RuntimeFrameworkVersion Condition="'%24(TargetFramework)' == 'netcoreapp2.0'">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition="'%24(TargetFramework)' == 'netcoreapp2.1'">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup>
<!-- still required to keep VS happy -->
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<Import Project="$(RepoTasksSdkPath)\Sdk.targets" Condition="'$(RepoTasksSdkPath)' != '' "/>

Просмотреть файл

@ -6,7 +6,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.1</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Просмотреть файл

@ -76,30 +76,14 @@ namespace KoreBuild.Console.Commands
process.WaitForExit();
}
var channel = GetChannel();
var runtimeChannel = GetRuntimeChannel();
var runtimeVersion = GetRuntimeVersion();
var runtimesToInstall = new List<Tuple<string, string>>();
if (runtimeVersion != null)
{
runtimesToInstall.Add(new Tuple<string, string>(runtimeVersion, runtimeChannel));
}
var architecture = Context.GetArchitecture();
foreach (var runtime in runtimesToInstall)
{
InstallSharedRuntime(scriptPath, installDir, architecture, runtime.Item1, runtime.Item2);
}
InstallCLI(scriptPath, installDir, architecture, Context.SDKVersion, channel);
InstallCLI(scriptPath, installDir, architecture, Context.SDKVersion);
return 0;
}
private void InstallCLI(string script, string installDir, string architecture, string version, string channel)
private void InstallCLI(string script, string installDir, string architecture, string version)
{
var sdkPath = Path.Combine(installDir, "sdk", version, "dotnet.dll");
@ -108,7 +92,6 @@ namespace KoreBuild.Console.Commands
Reporter.Verbose($"Installing dotnet {version} to {installDir}");
var args = ArgumentEscaper.EscapeAndConcatenate(new string[] {
"-Channel", channel,
"-Version", version,
"-Architecture", architecture,
"-InstallDir", installDir
@ -129,66 +112,6 @@ namespace KoreBuild.Console.Commands
}
}
private void InstallSharedRuntime(string script, string installDir, string architecture, string version, string channel)
{
var sharedRuntimePath = Path.Combine(installDir, "shared", "Microsoft.NETCore.App", version);
if (!Directory.Exists(sharedRuntimePath))
{
var args = ArgumentEscaper.EscapeAndConcatenate(new string[]
{
"-Channel", channel,
"-Runtime", "dotnet",
"-Version", version,
"-Architecture", architecture,
"-InstallDir", installDir
});
var psi = new ProcessStartInfo
{
FileName = script,
Arguments = args
};
var process = Process.Start(psi);
process.WaitForExit();
}
else
{
Reporter.Output($".NET Core runtime {version} is already installed. Skipping installation.");
}
}
private static string GetChannel()
{
var channel = "preview";
var channelEnv = Environment.GetEnvironmentVariable("KOREBUILD_DOTNET_CHANNEL");
if (channelEnv != null)
{
channel = channelEnv;
}
return channel;
}
private static string GetRuntimeChannel()
{
var runtimeChannel = "master";
var runtimeEnv = Environment.GetEnvironmentVariable("KOREBUILD_DOTNET_SHARED_RUNTIME_CHANNEL");
if (runtimeEnv != null)
{
runtimeChannel = runtimeEnv;
}
return runtimeChannel;
}
private string GetRuntimeVersion()
{
var runtimeVersionPath = Path.Combine(Context.ConfigDirectory, "runtime.version");
return File.ReadAllText(runtimeVersionPath).Trim();
}
private static string GetCommandFromPath(string command)
{
var values = Environment.GetEnvironmentVariable("PATH");

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\shared\Microsoft.Extensions.CommandLineUtils.Sources\**\*.cs" />