Adding an OverrideRid property used in the GetRuntimeInfo task to override the rid of the CLI. This allows us to build for osx.10.11 when building on osx.10.12.
This commit is contained in:
parent
2727b191e3
commit
09d811fdbd
19 changed files with 103 additions and 21 deletions
|
@ -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" />
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
@ -31,5 +32,23 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
return RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers(fallbackIdentifiers);
|
||||
}
|
||||
|
||||
// Gets the identfier that is used for restore by default (this is different from the actual RID, but only on Windows)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,3 +5,9 @@ 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("dotnet-compile.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-publish.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("EndToEnd, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Tools.Tests.Utilities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-publish3.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -196,7 +197,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
TestProject = Path.Combine(TestDirectory, "project.json");
|
||||
OutputDirectory = Path.Combine(TestDirectory, s_outputdirName);
|
||||
|
||||
Rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
Rid = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
}
|
||||
|
||||
private static void SetupStaticTestProject()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace StreamForwarderTests
|
|||
{
|
||||
public class StreamForwarderTests : TestBase
|
||||
{
|
||||
private static readonly string s_rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
private static readonly string s_rid = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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) ?
|
||||
DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier() :
|
||||
_runtime;
|
||||
return Path.Combine(config, framework, runtime, PublishSubfolderName);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -69,7 +69,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 = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
|
||||
fixture.PreCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
|
||||
fixture.PreCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);
|
||||
|
@ -128,7 +128,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 = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var fixture = ScriptVariablesFixture.GetFixtureWithRids(rid);
|
||||
fixture.PostCompileScriptVariables.Should().ContainKey("compile:RuntimeOutputDir");
|
||||
fixture.PostCompileScriptVariables["compile:RuntimeOutputDir"].Should().Be(fixture.RuntimeOutputDir);
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Runtime.CompilerServices;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -54,7 +55,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) ||
|
||||
(DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier().Contains(runtime));
|
||||
|
||||
var testInstance = GetTestInstance()
|
||||
.WithLockFiles();
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
@ -58,11 +59,11 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
{
|
||||
new object[] { "1", "", "", "", "" },
|
||||
new object[] { "2", "netcoreapp1.0", "", "", "" },
|
||||
new object[] { "3", "", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(), "", "" },
|
||||
new object[] { "3", "", DotnetRuntimeIdentifiers.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", DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +222,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",
|
||||
DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier());
|
||||
publishCommand.Execute().Should().Pass();
|
||||
|
||||
publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll");
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
|
@ -12,6 +23,9 @@
|
|||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-350904-49",
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Cli.Publish3.Tests
|
|||
.CreateTestInstance(testAppName);
|
||||
|
||||
var testProjectDirectory = testInstance.TestRoot;
|
||||
var rid = RuntimeEnvironment.GetRuntimeIdentifier();
|
||||
var rid = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
|
||||
new Publish3Command()
|
||||
.WithFramework("netcoreapp1.0")
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"copyToOutput": {
|
||||
"include": [
|
||||
"../../artifacts/*/stage2/sdk/*/.version"
|
||||
],
|
||||
"mappings": {
|
||||
".version": "../../artifacts/*/stage2/sdk/*/.version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tests
|
|||
{
|
||||
get
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var rid = DotnetRuntimeIdentifiers.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 = DotnetRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||
var projectOutputPath = $"LibraryWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\dotnet-desktop-and-portable.exe";
|
||||
return new[]
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue