Merge pull request #4352 from livarcocc/add_a_way_to_develop_in_sierra

Getting the CLI to build on OSX Sierra
This commit is contained in:
Livar 2016-10-10 11:47:08 -07:00 committed by GitHub
commit f7823bcf06
18 changed files with 104 additions and 21 deletions

View file

@ -16,7 +16,7 @@
DependsOnTargets="BuildDotnetCliBuildFramework" >
<!-- Current Runtime Information -->
<GetCurrentRuntimeInformation>
<GetCurrentRuntimeInformation OverrideRid="$(OverrideRid)">
<Output TaskParameter="Rid" PropertyName="Rid" />
<Output TaskParameter="Architecture" PropertyName="Architecture" />
<Output TaskParameter="OSName" PropertyName="OSName" />

View file

@ -9,6 +9,8 @@ namespace Microsoft.DotNet.Cli.Build
{
public class GetCurrentRuntimeInformation : Task
{
public string OverrideRid { get; set; }
[Output]
public string Rid { get; set; }
@ -20,7 +22,7 @@ namespace Microsoft.DotNet.Cli.Build
public override bool Execute()
{
Rid = RuntimeEnvironment.GetRuntimeIdentifier();
Rid = string.IsNullOrEmpty(OverrideRid) ? RuntimeEnvironment.GetRuntimeIdentifier() : OverrideRid;
Architecture = RuntimeEnvironment.RuntimeArchitecture;
OSName = Monikers.GetOSShortName();

View file

@ -5,3 +5,4 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("dotnet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Utils.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -196,7 +196,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
TestProject = Path.Combine(TestDirectory, "project.json");
OutputDirectory = Path.Combine(TestDirectory, s_outputdirName);
Rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
Rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
}
private static void SetupStaticTestProject()

View file

@ -4,6 +4,7 @@
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Test.Utilities;
@ -227,8 +228,8 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var projectContext = ProjectContext.Create(
testInstance.Path,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
var depsFilePath =
projectContext.GetOutputPaths("Debug", outputPath: outputDir).RuntimeFiles.DepsJson;
@ -267,7 +268,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var projectContext = ProjectContext.Create(
testInstance.Path,
FrameworkConstants.CommonFrameworks.NetCoreApp10,
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
DotnetRuntimeIdentifiers.InferCurrentRuntimeIdentifiers());
var depsFilePath =
projectContext.GetOutputPaths("Debug", buildBasePath).RuntimeFiles.DepsJson;

View file

@ -13,7 +13,7 @@ namespace StreamForwarderTests
{
public class StreamForwarderTests : TestBase
{
private static readonly string s_rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
private static readonly string s_rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
public static void Main()
{

View file

@ -9,8 +9,12 @@
"../../TestAssets/TestProjects/TestAppWithArgs/*",
"../../TestAssets/TestProjects/AppWithDirectAndToolDependency/**/*",
"../../TestAssets/TestProjects/AppWithDirectDependency/**/*",
"../../TestAssets/TestProjects/AppWithToolDependency/**/*"
]
"../../TestAssets/TestProjects/AppWithToolDependency/**/*",
"../../artifacts/*/stage2/sdk/*/.version"
],
"mappings": {
".version": "../../artifacts/*/stage2/sdk/*/.version"
}
}
},
"dependencies": {

View file

@ -72,7 +72,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
if (!portable)
{
var runtime = string.IsNullOrEmpty(_runtime) ? RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier() : _runtime;
var runtime = string.IsNullOrEmpty(_runtime) ?
DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier() :
_runtime;
return Path.Combine(config, framework, runtime, PublishSubfolderName);
}
else

View file

@ -0,0 +1,30 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class DotnetLegacyRuntimeIdentifiers
{
public static string InferLegacyRestoreRuntimeIdentifier()
{
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
{
FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile();
return fxDepsFile.SupportsCurrentRuntime() ?
RuntimeEnvironment.GetRuntimeIdentifier() :
DotnetFiles.VersionFileObject.BuildRid;
}
else
{
var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();
return "win7-" + arch;
}
}
}
}

View file

@ -8,6 +8,7 @@ using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Test.Utilities;
using Moq;
using NuGet.Frameworks;
using Xunit;
@ -69,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
[Fact]
public void It_passes_a_RuntimeOutputDir_variable_to_the_pre_compile_scripts_if_rid_is_set_in_the_ProjectContext()
{
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
fixture.PreCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
fixture.PreCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);
@ -128,7 +129,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
[Fact]
public void It_passes_a_RuntimeOutputDir_variable_to_the_post_compile_scripts_if_rid_is_set_in_the_ProjectContext()
{
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
fixture.PostCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
fixture.PostCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);

View file

@ -4,8 +4,12 @@
"keyFile": "../../tools/Key.snk",
"copyToOutput": {
"include": [
"../../TestAssets/TestProjects/TestAppWithLibrary/**/*"
]
"../../TestAssets/TestProjects/TestAppWithLibrary/**/*",
"../../artifacts/*/stage2/sdk/*/.version"
],
"mappings": {
".version": "../../artifacts/*/stage2/sdk/*/.version"
}
}
},
"dependencies": {
@ -29,6 +33,9 @@
"Microsoft.DotNet.ProjectModel": {
"target": "project"
},
"Microsoft.DotNet.Tools.Tests.Utilities": {
"target": "project"
},
"xunit": "2.2.0-beta3-build3330",
"dotnet-test-xunit": "1.0.0-rc2-350904-49",
"moq.netcore": "4.4.0-beta8",

View file

@ -54,7 +54,9 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
[InlineData("KestrelDesktop", "http://localhost:20207", "win7-x86", "libuv.dll", false)]
public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool forceRunnable)
{
var runnable = forceRunnable || string.IsNullOrEmpty(runtime) || (RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier().Contains(runtime));
var runnable = forceRunnable ||
string.IsNullOrEmpty(runtime) ||
(DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier().Contains(runtime));
var testInstance = GetTestInstance()
.WithLockFiles();

View file

@ -58,11 +58,11 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
{
new object[] { "1", "", "", "", "" },
new object[] { "2", "netcoreapp1.0", "", "", "" },
new object[] { "3", "", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(), "", "" },
new object[] { "3", "", DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(), "", "" },
new object[] { "4", "", "", "Release", "" },
new object[] { "5", "", "", "", "some/dir"},
new object[] { "6", "", "", "", "some/dir/with spaces" },
new object[] { "7", "netcoreapp1.0", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
new object[] { "7", "netcoreapp1.0", DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
};
}
}
@ -221,7 +221,10 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll");
publishCommand.GetOutputDirectory().Delete(true);
publishCommand = new PublishCommand(lesserTestProject, "netcoreapp1.0", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier());
publishCommand = new PublishCommand(
lesserTestProject,
"netcoreapp1.0",
DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier());
publishCommand.Execute().Should().Pass();
publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");

View file

@ -1,5 +1,15 @@
{
"version": "1.0.0-*",
"buildOptions": {
"copyToOutput": {
"include": [
"../../artifacts/*/stage2/sdk/*/.version"
],
"mappings": {
".version": "../../artifacts/*/stage2/sdk/*/.version"
}
}
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",

View file

@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Cli.Publish3.Tests
.CreateTestInstance(testAppName);
var testProjectDirectory = testInstance.TestRoot;
var rid = RuntimeEnvironment.GetRuntimeIdentifier();
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new Publish3Command()
.WithFramework("netcoreapp1.0")

View file

@ -1,5 +1,15 @@
{
"version": "1.0.0-*",
"buildOptions": {
"copyToOutput": {
"include": [
"../../artifacts/*/stage2/sdk/*/.version"
],
"mappings": {
".version": "../../artifacts/*/stage2/sdk/*/.version"
}
}
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",

View file

@ -1,5 +1,15 @@
{
"version": "1.0.0-*",
"buildOptions": {
"copyToOutput": {
"include": [
"../../artifacts/*/stage2/sdk/*/.version"
],
"mappings": {
".version": "../../artifacts/*/stage2/sdk/*/.version"
}
}
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",

View file

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tests
{
get
{
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
var projectOutputPath = $"AppWithDirectDepDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
return new[]
{
@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tests
{
get
{
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
var projectOutputPath = $"LibraryWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\dotnet-desktop-and-portable.exe";
return new[]
{