You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.88
Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
parent
7d05485754
commit
6123a772ed
2
external/linker/corebuild/.cliversion
vendored
2
external/linker/corebuild/.cliversion
vendored
@@ -1 +1 @@
|
||||
2.0.0-preview2-005905
|
||||
2.0.0
|
||||
|
||||
1
external/linker/corebuild/.toolversions
vendored
1
external/linker/corebuild/.toolversions
vendored
@@ -1 +0,0 @@
|
||||
|
||||
2
external/linker/corebuild/bootstrap.ps1
vendored
2
external/linker/corebuild/bootstrap.ps1
vendored
@@ -6,7 +6,7 @@ param
|
||||
[Parameter(Mandatory=$false)][string]$SharedFrameworkSymlinkPath = (Join-Path $ToolsLocalPath "dotnetcli\shared\Microsoft.NETCore.App\version"),
|
||||
[Parameter(Mandatory=$false)][string]$SharedFrameworkVersion = "<auto>",
|
||||
[Parameter(Mandatory=$false)][string]$Architecture = "<auto>",
|
||||
[Parameter(Mandatory=$false)][string]$DotNetInstallBranch = "rel/1.0.0",
|
||||
[Parameter(Mandatory=$false)][string]$DotNetInstallBranch = "release/2.0.0",
|
||||
[switch]$Force = $false
|
||||
)
|
||||
|
||||
|
||||
2
external/linker/corebuild/bootstrap.sh
vendored
2
external/linker/corebuild/bootstrap.sh
vendored
@@ -80,7 +80,7 @@ sharedFxVersion="<auto>"
|
||||
force=
|
||||
forcedCliLocalPath="<none>"
|
||||
architecture="<auto>"
|
||||
dotNetInstallBranch="rel/1.0.0"
|
||||
dotNetInstallBranch="release/2.0.0"
|
||||
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
|
||||
5
external/linker/corebuild/global.json
vendored
Normal file
5
external/linker/corebuild/global.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "2.0.0"
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
|
||||
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<VersionPrefix>0.1.4-preview</VersionPrefix>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<BaseOutputPath>../bin/</BaseOutputPath>
|
||||
<PackageOutputPath>$(BaseOutputPath)nupkgs</PackageOutputPath>
|
||||
|
||||
@@ -29,10 +29,11 @@ namespace ILLink.Tests
|
||||
|
||||
protected int Dotnet(string args, string workingDir, string additionalPath = null)
|
||||
{
|
||||
return RunCommand(context.DotnetToolPath, args, workingDir, additionalPath, out string commandOutput);
|
||||
return RunCommand(Path.GetFullPath(context.DotnetToolPath), args,
|
||||
workingDir, additionalPath, out string commandOutput);
|
||||
}
|
||||
|
||||
protected int RunCommand(string command, string args, int timeout = 60000)
|
||||
protected int RunCommand(string command, string args, int timeout = Int32.MaxValue)
|
||||
{
|
||||
return RunCommand(command, args, null, null, out string commandOutput, timeout);
|
||||
}
|
||||
@@ -42,7 +43,7 @@ namespace ILLink.Tests
|
||||
return RunCommand(command, args, workingDir, null, out string commandOutput);
|
||||
}
|
||||
|
||||
protected int RunCommand(string command, string args, string workingDir, string additionalPath, out string commandOutput, int timeout = 60000)
|
||||
protected int RunCommand(string command, string args, string workingDir, string additionalPath, out string commandOutput, int timeout = Int32.MaxValue)
|
||||
{
|
||||
output.WriteLine($"{command} {args}");
|
||||
if (workingDir != null)
|
||||
@@ -64,6 +65,14 @@ namespace ILLink.Tests
|
||||
var process = new Process();
|
||||
process.StartInfo = psi;
|
||||
|
||||
// dotnet sets some environment variables that
|
||||
// may cause problems in the child process.
|
||||
psi.Environment.Remove("MSBuildExtensionsPath");
|
||||
psi.Environment.Remove("MSBuildLoadMicrosoftTargetsReadOnly");
|
||||
psi.Environment.Remove("MSBuildSDKsPath");
|
||||
psi.Environment.Remove("VbcToolExe");
|
||||
psi.Environment.Remove("CscToolExe");
|
||||
|
||||
StringBuilder processOutput = new StringBuilder();
|
||||
DataReceivedEventHandler handler = (sender, e) => {
|
||||
processOutput.Append(e.Data);
|
||||
@@ -80,6 +89,7 @@ namespace ILLink.Tests
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
if (!process.WaitForExit(timeout)) {
|
||||
output.WriteLine($"killing process after {timeout} ms");
|
||||
process.Kill();
|
||||
}
|
||||
// WaitForExit with timeout doesn't guarantee
|
||||
@@ -101,26 +111,25 @@ namespace ILLink.Tests
|
||||
/// linker task package.
|
||||
/// Optionally takes a list of root descriptor files.
|
||||
/// </summary>
|
||||
public void BuildAndLink(string csproj, List<string> rootFiles = null)
|
||||
public void BuildAndLink(string csproj, List<string> rootFiles = null, Dictionary<string, string> extraPublishArgs = null)
|
||||
{
|
||||
string rid = context.RuntimeIdentifier;
|
||||
string config = context.Configuration;
|
||||
string demoRoot = Path.GetDirectoryName(csproj);
|
||||
|
||||
int ret = Dotnet($"restore -r {rid}", demoRoot);
|
||||
if (ret != 0) {
|
||||
output.WriteLine("restore failed");
|
||||
Assert.True(false);
|
||||
return;
|
||||
}
|
||||
|
||||
string publishArgs = $"publish -r {rid} -c {config} /v:n /p:ShowLinkerSizeComparison=true";
|
||||
string rootFilesStr;
|
||||
if (rootFiles != null && rootFiles.Any()) {
|
||||
rootFilesStr = String.Join(";", rootFiles);
|
||||
publishArgs += $" /p:LinkerRootDescriptors={rootFilesStr}";
|
||||
}
|
||||
ret = Dotnet(publishArgs, demoRoot);
|
||||
if (extraPublishArgs != null) {
|
||||
foreach (var item in extraPublishArgs) {
|
||||
publishArgs += $" /p:{item.Key}={item.Value}";
|
||||
}
|
||||
}
|
||||
int ret = Dotnet(publishArgs, demoRoot);
|
||||
|
||||
if (ret != 0) {
|
||||
output.WriteLine("publish failed, returning " + ret);
|
||||
Assert.True(false);
|
||||
@@ -128,11 +137,13 @@ namespace ILLink.Tests
|
||||
}
|
||||
}
|
||||
|
||||
public int RunApp(string csproj, out string processOutput, int timeout = 60000)
|
||||
public int RunApp(string csproj, out string processOutput, int timeout = Int32.MaxValue)
|
||||
{
|
||||
string demoRoot = Path.GetDirectoryName(csproj);
|
||||
string executablePath = Path.Combine(
|
||||
demoRoot, "bin", context.Configuration, "netcoreapp2.0",
|
||||
// detect the target framework for which the app was published
|
||||
string tfmDir = Path.Combine(demoRoot, "bin", context.Configuration);
|
||||
string tfm = Directory.GetDirectories(tfmDir).Select(p => Path.GetFileName(p)).Single();
|
||||
string executablePath = Path.Combine(tfmDir, tfm,
|
||||
context.RuntimeIdentifier, "publish",
|
||||
Path.GetFileNameWithoutExtension(csproj)
|
||||
);
|
||||
@@ -141,17 +152,9 @@ namespace ILLink.Tests
|
||||
}
|
||||
Assert.True(File.Exists(executablePath));
|
||||
|
||||
// work around bug in prerelease .NET Core,
|
||||
// where the published host isn't executable
|
||||
int ret;
|
||||
if (!context.RuntimeIdentifier.Contains("win")) {
|
||||
ret = RunCommand("chmod", "+x " + executablePath, 1000);
|
||||
Assert.True(ret == 0);
|
||||
}
|
||||
|
||||
ret = RunCommand(executablePath, null,
|
||||
Directory.GetParent(executablePath).FullName,
|
||||
null, out processOutput, timeout);
|
||||
int ret = RunCommand(executablePath, null,
|
||||
Directory.GetParent(executablePath).FullName,
|
||||
null, out processOutput, timeout);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace ILLink.Tests
|
||||
|
||||
private static List<string> rootFiles = new List<string> { "MusicStoreReflection.xml" };
|
||||
|
||||
private string netcoreappVersion;
|
||||
|
||||
[Fact]
|
||||
public void RunMusicStore()
|
||||
{
|
||||
@@ -32,10 +34,70 @@ namespace ILLink.Tests
|
||||
|
||||
AddLinkerReference(csproj);
|
||||
|
||||
BuildAndLink(csproj, rootFiles);
|
||||
Dictionary<string, string> extraPublishArgs = new Dictionary<string, string>();
|
||||
extraPublishArgs.Add("JITBENCH_FRAMEWORK_VERSION", netcoreappVersion);
|
||||
BuildAndLink(csproj, rootFiles, extraPublishArgs);
|
||||
}
|
||||
|
||||
int ret = RunApp(csproj, out string commandOutput);
|
||||
Assert.True(ret == 0);
|
||||
string ObtainSDK(string repoDir)
|
||||
{
|
||||
int ret;
|
||||
string dotnetDirName = ".dotnet";
|
||||
string dotnetInstall = Path.Combine(repoDir, "dotnet-install");
|
||||
if (context.RuntimeIdentifier.Contains("win")) {
|
||||
dotnetInstall += ".ps1";
|
||||
} else {
|
||||
dotnetInstall += ".sh";
|
||||
}
|
||||
if (!File.Exists(dotnetInstall)) {
|
||||
output.WriteLine($"missing dotnet-install script at {dotnetInstall}");
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
if (context.RuntimeIdentifier.Contains("win")) {
|
||||
ret = RunCommand(dotnetInstall, $"-SharedRuntime -InstallDir {dotnetDirName} -Channel master -Architecture x64", repoDir);
|
||||
if (ret != 0) {
|
||||
output.WriteLine("failed to retrieve shared runtime");
|
||||
Assert.True(false);
|
||||
}
|
||||
ret = RunCommand(dotnetInstall, $"-InstallDir {dotnetDirName} -Channel master -Architecture x64", repoDir);
|
||||
if (ret != 0) {
|
||||
output.WriteLine("failed to retrieve sdk");
|
||||
Assert.True(false);
|
||||
}
|
||||
} else {
|
||||
ret = RunCommand(dotnetInstall, $"-sharedruntime -runtimeid {context.RuntimeIdentifier} -installdir {dotnetDirName} -channel master -architecture x64", repoDir);
|
||||
if (ret != 0) {
|
||||
output.WriteLine("failed to retrieve shared runtime");
|
||||
Assert.True(false);
|
||||
}
|
||||
ret = RunCommand(dotnetInstall, $"-installdir {dotnetDirName} -channel master -architecture x64", repoDir);
|
||||
if (ret != 0) {
|
||||
output.WriteLine("failed to retrieve sdk");
|
||||
Assert.True(false);
|
||||
}
|
||||
}
|
||||
|
||||
string dotnetDir = Path.Combine(repoDir, dotnetDirName);
|
||||
string dotnetToolName = Directory.GetFiles(dotnetDir)
|
||||
.Select(p => Path.GetFileName(p))
|
||||
.Where(p => p.Contains("dotnet"))
|
||||
.Single();
|
||||
string dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName);
|
||||
if (!File.Exists(dotnetToolPath)) {
|
||||
output.WriteLine("repo-local dotnet tool does not exist.");
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
string ncaDir = Path.Combine(dotnetDir, "shared", "Microsoft.NETCore.App");
|
||||
netcoreappVersion = Directory.GetDirectories(ncaDir)
|
||||
.Select(p => Path.GetFileName(p)).Max();
|
||||
if (String.IsNullOrEmpty(netcoreappVersion)) {
|
||||
output.WriteLine($"no netcoreapp version found in {ncaDir}");
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
return dotnetToolPath;
|
||||
}
|
||||
|
||||
// returns path to .csproj project file
|
||||
@@ -44,7 +106,6 @@ namespace ILLink.Tests
|
||||
string gitRepo = "http://github.com/aspnet/JitBench";
|
||||
string repoName = "JitBench";
|
||||
string gitBranch = "dev";
|
||||
string demoRoot = Path.Combine("JitBench", Path.Combine("src", "MusicStore"));
|
||||
|
||||
int ret;
|
||||
if (Directory.Exists(repoName)) {
|
||||
@@ -57,6 +118,7 @@ namespace ILLink.Tests
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
string demoRoot = Path.Combine("JitBench", Path.Combine("src", "MusicStore"));
|
||||
if (!Directory.Exists(demoRoot)) {
|
||||
output.WriteLine($"{demoRoot} does not exist");
|
||||
Assert.True(false);
|
||||
@@ -68,6 +130,11 @@ namespace ILLink.Tests
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
// MusicStore targets .NET Core 2.1, so it must be built
|
||||
// using an SDK that can target 2.1. We obtain that SDK
|
||||
// here.
|
||||
context.DotnetToolPath = ObtainSDK(repoName);
|
||||
|
||||
string csproj = Path.Combine(demoRoot, "MusicStore.csproj");
|
||||
return csproj;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ILLink.Tests
|
||||
/// The path to the dotnet tool to use to run the
|
||||
/// integration tests.
|
||||
/// </summary>
|
||||
public string DotnetToolPath { get; private set; }
|
||||
public string DotnetToolPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The RID to use when restoring, building, and linking the
|
||||
@@ -87,6 +87,12 @@ namespace ILLink.Tests
|
||||
context.DotnetToolPath = dotnetToolPath;
|
||||
// This sets the RID to the RID of the currently-executing system.
|
||||
context.RuntimeIdentifier = RuntimeEnvironment.GetRuntimeIdentifier();
|
||||
// workaround: the osx.10.13-x64 RID doesn't exist yet.
|
||||
// see https://github.com/dotnet/core-setup/issues/3301
|
||||
if (context.RuntimeIdentifier == "osx.10.13-x64")
|
||||
{
|
||||
context.RuntimeIdentifier = "osx.10.12-x64";
|
||||
}
|
||||
// We want to build and link integration projects in the
|
||||
// release configuration.
|
||||
context.Configuration = "Release";
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.2.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
|
||||
<PackageReference Include="xunit" Version="2.3.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" />
|
||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user