Merge pull request #4017 from livarcocc/remove_dependency_model
Remove dependency model
This commit is contained in:
commit
a0244b9946
145 changed files with 165 additions and 6278 deletions
|
@ -24,7 +24,9 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.Testin
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel", "src\Microsoft.Extensions.DependencyModel\Microsoft.Extensions.DependencyModel.xproj", "{688870C8-9843-4F9E-8576-D39290AD0F25}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0722D325-24C8-4E83-B5AF-0A083E7F0749}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MultiProjectValidator", "tools\MultiProjectValidator\MultiProjectValidator.xproj", "{08A68C6A-86F6-4ED2-89A7-B166D33E9F85}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EndToEnd", "test\EndToEnd\EndToEnd.xproj", "{65741CB1-8AEE-4C66-8198-10A7EA0E4258}"
|
||||
EndProject
|
||||
|
@ -56,8 +58,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Installer", "Installer", "{
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Msi.Tests", "test\Installer\Microsoft.DotNet.Cli.Msi.Tests\Microsoft.DotNet.Cli.Msi.Tests.xproj", "{0B31C336-149D-471A-B7B1-27B0F1E80F83}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel.Tests", "test\Microsoft.Extensions.DependencyModel.Tests\Microsoft.Extensions.DependencyModel.Tests.xproj", "{4A4711D8-4312-49FC-87B5-4F183F4C6A51}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.TestFramework", "src\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.xproj", "{0724ED7C-56E3-4604-9970-25E600611383}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-test.UnitTests", "test\dotnet-test.UnitTests\dotnet-test.UnitTests.xproj", "{857274AC-E741-4266-A7FD-14DEE0C1CC96}"
|
||||
|
@ -460,22 +460,6 @@ Global
|
|||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
@ -949,7 +933,6 @@ Global
|
|||
{0745410A-6629-47EB-AAB5-08D6288CAD72} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{0E3300A4-DF54-40BF-87D8-E7658330C288} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83} = {0E3300A4-DF54-40BF-87D8-E7658330C288}
|
||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{0724ED7C-56E3-4604-9970-25E600611383} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{857274AC-E741-4266-A7FD-14DEE0C1CC96} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{60C33D0A-A5D8-4AB0-9956-1F804654DF05} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<clear />
|
||||
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
|
||||
<add key="xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
"type": "platform",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyModel": {
|
||||
"target": "project"
|
||||
}
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyModel": {
|
||||
"target": "project"
|
||||
}
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-003395"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24",
|
||||
"Microsoft.NETCore.Platforms": "1.0.1",
|
||||
"xunit": "2.1.0"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"xunit": "2.2.0-beta3-build3330"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
},
|
||||
"System.Linq.Expressions": "4.1.0",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
22
build.proj
22
build.proj
|
@ -55,19 +55,21 @@
|
|||
DependsOnTargets="MSBuildWorkaroundTarget;
|
||||
RestoreDotnetCliBuildFramework">
|
||||
|
||||
<ItemGroup>
|
||||
<DotnetSdkDirectories Include="$([System.IO.Directory]::GetDirectories("$(Stage0Directory)/sdk"))" />
|
||||
<AzureStorageToCopy Include="@(DotnetSdkDirectories)">
|
||||
<Source>$(DotnetCliBuildDirectory)/bin/Microsoft.WindowsAzure.Storage.dll</Source>
|
||||
<Destination>%(Identity)/Microsoft.WindowsAzure.Storage.dll</Destination>
|
||||
</AzureStorageToCopy>
|
||||
</ItemGroup>
|
||||
|
||||
<Exec Command="$(DotnetStage0) publish -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp1.0" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
|
||||
|
||||
<ItemGroup>
|
||||
<DotnetSdkDirectories Include="$([System.IO.Directory]::GetDirectories("$(Stage0Directory)/sdk"))" />
|
||||
<TaskDependenciesDlls Include="$(DotnetCliBuildDirectory)/bin/Microsoft.WindowsAzure.Storage.dll">
|
||||
<Name>Microsoft.WindowsAzure.Storage.dll</Name>
|
||||
</TaskDependenciesDlls>
|
||||
<TaskDependenciesDlls Include="$(DotnetCliBuildDirectory)/bin/Microsoft.DotNet.PlatformAbstractions.dll">
|
||||
<Name>Microsoft.DotNet.PlatformAbstractions.dll</Name>
|
||||
</TaskDependenciesDlls>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- This is a work around to issue https://github.com/Microsoft/msbuild/issues/658 -->
|
||||
<Copy SourceFiles="%(AzureStorageToCopy.Source)"
|
||||
DestinationFiles="%(AzureStorageToCopy.Destination)" />
|
||||
<Copy SourceFiles="%(TaskDependenciesDlls.Identity)"
|
||||
DestinationFolder="@(DotnetSdkDirectories)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreDotnetCliBuildFramework"
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
<ProjectName>Microsoft.DotNet.ProjectModel.Workspaces</ProjectName>
|
||||
<Version>$(SdkNugetVersion)</Version>
|
||||
</ProjectsToPack>
|
||||
<ProjectsToPack Include="$(ProjectsSrcDirectory)/Microsoft.Extensions.DependencyModel">
|
||||
<ProjectName>Microsoft.Extensions.DependencyModel</ProjectName>
|
||||
<Version>$(DependencyModelAndInternalAbstractionsNugetVersion)</Version>
|
||||
</ProjectsToPack>
|
||||
<ProjectsToPack Include="$(ProjectsSrcDirectory)/Microsoft.Extensions.Testing.Abstractions">
|
||||
<ProjectName>Microsoft.Extensions.Testing.Abstractions</ProjectName>
|
||||
<Version>$(SdkNugetVersion)</Version>
|
||||
|
|
|
@ -197,15 +197,6 @@
|
|||
<Clean>False</Clean>
|
||||
<Frameworks>net451;netstandard1.3</Frameworks>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="src/Microsoft.Extensions.DependencyModel">
|
||||
<Name>Microsoft.Extensions.DependencyModel</Name>
|
||||
<IsTool>True</IsTool>
|
||||
<IsApplicable>True</IsApplicable>
|
||||
<VersionPrefix>1.0.1-beta-</VersionPrefix>
|
||||
<VersionSuffix>$(TestPackageBuildVersionSuffix)</VersionSuffix>
|
||||
<Clean>False</Clean>
|
||||
<Frameworks>net451;netstandard1.6</Frameworks>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="src/Microsoft.Extensions.Testing.Abstractions">
|
||||
<Name>Microsoft.Extensions.Testing.Abstractions</Name>
|
||||
<IsTool>True</IsTool>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
{
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"allowUnsafe": true,
|
||||
"compile": [
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/RuntimeEnvironment.cs",
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/Platform.cs",
|
||||
"../../src/Microsoft.DotNet.InternalAbstractions/Native/*.cs"
|
||||
]
|
||||
"allowUnsafe": true
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0",
|
||||
"System.Diagnostics.Process": "4.1.0",
|
||||
"System.Reflection.TypeExtensions": "4.1.0"
|
||||
"System.Reflection.TypeExtensions": "4.1.0",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
"WindowsAzure.Storage": "6.2.2-preview",
|
||||
"NuGet.CommandLine.XPlat": "3.5.0-rc1-1697",
|
||||
"Microsoft.Build.Framework": "0.1.0-preview-00029-160805",
|
||||
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00029-160805"
|
||||
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00029-160805",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
"WindowsAzure.Storage": "6.2.2-preview",
|
||||
"Microsoft.DotNet.Cli.Build.Framework": {
|
||||
"target": "project"
|
||||
}
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// 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 Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Common
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.Cli.Utils.CommandParsing;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914",
|
||||
"NuGet.Versioning": "3.5.0-rc1-1697",
|
||||
"NuGet.Packaging": "3.5.0-rc1-1697",
|
||||
"NuGet.Frameworks": "3.5.0-rc1-1697",
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
"warningsAsErrors": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"NuGet.ProjectModel": "3.5.0-rc1-1697"
|
||||
"NuGet.ProjectModel": "3.5.0-rc1-1697",
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
// 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;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions
|
||||
{
|
||||
public static class ApplicationEnvironment
|
||||
{
|
||||
public static string ApplicationBasePath { get; } = GetApplicationBasePath();
|
||||
|
||||
private static string GetApplicationBasePath()
|
||||
{
|
||||
var basePath =
|
||||
#if NET451
|
||||
(string)AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") ??
|
||||
AppDomain.CurrentDomain.BaseDirectory;
|
||||
#else
|
||||
AppContext.BaseDirectory;
|
||||
#endif
|
||||
return Path.GetFullPath(basePath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
// 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 System.Runtime.CompilerServices;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions
|
||||
{
|
||||
public struct HashCodeCombiner
|
||||
{
|
||||
private long _combinedHash64;
|
||||
|
||||
public int CombinedHash
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return _combinedHash64.GetHashCode(); }
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private HashCodeCombiner(long seed)
|
||||
{
|
||||
_combinedHash64 = seed;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Add(int i)
|
||||
{
|
||||
_combinedHash64 = ((_combinedHash64 << 5) + _combinedHash64) ^ i;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Add(string s)
|
||||
{
|
||||
var hashCode = (s != null) ? s.GetHashCode() : 0;
|
||||
Add(hashCode);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Add(object o)
|
||||
{
|
||||
var hashCode = (o != null) ? o.GetHashCode() : 0;
|
||||
Add(hashCode);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Add<TValue>(TValue value, IEqualityComparer<TValue> comparer)
|
||||
{
|
||||
var hashCode = value != null ? comparer.GetHashCode(value) : 0;
|
||||
Add(hashCode);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static HashCodeCombiner Start()
|
||||
{
|
||||
return new HashCodeCombiner(0x1505L);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
// 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;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions.Native
|
||||
{
|
||||
internal static partial class NativeMethods
|
||||
{
|
||||
public static class Darwin
|
||||
{
|
||||
private const int CTL_KERN = 1;
|
||||
private const int KERN_OSRELEASE = 2;
|
||||
|
||||
public unsafe static string GetKernelRelease()
|
||||
{
|
||||
const uint BUFFER_LENGTH = 32;
|
||||
|
||||
var name = stackalloc int[2];
|
||||
name[0] = CTL_KERN;
|
||||
name[1] = KERN_OSRELEASE;
|
||||
|
||||
var buf = stackalloc byte[(int)BUFFER_LENGTH];
|
||||
var len = stackalloc uint[1];
|
||||
*len = BUFFER_LENGTH;
|
||||
|
||||
try
|
||||
{
|
||||
// If the buffer isn't big enough, it seems sysctl still returns 0 and just sets len to the
|
||||
// necessary buffer size. This appears to be contrary to the man page, but it's easy to detect
|
||||
// by simply checking len against the buffer length.
|
||||
if (sysctl(name, 2, buf, len, IntPtr.Zero, 0) == 0 && *len < BUFFER_LENGTH)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi((IntPtr)buf, (int)*len);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new PlatformNotSupportedException("Error reading Darwin Kernel Version", ex);
|
||||
}
|
||||
throw new PlatformNotSupportedException("Unknown error reading Darwin Kernel Version");
|
||||
}
|
||||
|
||||
[DllImport("libc")]
|
||||
private unsafe static extern int sysctl(
|
||||
int* name,
|
||||
uint namelen,
|
||||
byte* oldp,
|
||||
uint* oldlenp,
|
||||
IntPtr newp,
|
||||
uint newlen);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// 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.
|
||||
|
||||
#if NET451
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions.Native
|
||||
{
|
||||
internal static partial class NativeMethods
|
||||
{
|
||||
public static class Unix
|
||||
{
|
||||
public unsafe static string GetUname()
|
||||
{
|
||||
// Utsname shouldn't be larger than 2K
|
||||
var buf = stackalloc byte[2048];
|
||||
|
||||
try
|
||||
{
|
||||
if (uname((IntPtr)buf) == 0)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi((IntPtr)buf);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new PlatformNotSupportedException("Error reading Unix name", ex);
|
||||
}
|
||||
throw new PlatformNotSupportedException("Unknown error reading Unix name");
|
||||
}
|
||||
|
||||
[DllImport("libc")]
|
||||
private static extern int uname(IntPtr utsname);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,43 +0,0 @@
|
|||
// 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.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions.Native
|
||||
{
|
||||
internal static partial class NativeMethods
|
||||
{
|
||||
public static class Windows
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct RTL_OSVERSIONINFOEX
|
||||
{
|
||||
internal uint dwOSVersionInfoSize;
|
||||
internal uint dwMajorVersion;
|
||||
internal uint dwMinorVersion;
|
||||
internal uint dwBuildNumber;
|
||||
internal uint dwPlatformId;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||
internal string szCSDVersion;
|
||||
}
|
||||
|
||||
// This call avoids the shimming Windows does to report old versions
|
||||
[DllImport("ntdll")]
|
||||
private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation);
|
||||
|
||||
internal static string RtlGetVersion()
|
||||
{
|
||||
RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX();
|
||||
osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi);
|
||||
if (RtlGetVersion(out osvi) == 0)
|
||||
{
|
||||
return $"{osvi.dwMajorVersion}.{osvi.dwMinorVersion}.{osvi.dwBuildNumber}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
// 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;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions.Native
|
||||
{
|
||||
internal static class PlatformApis
|
||||
{
|
||||
private class DistroInfo
|
||||
{
|
||||
public string Id;
|
||||
public string VersionId;
|
||||
}
|
||||
|
||||
private static readonly Lazy<Platform> _platform = new Lazy<Platform>(DetermineOSPlatform);
|
||||
private static readonly Lazy<DistroInfo> _distroInfo = new Lazy<DistroInfo>(LoadDistroInfo);
|
||||
|
||||
public static string GetOSName()
|
||||
{
|
||||
switch (GetOSPlatform())
|
||||
{
|
||||
case Platform.Windows:
|
||||
return "Windows";
|
||||
case Platform.Linux:
|
||||
return GetDistroId() ?? "Linux";
|
||||
case Platform.Darwin:
|
||||
return "Mac OS X";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetOSVersion()
|
||||
{
|
||||
switch (GetOSPlatform())
|
||||
{
|
||||
case Platform.Windows:
|
||||
return NativeMethods.Windows.RtlGetVersion() ?? string.Empty;
|
||||
case Platform.Linux:
|
||||
return GetDistroVersionId() ?? string.Empty;
|
||||
case Platform.Darwin:
|
||||
return GetDarwinVersion() ?? string.Empty;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetDarwinVersion()
|
||||
{
|
||||
Version version;
|
||||
var kernelRelease = NativeMethods.Darwin.GetKernelRelease();
|
||||
if (!Version.TryParse(kernelRelease, out version) || version.Major < 5)
|
||||
{
|
||||
// 10.0 covers all versions prior to Darwin 5
|
||||
// Similarly, if the version is not a valid version number, but we have still detected that it is Darwin, we just assume
|
||||
// it is OS X 10.0
|
||||
return "10.0";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mac OS X 10.1 mapped to Darwin 5.x, and the mapping continues that way
|
||||
// So just subtract 4 from the Darwin version.
|
||||
// https://en.wikipedia.org/wiki/Darwin_%28operating_system%29
|
||||
return $"10.{version.Major - 4}";
|
||||
}
|
||||
}
|
||||
|
||||
public static Platform GetOSPlatform()
|
||||
{
|
||||
return _platform.Value;
|
||||
}
|
||||
|
||||
private static string GetDistroId()
|
||||
{
|
||||
return _distroInfo.Value?.Id;
|
||||
}
|
||||
|
||||
private static string GetDistroVersionId()
|
||||
{
|
||||
return _distroInfo.Value?.VersionId;
|
||||
}
|
||||
|
||||
private static DistroInfo LoadDistroInfo()
|
||||
{
|
||||
// Sample os-release file:
|
||||
// NAME="Ubuntu"
|
||||
// VERSION = "14.04.3 LTS, Trusty Tahr"
|
||||
// ID = ubuntu
|
||||
// ID_LIKE = debian
|
||||
// PRETTY_NAME = "Ubuntu 14.04.3 LTS"
|
||||
// VERSION_ID = "14.04"
|
||||
// HOME_URL = "http://www.ubuntu.com/"
|
||||
// SUPPORT_URL = "http://help.ubuntu.com/"
|
||||
// BUG_REPORT_URL = "http://bugs.launchpad.net/ubuntu/"
|
||||
// We use ID and VERSION_ID
|
||||
|
||||
if (File.Exists("/etc/os-release"))
|
||||
{
|
||||
var lines = File.ReadAllLines("/etc/os-release");
|
||||
var result = new DistroInfo();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.StartsWith("ID=", StringComparison.Ordinal))
|
||||
{
|
||||
result.Id = line.Substring(3).Trim('"', '\'');
|
||||
}
|
||||
else if (line.StartsWith("VERSION_ID=", StringComparison.Ordinal))
|
||||
{
|
||||
result.VersionId = line.Substring(11).Trim('"', '\'');
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// I could probably have just done one method signature and put the #if inside the body but the implementations
|
||||
// are just completely different so I wanted to make that clear by putting the whole thing inside the #if.
|
||||
#if NET451
|
||||
private static Platform DetermineOSPlatform()
|
||||
{
|
||||
var platform = (int)Environment.OSVersion.Platform;
|
||||
var isWindows = (platform != 4) && (platform != 6) && (platform != 128);
|
||||
|
||||
if (isWindows)
|
||||
{
|
||||
return Platform.Windows;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var uname = NativeMethods.Unix.GetUname();
|
||||
if (string.Equals(uname, "Darwin", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Platform.Darwin;
|
||||
}
|
||||
if (string.Equals(uname, "Linux", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Platform.Linux;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return Platform.Unknown;
|
||||
}
|
||||
}
|
||||
#else
|
||||
private static Platform DetermineOSPlatform()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return Platform.Windows;
|
||||
}
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
return Platform.Linux;
|
||||
}
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
return Platform.Darwin;
|
||||
}
|
||||
return Platform.Unknown;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions
|
||||
{
|
||||
public enum Platform
|
||||
{
|
||||
Unknown = 0,
|
||||
Windows = 1,
|
||||
Linux = 2,
|
||||
Darwin = 3
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
// 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;
|
||||
using Microsoft.DotNet.InternalAbstractions.Native;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions
|
||||
{
|
||||
public static class RuntimeEnvironment
|
||||
{
|
||||
private static readonly string OverrideEnvironmentVariableName = "DOTNET_RUNTIME_ID";
|
||||
|
||||
public static Platform OperatingSystemPlatform { get; } = PlatformApis.GetOSPlatform();
|
||||
|
||||
public static string OperatingSystemVersion { get; } = PlatformApis.GetOSVersion();
|
||||
|
||||
public static string OperatingSystem { get; } = PlatformApis.GetOSName();
|
||||
|
||||
public static string RuntimeArchitecture { get; } = GetArch();
|
||||
|
||||
private static string GetArch()
|
||||
{
|
||||
#if NET451
|
||||
return Environment.Is64BitProcess ? "x64" : "x86";
|
||||
#else
|
||||
return IntPtr.Size == 8 ? "x64" : "x86";
|
||||
#endif
|
||||
}
|
||||
|
||||
public static string GetRuntimeIdentifier()
|
||||
{
|
||||
return
|
||||
Environment.GetEnvironmentVariable(OverrideEnvironmentVariableName) ??
|
||||
(GetRIDOS() + GetRIDVersion() + GetRIDArch());
|
||||
}
|
||||
|
||||
private static string GetRIDArch()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(RuntimeArchitecture))
|
||||
{
|
||||
return $"-{RuntimeArchitecture.ToLowerInvariant()}";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string GetRIDVersion()
|
||||
{
|
||||
// Windows RIDs do not separate OS name and version by "." due to legacy
|
||||
// Others do, that's why we have the "." prefix on them below
|
||||
switch (OperatingSystemPlatform)
|
||||
{
|
||||
case Platform.Windows:
|
||||
return GetWindowsProductVersion();
|
||||
case Platform.Linux:
|
||||
return $".{OperatingSystemVersion}";
|
||||
case Platform.Darwin:
|
||||
return $".{OperatingSystemVersion}";
|
||||
default:
|
||||
return string.Empty; // Unknown Platform? Unknown Version!
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetWindowsProductVersion()
|
||||
{
|
||||
var ver = Version.Parse(OperatingSystemVersion);
|
||||
if (ver.Major == 6)
|
||||
{
|
||||
if (ver.Minor == 1)
|
||||
{
|
||||
return "7";
|
||||
}
|
||||
else if (ver.Minor == 2)
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
else if (ver.Minor == 3)
|
||||
{
|
||||
return "81";
|
||||
}
|
||||
}
|
||||
else if (ver.Major == 10 && ver.Minor == 0)
|
||||
{
|
||||
// Not sure if there will be 10.x (where x > 0) or even 11, so let's be defensive.
|
||||
return "10";
|
||||
}
|
||||
return string.Empty; // Unknown version
|
||||
}
|
||||
|
||||
private static string GetRIDOS()
|
||||
{
|
||||
switch (OperatingSystemPlatform)
|
||||
{
|
||||
case Platform.Windows:
|
||||
return "win";
|
||||
case Platform.Linux:
|
||||
return OperatingSystem.ToLowerInvariant();
|
||||
case Platform.Darwin:
|
||||
return "osx";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"description": "Abstractions for making code that uses file system and environment testable.",
|
||||
"version": "1.0.1-beta-*",
|
||||
"version": "2.0.0-beta-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
|
|
|
@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.CSharp;
|
|||
using Microsoft.CodeAnalysis.Host.Mef;
|
||||
using Microsoft.CodeAnalysis.Text;
|
||||
using Microsoft.DotNet.Cli.Compiler.Common;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.DotNet.ProjectModel.Files;
|
||||
using NuGet.Frameworks;
|
||||
|
@ -227,7 +227,7 @@ namespace Microsoft.DotNet.ProjectModel.Workspaces
|
|||
{
|
||||
keyFile = Path.GetFullPath(Path.Combine(projectDirectory, compilerOptions.KeyFile));
|
||||
|
||||
if (RuntimeEnvironment.OperatingSystemPlatform != InternalAbstractions.Platform.Windows || useOssSigning)
|
||||
if (RuntimeEnvironment.OperatingSystemPlatform != PlatformAbstractions.Platform.Windows || useOssSigning)
|
||||
{
|
||||
return options.WithCryptoPublicKey(
|
||||
SnkUtils.ExtractPublicKey(File.ReadAllBytes(keyFile)));
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"Microsoft.DotNet.Compiler.Common": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp.Workspaces": "1.3.0"
|
||||
"Microsoft.CodeAnalysis.CSharp.Workspaces": "1.3.0",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
@ -5,7 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.FileSystemGlobbing
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Files
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Graph
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Graph
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
using NuGet.Common;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// 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 Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||
using Microsoft.Extensions.DependencyModel.Resolution;
|
||||
using NuGet.Frameworks;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.InternalAbstractions
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Utilities
|
||||
{
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
},
|
||||
"description": "Types to model a .NET Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914",
|
||||
"Newtonsoft.Json": "9.0.1",
|
||||
"NuGet.Configuration": "3.5.0-rc1-1697",
|
||||
"NuGet.Packaging": "3.5.0-rc1-1697",
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
using Microsoft.Extensions.DependencyModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace System.Collections.Generic
|
||||
{
|
||||
public static class CollectionExtensions
|
||||
{
|
||||
public static RuntimeAssetGroup GetDefaultGroup(this IEnumerable<RuntimeAssetGroup> self) => GetGroup(self, string.Empty);
|
||||
public static RuntimeAssetGroup GetRuntimeGroup(this IEnumerable<RuntimeAssetGroup> self, string runtime)
|
||||
{
|
||||
if(string.IsNullOrEmpty(runtime))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtime));
|
||||
}
|
||||
return GetGroup(self, runtime);
|
||||
}
|
||||
|
||||
private static RuntimeAssetGroup GetGroup(IEnumerable<RuntimeAssetGroup> groups, string runtime)
|
||||
{
|
||||
return groups.FirstOrDefault(g => g.Runtime == runtime);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetDefaultAssets(this IEnumerable<RuntimeAssetGroup> self) => GetAssets(self, string.Empty);
|
||||
public static IEnumerable<string> GetRuntimeAssets(this IEnumerable<RuntimeAssetGroup> self, string runtime)
|
||||
{
|
||||
if(string.IsNullOrEmpty(runtime))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtime));
|
||||
}
|
||||
return GetAssets(self, runtime);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetAssets(IEnumerable<RuntimeAssetGroup> groups, string runtime)
|
||||
{
|
||||
return groups
|
||||
.Where(a => string.Equals(a.Runtime, runtime, StringComparison.Ordinal))
|
||||
.SelectMany(a => a.AssetPaths);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyModel.Resolution;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class CompilationLibrary : Library
|
||||
{
|
||||
public CompilationLibrary(string type,
|
||||
string name,
|
||||
string version,
|
||||
string hash,
|
||||
IEnumerable<string> assemblies,
|
||||
IEnumerable<Dependency> dependencies,
|
||||
bool serviceable)
|
||||
: base(type, name, version, hash, dependencies, serviceable)
|
||||
{
|
||||
if (assemblies == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(assemblies));
|
||||
}
|
||||
Assemblies = assemblies.ToArray();
|
||||
}
|
||||
|
||||
public IReadOnlyList<string> Assemblies { get; }
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
internal static ICompilationAssemblyResolver DefaultResolver { get; } = new CompositeCompilationAssemblyResolver(new ICompilationAssemblyResolver[]
|
||||
{
|
||||
new PackageCacheCompilationAssemblyResolver(),
|
||||
new AppBaseCompilationAssemblyResolver(),
|
||||
new ReferenceAssemblyPathResolver(),
|
||||
new PackageCompilationAssemblyResolver()
|
||||
});
|
||||
|
||||
public IEnumerable<string> ResolveReferencePaths()
|
||||
{
|
||||
var assemblies = new List<string>();
|
||||
if (!DefaultResolver.TryResolveAssemblyPaths(this, assemblies))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find compilation library location for package '{Name}'");
|
||||
}
|
||||
return assemblies;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class CompilationOptions
|
||||
{
|
||||
public IReadOnlyList<string> Defines { get; }
|
||||
|
||||
public string LanguageVersion { get; }
|
||||
|
||||
public string Platform { get; }
|
||||
|
||||
public bool? AllowUnsafe { get; }
|
||||
|
||||
public bool? WarningsAsErrors { get; }
|
||||
|
||||
public bool? Optimize { get; }
|
||||
|
||||
public string KeyFile { get; }
|
||||
|
||||
public bool? DelaySign { get; }
|
||||
|
||||
public bool? PublicSign { get; }
|
||||
|
||||
public string DebugType { get; }
|
||||
|
||||
public bool? EmitEntryPoint { get; }
|
||||
|
||||
public bool? GenerateXmlDocumentation { get; }
|
||||
|
||||
public static CompilationOptions Default { get; } = new CompilationOptions(
|
||||
defines: Enumerable.Empty<string>(),
|
||||
languageVersion: null,
|
||||
platform: null,
|
||||
allowUnsafe: null,
|
||||
warningsAsErrors: null,
|
||||
optimize: null,
|
||||
keyFile: null,
|
||||
delaySign: null,
|
||||
publicSign: null,
|
||||
debugType: null,
|
||||
emitEntryPoint: null,
|
||||
generateXmlDocumentation: null);
|
||||
|
||||
public CompilationOptions(IEnumerable<string> defines,
|
||||
string languageVersion,
|
||||
string platform,
|
||||
bool? allowUnsafe,
|
||||
bool? warningsAsErrors,
|
||||
bool? optimize,
|
||||
string keyFile,
|
||||
bool? delaySign,
|
||||
bool? publicSign,
|
||||
string debugType,
|
||||
bool? emitEntryPoint,
|
||||
bool? generateXmlDocumentation)
|
||||
{
|
||||
if (defines == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(defines));
|
||||
}
|
||||
Defines = defines.ToArray();
|
||||
LanguageVersion = languageVersion;
|
||||
Platform = platform;
|
||||
AllowUnsafe = allowUnsafe;
|
||||
WarningsAsErrors = warningsAsErrors;
|
||||
Optimize = optimize;
|
||||
KeyFile = keyFile;
|
||||
DelaySign = delaySign;
|
||||
PublicSign = publicSign;
|
||||
DebugType = debugType;
|
||||
EmitEntryPoint = emitEntryPoint;
|
||||
GenerateXmlDocumentation = generateXmlDocumentation;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
// 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;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public struct Dependency
|
||||
{
|
||||
public Dependency(string name, string version)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentException(nameof(name));
|
||||
}
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
throw new ArgumentException(nameof(version));
|
||||
}
|
||||
Name = name;
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public string Version { get; }
|
||||
|
||||
public bool Equals(Dependency other)
|
||||
{
|
||||
return string.Equals(Name, other.Name) && string.Equals(Version, other.Version);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is Dependency && Equals((Dependency) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var combiner = HashCodeCombiner.Start();
|
||||
combiner.Add(Name);
|
||||
combiner.Add(Version);
|
||||
return combiner.CombinedHash;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class DependencyContext
|
||||
{
|
||||
#if !NETSTANDARD1_3
|
||||
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||
#endif
|
||||
|
||||
public DependencyContext(TargetInfo target,
|
||||
CompilationOptions compilationOptions,
|
||||
IEnumerable<CompilationLibrary> compileLibraries,
|
||||
IEnumerable<RuntimeLibrary> runtimeLibraries,
|
||||
IEnumerable<RuntimeFallbacks> runtimeGraph)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(target));
|
||||
}
|
||||
if (compilationOptions == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(compilationOptions));
|
||||
}
|
||||
if (compileLibraries == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(compileLibraries));
|
||||
}
|
||||
if (runtimeLibraries == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeLibraries));
|
||||
}
|
||||
if (runtimeGraph == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeGraph));
|
||||
}
|
||||
|
||||
Target = target;
|
||||
CompilationOptions = compilationOptions;
|
||||
CompileLibraries = compileLibraries.ToArray();
|
||||
RuntimeLibraries = runtimeLibraries.ToArray();
|
||||
RuntimeGraph = runtimeGraph.ToArray();
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
public static DependencyContext Default => _defaultContext.Value;
|
||||
#endif
|
||||
|
||||
public TargetInfo Target { get; }
|
||||
|
||||
public CompilationOptions CompilationOptions { get; }
|
||||
|
||||
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
|
||||
|
||||
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
|
||||
|
||||
public IReadOnlyList<RuntimeFallbacks> RuntimeGraph { get; }
|
||||
|
||||
public DependencyContext Merge(DependencyContext other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(other));
|
||||
}
|
||||
|
||||
return new DependencyContext(
|
||||
Target,
|
||||
CompilationOptions,
|
||||
CompileLibraries.Union(other.CompileLibraries, new LibraryMergeEqualityComparer<CompilationLibrary>()),
|
||||
RuntimeLibraries.Union(other.RuntimeLibraries, new LibraryMergeEqualityComparer<RuntimeLibrary>()),
|
||||
RuntimeGraph.Union(other.RuntimeGraph)
|
||||
);
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
private static DependencyContext LoadDefault()
|
||||
{
|
||||
return DependencyContextLoader.Default.Load(Assembly.GetEntryAssembly());
|
||||
}
|
||||
|
||||
public static DependencyContext Load(Assembly assembly)
|
||||
{
|
||||
return DependencyContextLoader.Default.Load(assembly);
|
||||
}
|
||||
#endif
|
||||
|
||||
private class LibraryMergeEqualityComparer<T> : IEqualityComparer<T> where T : Library
|
||||
{
|
||||
public bool Equals(T x, T y)
|
||||
{
|
||||
return StringComparer.OrdinalIgnoreCase.Equals(x.Name, y.Name);
|
||||
}
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public static class DependencyContextExtensions
|
||||
{
|
||||
private const string NativeImageSufix = ".ni";
|
||||
|
||||
public static IEnumerable<string> GetDefaultNativeAssets(this DependencyContext self)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
return self.RuntimeLibraries.SelectMany(library => library.GetDefaultNativeAssets(self));
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetRuntimeNativeAssets(this DependencyContext self, string runtimeIdentifier)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
if (runtimeIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeIdentifier));
|
||||
}
|
||||
return self.RuntimeLibraries.SelectMany(library => library.GetRuntimeNativeAssets(self, runtimeIdentifier));
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetDefaultNativeAssets(this RuntimeLibrary self, DependencyContext context)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
return ResolveAssets(context, string.Empty, self.NativeLibraryGroups);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetRuntimeNativeAssets(this RuntimeLibrary self, DependencyContext context, string runtimeIdentifier)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
if (runtimeIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeIdentifier));
|
||||
}
|
||||
return ResolveAssets(context, runtimeIdentifier, self.NativeLibraryGroups);
|
||||
}
|
||||
|
||||
public static IEnumerable<AssemblyName> GetDefaultAssemblyNames(this DependencyContext self)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
return self.RuntimeLibraries.SelectMany(library => library.GetDefaultAssemblyNames(self));
|
||||
}
|
||||
|
||||
public static IEnumerable<AssemblyName> GetRuntimeAssemblyNames(this DependencyContext self, string runtimeIdentifier)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
if (runtimeIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeIdentifier));
|
||||
}
|
||||
return self.RuntimeLibraries.SelectMany(library => library.GetRuntimeAssemblyNames(self, runtimeIdentifier));
|
||||
}
|
||||
|
||||
public static IEnumerable<AssemblyName> GetDefaultAssemblyNames(this RuntimeLibrary self, DependencyContext context)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
return ResolveAssets(context, string.Empty, self.RuntimeAssemblyGroups).Select(GetAssemblyName);
|
||||
}
|
||||
|
||||
public static IEnumerable<AssemblyName> GetRuntimeAssemblyNames(this RuntimeLibrary self, DependencyContext context, string runtimeIdentifier)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(self));
|
||||
}
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
if (runtimeIdentifier == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeIdentifier));
|
||||
}
|
||||
return ResolveAssets(context, runtimeIdentifier, self.RuntimeAssemblyGroups).Select(GetAssemblyName);
|
||||
}
|
||||
|
||||
private static AssemblyName GetAssemblyName(string assetPath)
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(assetPath);
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentException($"Provided path has empty file name '{assetPath}'", nameof(assetPath));
|
||||
}
|
||||
|
||||
if (name.EndsWith(NativeImageSufix))
|
||||
{
|
||||
name = name.Substring(0, name.Length - NativeImageSufix.Length);
|
||||
}
|
||||
|
||||
return new AssemblyName(name);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> ResolveAssets(
|
||||
DependencyContext context,
|
||||
string runtimeIdentifier,
|
||||
IEnumerable<RuntimeAssetGroup> assets)
|
||||
{
|
||||
var fallbacks = context.RuntimeGraph.FirstOrDefault(f => f.Runtime == runtimeIdentifier);
|
||||
var rids = Enumerable.Concat(new[] { runtimeIdentifier }, fallbacks?.Fallbacks ?? Enumerable.Empty<string>());
|
||||
return SelectAssets(rids, assets);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> SelectAssets(IEnumerable<string> rids, IEnumerable<RuntimeAssetGroup> groups)
|
||||
{
|
||||
foreach (var rid in rids)
|
||||
{
|
||||
var group = groups.FirstOrDefault(g => g.Runtime == rid);
|
||||
if (group != null)
|
||||
{
|
||||
return group.AssetPaths;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the RID-agnostic group
|
||||
return groups.GetDefaultAssets();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,704 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class DependencyContextJsonReader : IDependencyContextReader
|
||||
{
|
||||
private readonly IDictionary<string, string> _stringPool = new Dictionary<string, string>();
|
||||
|
||||
public DependencyContext Read(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
}
|
||||
|
||||
using (var streamReader = new StreamReader(stream))
|
||||
{
|
||||
using (var reader = new JsonTextReader(streamReader))
|
||||
{
|
||||
return Read(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_stringPool.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
private DependencyContext Read(JsonTextReader reader)
|
||||
{
|
||||
var runtime = string.Empty;
|
||||
var framework = string.Empty;
|
||||
var isPortable = true;
|
||||
string runtimeTargetName = null;
|
||||
string runtimeSignature = null;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
CompilationOptions compilationOptions = null;
|
||||
List<Target> targets = null;
|
||||
Dictionary<string, LibraryStub> libraryStubs = null;
|
||||
List<RuntimeFallbacks> runtimeFallbacks = null;
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
switch ((string)reader.Value)
|
||||
{
|
||||
case DependencyContextStrings.RuntimeTargetPropertyName:
|
||||
ReadRuntimeTarget(reader, out runtimeTargetName, out runtimeSignature);
|
||||
break;
|
||||
case DependencyContextStrings.CompilationOptionsPropertName:
|
||||
compilationOptions = ReadCompilationOptions(reader);
|
||||
break;
|
||||
case DependencyContextStrings.TargetsPropertyName:
|
||||
targets = ReadTargets(reader);
|
||||
break;
|
||||
case DependencyContextStrings.LibrariesPropertyName:
|
||||
libraryStubs = ReadLibraries(reader);
|
||||
break;
|
||||
case DependencyContextStrings.RuntimesPropertyName:
|
||||
runtimeFallbacks = ReadRuntimes(reader);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (compilationOptions == null)
|
||||
{
|
||||
compilationOptions = CompilationOptions.Default;
|
||||
}
|
||||
|
||||
Target runtimeTarget = SelectRuntimeTarget(targets, runtimeTargetName);
|
||||
runtimeTargetName = runtimeTarget?.Name;
|
||||
|
||||
if (runtimeTargetName != null)
|
||||
{
|
||||
var seperatorIndex = runtimeTargetName.IndexOf(DependencyContextStrings.VersionSeperator);
|
||||
if (seperatorIndex > -1 && seperatorIndex < runtimeTargetName.Length)
|
||||
{
|
||||
runtime = runtimeTargetName.Substring(seperatorIndex + 1);
|
||||
framework = runtimeTargetName.Substring(0, seperatorIndex);
|
||||
isPortable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
framework = runtimeTargetName;
|
||||
}
|
||||
}
|
||||
|
||||
Target compileTarget = null;
|
||||
|
||||
var ridlessTarget = targets.FirstOrDefault(t => !IsRuntimeTarget(t.Name));
|
||||
if (ridlessTarget != null)
|
||||
{
|
||||
compileTarget = ridlessTarget;
|
||||
if (runtimeTarget == null)
|
||||
{
|
||||
runtimeTarget = compileTarget;
|
||||
framework = ridlessTarget.Name;
|
||||
}
|
||||
}
|
||||
|
||||
if (runtimeTarget == null)
|
||||
{
|
||||
throw new FormatException("No runtime target found");
|
||||
}
|
||||
|
||||
return new DependencyContext(
|
||||
new TargetInfo(framework, runtime, runtimeSignature, isPortable),
|
||||
compilationOptions,
|
||||
CreateLibraries(compileTarget?.Libraries, false, libraryStubs).Cast<CompilationLibrary>().ToArray(),
|
||||
CreateLibraries(runtimeTarget.Libraries, true, libraryStubs).Cast<RuntimeLibrary>().ToArray(),
|
||||
runtimeFallbacks ?? Enumerable.Empty<RuntimeFallbacks>());
|
||||
}
|
||||
|
||||
private Target SelectRuntimeTarget(List<Target> targets, string runtimeTargetName)
|
||||
{
|
||||
Target target;
|
||||
|
||||
if (targets == null || targets.Count == 0)
|
||||
{
|
||||
throw new FormatException("Dependency file does not have 'targets' section");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(runtimeTargetName))
|
||||
{
|
||||
target = targets.FirstOrDefault(t => t.Name == runtimeTargetName);
|
||||
if (target == null)
|
||||
{
|
||||
throw new FormatException($"Target with name {runtimeTargetName} not found");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target = targets.FirstOrDefault(t => IsRuntimeTarget(t.Name));
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
private bool IsRuntimeTarget(string name)
|
||||
{
|
||||
return name.Contains(DependencyContextStrings.VersionSeperator);
|
||||
}
|
||||
|
||||
private void ReadRuntimeTarget(JsonTextReader reader, out string runtimeTargetName, out string runtimeSignature)
|
||||
{
|
||||
runtimeTargetName = null;
|
||||
runtimeSignature = null;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
string propertyName;
|
||||
string propertyValue;
|
||||
while (reader.TryReadStringProperty(out propertyName, out propertyValue))
|
||||
{
|
||||
switch (propertyName)
|
||||
{
|
||||
case DependencyContextStrings.RuntimeTargetNamePropertyName:
|
||||
runtimeTargetName = propertyValue;
|
||||
break;
|
||||
case DependencyContextStrings.RuntimeTargetSignaturePropertyName:
|
||||
runtimeSignature = propertyValue;
|
||||
break;
|
||||
default:
|
||||
throw new FormatException($"Unknown property name '{propertyName}'");
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
}
|
||||
|
||||
private CompilationOptions ReadCompilationOptions(JsonTextReader reader)
|
||||
{
|
||||
IEnumerable<string> defines = null;
|
||||
string languageVersion = null;
|
||||
string platform = null;
|
||||
bool? allowUnsafe = null;
|
||||
bool? warningsAsErrors = null;
|
||||
bool? optimize = null;
|
||||
string keyFile = null;
|
||||
bool? delaySign = null;
|
||||
bool? publicSign = null;
|
||||
string debugType = null;
|
||||
bool? emitEntryPoint = null;
|
||||
bool? generateXmlDocumentation = null;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
switch ((string)reader.Value)
|
||||
{
|
||||
case DependencyContextStrings.DefinesPropertyName:
|
||||
defines = reader.ReadStringArray();
|
||||
break;
|
||||
case DependencyContextStrings.LanguageVersionPropertyName:
|
||||
languageVersion = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.PlatformPropertyName:
|
||||
platform = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.AllowUnsafePropertyName:
|
||||
allowUnsafe = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.WarningsAsErrorsPropertyName:
|
||||
warningsAsErrors = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.OptimizePropertyName:
|
||||
optimize = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.KeyFilePropertyName:
|
||||
keyFile = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.DelaySignPropertyName:
|
||||
delaySign = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.PublicSignPropertyName:
|
||||
publicSign = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.DebugTypePropertyName:
|
||||
debugType = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.EmitEntryPointPropertyName:
|
||||
emitEntryPoint = reader.ReadAsBoolean();
|
||||
break;
|
||||
case DependencyContextStrings.GenerateXmlDocumentationPropertyName:
|
||||
generateXmlDocumentation = reader.ReadAsBoolean();
|
||||
break;
|
||||
default:
|
||||
throw new FormatException($"Unknown property name '{reader.Value}'");
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return new CompilationOptions(
|
||||
defines ?? Enumerable.Empty<string>(),
|
||||
languageVersion,
|
||||
platform,
|
||||
allowUnsafe,
|
||||
warningsAsErrors,
|
||||
optimize,
|
||||
keyFile,
|
||||
delaySign,
|
||||
publicSign,
|
||||
debugType,
|
||||
emitEntryPoint,
|
||||
generateXmlDocumentation);
|
||||
}
|
||||
|
||||
private List<Target> ReadTargets(JsonTextReader reader)
|
||||
{
|
||||
reader.ReadStartObject();
|
||||
|
||||
var targets = new List<Target>();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
targets.Add(ReadTarget(reader, (string)reader.Value));
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return targets;
|
||||
}
|
||||
|
||||
private Target ReadTarget(JsonTextReader reader, string targetName)
|
||||
{
|
||||
reader.ReadStartObject();
|
||||
|
||||
var libraries = new List<TargetLibrary>();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
libraries.Add(ReadTargetLibrary(reader, (string)reader.Value));
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return new Target()
|
||||
{
|
||||
Name = targetName,
|
||||
Libraries = libraries
|
||||
};
|
||||
}
|
||||
|
||||
private TargetLibrary ReadTargetLibrary(JsonTextReader reader, string targetLibraryName)
|
||||
{
|
||||
IEnumerable<Dependency> dependencies = null;
|
||||
List<string> runtimes = null;
|
||||
List<string> natives = null;
|
||||
List<string> compilations = null;
|
||||
List<RuntimeTargetEntryStub> runtimeTargets = null;
|
||||
List<ResourceAssembly> resources = null;
|
||||
bool? compileOnly = null;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
switch ((string)reader.Value)
|
||||
{
|
||||
case DependencyContextStrings.DependenciesPropertyName:
|
||||
dependencies = ReadTargetLibraryDependencies(reader);
|
||||
break;
|
||||
case DependencyContextStrings.RuntimeAssembliesKey:
|
||||
runtimes = ReadPropertyNames(reader);
|
||||
break;
|
||||
case DependencyContextStrings.NativeLibrariesKey:
|
||||
natives = ReadPropertyNames(reader);
|
||||
break;
|
||||
case DependencyContextStrings.CompileTimeAssembliesKey:
|
||||
compilations = ReadPropertyNames(reader);
|
||||
break;
|
||||
case DependencyContextStrings.RuntimeTargetsPropertyName:
|
||||
runtimeTargets = ReadTargetLibraryRuntimeTargets(reader);
|
||||
break;
|
||||
case DependencyContextStrings.ResourceAssembliesPropertyName:
|
||||
resources = ReadTargetLibraryResources(reader);
|
||||
break;
|
||||
case DependencyContextStrings.CompilationOnlyPropertyName:
|
||||
compileOnly = reader.ReadAsBoolean();
|
||||
break;
|
||||
default:
|
||||
throw new FormatException($"Unknown property name '{reader.Value}'");
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return new TargetLibrary()
|
||||
{
|
||||
Name = targetLibraryName,
|
||||
Dependencies = dependencies ?? Enumerable.Empty<Dependency>(),
|
||||
Runtimes = runtimes,
|
||||
Natives = natives,
|
||||
Compilations = compilations,
|
||||
RuntimeTargets = runtimeTargets,
|
||||
Resources = resources,
|
||||
CompileOnly = compileOnly
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IEnumerable<Dependency> ReadTargetLibraryDependencies(JsonTextReader reader)
|
||||
{
|
||||
var dependencies = new List<Dependency>();
|
||||
string name;
|
||||
string version;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.TryReadStringProperty(out name, out version))
|
||||
{
|
||||
dependencies.Add(new Dependency(Pool(name), Pool(version)));
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
private List<string> ReadPropertyNames(JsonTextReader reader)
|
||||
{
|
||||
var runtimes = new List<string>();
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var libraryName = (string)reader.Value;
|
||||
reader.Skip();
|
||||
|
||||
runtimes.Add(libraryName);
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return runtimes;
|
||||
}
|
||||
|
||||
private List<RuntimeTargetEntryStub> ReadTargetLibraryRuntimeTargets(JsonTextReader reader)
|
||||
{
|
||||
var runtimeTargets = new List<RuntimeTargetEntryStub>();
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var runtimeTarget = new RuntimeTargetEntryStub();
|
||||
runtimeTarget.Path = (string)reader.Value;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
string propertyName;
|
||||
string propertyValue;
|
||||
while (reader.TryReadStringProperty(out propertyName, out propertyValue))
|
||||
{
|
||||
switch (propertyName)
|
||||
{
|
||||
case DependencyContextStrings.RidPropertyName:
|
||||
runtimeTarget.Rid = Pool(propertyValue);
|
||||
break;
|
||||
case DependencyContextStrings.AssetTypePropertyName:
|
||||
runtimeTarget.Type = Pool(propertyValue);
|
||||
break;
|
||||
default:
|
||||
throw new FormatException($"Unknown property name '{propertyName}'");
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
runtimeTargets.Add(runtimeTarget);
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return runtimeTargets;
|
||||
}
|
||||
|
||||
private List<ResourceAssembly> ReadTargetLibraryResources(JsonTextReader reader)
|
||||
{
|
||||
var resources = new List<ResourceAssembly>();
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var path = (string)reader.Value;
|
||||
string locale = null;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
string propertyName;
|
||||
string propertyValue;
|
||||
|
||||
while (reader.TryReadStringProperty(out propertyName, out propertyValue))
|
||||
{
|
||||
if (propertyName == DependencyContextStrings.LocalePropertyName)
|
||||
{
|
||||
locale = propertyValue;
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
if (locale != null)
|
||||
{
|
||||
resources.Add(new ResourceAssembly(path, Pool(locale)));
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
private Dictionary<string, LibraryStub> ReadLibraries(JsonTextReader reader)
|
||||
{
|
||||
var libraries = new Dictionary<string, LibraryStub>();
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var libraryName = (string)reader.Value;
|
||||
|
||||
libraries.Add(Pool(libraryName), ReadOneLibrary(reader));
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return libraries;
|
||||
}
|
||||
|
||||
private LibraryStub ReadOneLibrary(JsonTextReader reader)
|
||||
{
|
||||
string hash = null;
|
||||
string type = null;
|
||||
bool serviceable = false;
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
switch ((string)reader.Value)
|
||||
{
|
||||
case DependencyContextStrings.Sha512PropertyName:
|
||||
hash = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.TypePropertyName:
|
||||
type = reader.ReadAsString();
|
||||
break;
|
||||
case DependencyContextStrings.ServiceablePropertyName:
|
||||
serviceable = reader.ReadAsBoolean().GetValueOrDefault(false);
|
||||
break;
|
||||
default:
|
||||
throw new FormatException($"Unknown property name '{reader.Value}'");
|
||||
}
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return new LibraryStub()
|
||||
{
|
||||
Hash = hash,
|
||||
Type = Pool(type),
|
||||
Serviceable = serviceable
|
||||
};
|
||||
}
|
||||
|
||||
private List<RuntimeFallbacks> ReadRuntimes(JsonTextReader reader)
|
||||
{
|
||||
var runtimeFallbacks = new List<RuntimeFallbacks>();
|
||||
|
||||
reader.ReadStartObject();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var runtime = (string)reader.Value;
|
||||
var fallbacks = reader.ReadStringArray();
|
||||
|
||||
runtimeFallbacks.Add(new RuntimeFallbacks(runtime, fallbacks));
|
||||
}
|
||||
|
||||
reader.CheckEndObject();
|
||||
|
||||
return runtimeFallbacks;
|
||||
}
|
||||
|
||||
private IEnumerable<Library> CreateLibraries(IEnumerable<TargetLibrary> libraries, bool runtime, Dictionary<string, LibraryStub> libraryStubs)
|
||||
{
|
||||
if (libraries == null)
|
||||
{
|
||||
return Enumerable.Empty<Library>();
|
||||
}
|
||||
return libraries
|
||||
.Select(property => CreateLibrary(property, runtime, libraryStubs))
|
||||
.Where(library => library != null);
|
||||
}
|
||||
|
||||
private Library CreateLibrary(TargetLibrary targetLibrary, bool runtime, Dictionary<string, LibraryStub> libraryStubs)
|
||||
{
|
||||
var nameWithVersion = targetLibrary.Name;
|
||||
LibraryStub stub;
|
||||
|
||||
if (!libraryStubs.TryGetValue(nameWithVersion, out stub))
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot find library information for {nameWithVersion}");
|
||||
}
|
||||
|
||||
var seperatorPosition = nameWithVersion.IndexOf(DependencyContextStrings.VersionSeperator);
|
||||
|
||||
var name = Pool(nameWithVersion.Substring(0, seperatorPosition));
|
||||
var version = Pool(nameWithVersion.Substring(seperatorPosition + 1));
|
||||
|
||||
if (runtime)
|
||||
{
|
||||
// Runtime section of this library was trimmed by type:platform
|
||||
var isCompilationOnly = targetLibrary.CompileOnly;
|
||||
if (isCompilationOnly == true)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var runtimeAssemblyGroups = new List<RuntimeAssetGroup>();
|
||||
var nativeLibraryGroups = new List<RuntimeAssetGroup>();
|
||||
if (targetLibrary.RuntimeTargets != null)
|
||||
{
|
||||
foreach (var ridGroup in targetLibrary.RuntimeTargets.GroupBy(e => e.Rid))
|
||||
{
|
||||
var groupRuntimeAssemblies = ridGroup
|
||||
.Where(e => e.Type == DependencyContextStrings.RuntimeAssetType)
|
||||
.Select(e => e.Path)
|
||||
.ToArray();
|
||||
|
||||
if (groupRuntimeAssemblies.Any())
|
||||
{
|
||||
runtimeAssemblyGroups.Add(new RuntimeAssetGroup(
|
||||
ridGroup.Key,
|
||||
groupRuntimeAssemblies.Where(a => Path.GetFileName(a) != "_._")));
|
||||
}
|
||||
|
||||
var groupNativeLibraries = ridGroup
|
||||
.Where(e => e.Type == DependencyContextStrings.NativeAssetType)
|
||||
.Select(e => e.Path)
|
||||
.ToArray();
|
||||
|
||||
if (groupNativeLibraries.Any())
|
||||
{
|
||||
nativeLibraryGroups.Add(new RuntimeAssetGroup(
|
||||
ridGroup.Key,
|
||||
groupNativeLibraries.Where(a => Path.GetFileName(a) != "_._")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetLibrary.Runtimes != null && targetLibrary.Runtimes.Count > 0)
|
||||
{
|
||||
runtimeAssemblyGroups.Add(new RuntimeAssetGroup(string.Empty, targetLibrary.Runtimes));
|
||||
}
|
||||
|
||||
if (targetLibrary.Natives != null && targetLibrary.Natives.Count > 0)
|
||||
{
|
||||
nativeLibraryGroups.Add(new RuntimeAssetGroup(string.Empty, targetLibrary.Natives));
|
||||
}
|
||||
|
||||
return new RuntimeLibrary(
|
||||
type: stub.Type,
|
||||
name: name,
|
||||
version: version,
|
||||
hash: stub.Hash,
|
||||
runtimeAssemblyGroups: runtimeAssemblyGroups,
|
||||
nativeLibraryGroups: nativeLibraryGroups,
|
||||
resourceAssemblies: targetLibrary.Resources ?? Enumerable.Empty<ResourceAssembly>(),
|
||||
dependencies: targetLibrary.Dependencies,
|
||||
serviceable: stub.Serviceable);
|
||||
}
|
||||
else
|
||||
{
|
||||
var assemblies = (targetLibrary.Compilations != null) ? targetLibrary.Compilations : Enumerable.Empty<string>();
|
||||
return new CompilationLibrary(stub.Type, name, version, stub.Hash, assemblies, targetLibrary.Dependencies, stub.Serviceable);
|
||||
}
|
||||
}
|
||||
|
||||
private string Pool(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string result;
|
||||
if (!_stringPool.TryGetValue(s, out result))
|
||||
{
|
||||
_stringPool[s] = s;
|
||||
result = s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private class Target
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public IEnumerable<TargetLibrary> Libraries;
|
||||
}
|
||||
|
||||
private struct TargetLibrary
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public IEnumerable<Dependency> Dependencies;
|
||||
|
||||
public List<string> Runtimes;
|
||||
|
||||
public List<string> Natives;
|
||||
|
||||
public List<string> Compilations;
|
||||
|
||||
public List<RuntimeTargetEntryStub> RuntimeTargets;
|
||||
|
||||
public List<ResourceAssembly> Resources;
|
||||
|
||||
public bool? CompileOnly;
|
||||
}
|
||||
|
||||
private struct RuntimeTargetEntryStub
|
||||
{
|
||||
public string Type;
|
||||
|
||||
public string Path;
|
||||
|
||||
public string Rid;
|
||||
}
|
||||
|
||||
private struct LibraryStub
|
||||
{
|
||||
public string Hash;
|
||||
|
||||
public string Type;
|
||||
|
||||
public bool Serviceable;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class DependencyContextLoader
|
||||
{
|
||||
private const string DepsJsonExtension = ".deps.json";
|
||||
|
||||
private readonly string _entryPointDepsLocation;
|
||||
private readonly string _runtimeDepsLocation;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly Func<IDependencyContextReader> _jsonReaderFactory;
|
||||
|
||||
public DependencyContextLoader() : this(
|
||||
DependencyContextPaths.Current.Application,
|
||||
DependencyContextPaths.Current.SharedRuntime,
|
||||
FileSystemWrapper.Default,
|
||||
() => new DependencyContextJsonReader())
|
||||
{
|
||||
}
|
||||
|
||||
internal DependencyContextLoader(
|
||||
string entryPointDepsLocation,
|
||||
string runtimeDepsLocation,
|
||||
IFileSystem fileSystem,
|
||||
Func<IDependencyContextReader> jsonReaderFactory)
|
||||
{
|
||||
_entryPointDepsLocation = entryPointDepsLocation;
|
||||
_runtimeDepsLocation = runtimeDepsLocation;
|
||||
_fileSystem = fileSystem;
|
||||
_jsonReaderFactory = jsonReaderFactory;
|
||||
}
|
||||
|
||||
public static DependencyContextLoader Default { get; } = new DependencyContextLoader();
|
||||
|
||||
internal virtual bool IsEntryAssembly(Assembly assembly)
|
||||
{
|
||||
return assembly.Equals(Assembly.GetEntryAssembly());
|
||||
}
|
||||
|
||||
internal virtual Stream GetResourceStream(Assembly assembly, string name)
|
||||
{
|
||||
return assembly.GetManifestResourceStream(name);
|
||||
}
|
||||
|
||||
public DependencyContext Load(Assembly assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(assembly));
|
||||
}
|
||||
|
||||
DependencyContext context = null;
|
||||
using (var reader = _jsonReaderFactory())
|
||||
{
|
||||
if (IsEntryAssembly(assembly))
|
||||
{
|
||||
context = LoadEntryAssemblyContext(reader);
|
||||
}
|
||||
|
||||
if (context == null)
|
||||
{
|
||||
context = LoadAssemblyContext(assembly, reader);
|
||||
}
|
||||
|
||||
if (context?.Target.IsPortable == true)
|
||||
{
|
||||
var runtimeContext = LoadRuntimeContext(reader);
|
||||
if (runtimeContext != null)
|
||||
{
|
||||
context = context.Merge(runtimeContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
private DependencyContext LoadEntryAssemblyContext(IDependencyContextReader reader)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_entryPointDepsLocation))
|
||||
{
|
||||
Debug.Assert(File.Exists(_entryPointDepsLocation));
|
||||
using (var stream = _fileSystem.File.OpenRead(_entryPointDepsLocation))
|
||||
{
|
||||
return reader.Read(stream);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private DependencyContext LoadRuntimeContext(IDependencyContextReader reader)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_runtimeDepsLocation))
|
||||
{
|
||||
Debug.Assert(File.Exists(_runtimeDepsLocation));
|
||||
using (var stream = _fileSystem.File.OpenRead(_runtimeDepsLocation))
|
||||
{
|
||||
return reader.Read(stream);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private DependencyContext LoadAssemblyContext(Assembly assembly, IDependencyContextReader reader)
|
||||
{
|
||||
using (var stream = GetResourceStream(assembly, assembly.GetName().Name + DepsJsonExtension))
|
||||
{
|
||||
if (stream != null)
|
||||
{
|
||||
return reader.Read(stream);
|
||||
}
|
||||
}
|
||||
|
||||
var depsJsonFile = Path.ChangeExtension(assembly.Location, DepsJsonExtension);
|
||||
if (_fileSystem.File.Exists(depsJsonFile))
|
||||
{
|
||||
using (var stream = _fileSystem.File.OpenRead(depsJsonFile))
|
||||
{
|
||||
return reader.Read(stream);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
using System;
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
internal class DependencyContextPaths
|
||||
{
|
||||
private static readonly string DepsFilesProperty = "APP_CONTEXT_DEPS_FILES";
|
||||
|
||||
public static DependencyContextPaths Current { get; } = GetCurrent();
|
||||
|
||||
public string Application { get; }
|
||||
|
||||
public string SharedRuntime { get; }
|
||||
|
||||
public DependencyContextPaths(string application, string sharedRuntime)
|
||||
{
|
||||
Application = application;
|
||||
SharedRuntime = sharedRuntime;
|
||||
}
|
||||
|
||||
private static DependencyContextPaths GetCurrent()
|
||||
{
|
||||
#if NETSTANDARD1_6
|
||||
var deps = AppContext.GetData(DepsFilesProperty);
|
||||
#else
|
||||
var deps = AppDomain.CurrentDomain.GetData(DepsFilesProperty);
|
||||
#endif
|
||||
var files = (deps as string)?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
return new DependencyContextPaths(
|
||||
files != null && files.Length > 0 ? files[0] : null,
|
||||
files != null && files.Length > 1 ? files[1] : null
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,80 +0,0 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
internal class DependencyContextStrings
|
||||
{
|
||||
internal const char VersionSeperator = '/';
|
||||
|
||||
internal const string CompileTimeAssembliesKey = "compile";
|
||||
|
||||
internal const string RuntimeAssembliesKey = "runtime";
|
||||
|
||||
internal const string NativeLibrariesKey = "native";
|
||||
|
||||
internal const string RuntimeTargetPropertyName = "runtimeTarget";
|
||||
|
||||
internal const string LibrariesPropertyName = "libraries";
|
||||
|
||||
internal const string TargetsPropertyName = "targets";
|
||||
|
||||
internal const string DependenciesPropertyName = "dependencies";
|
||||
|
||||
internal const string Sha512PropertyName = "sha512";
|
||||
|
||||
internal const string TypePropertyName = "type";
|
||||
|
||||
internal const string ServiceablePropertyName = "serviceable";
|
||||
|
||||
internal const string CompilationOptionsPropertName = "compilationOptions";
|
||||
|
||||
internal const string DefinesPropertyName = "defines";
|
||||
|
||||
internal const string LanguageVersionPropertyName = "languageVersion";
|
||||
|
||||
internal const string PlatformPropertyName = "platform";
|
||||
|
||||
internal const string AllowUnsafePropertyName = "allowUnsafe";
|
||||
|
||||
internal const string WarningsAsErrorsPropertyName = "warningsAsErrors";
|
||||
|
||||
internal const string OptimizePropertyName = "optimize";
|
||||
|
||||
internal const string KeyFilePropertyName = "keyFile";
|
||||
|
||||
internal const string DelaySignPropertyName = "delaySign";
|
||||
|
||||
internal const string PublicSignPropertyName = "publicSign";
|
||||
|
||||
internal const string DebugTypePropertyName = "debugType";
|
||||
|
||||
internal const string EmitEntryPointPropertyName = "emitEntryPoint";
|
||||
|
||||
internal const string GenerateXmlDocumentationPropertyName = "xmlDoc";
|
||||
|
||||
internal const string PortablePropertyName = "portable";
|
||||
|
||||
internal const string RuntimeTargetNamePropertyName = "name";
|
||||
|
||||
internal const string RuntimeTargetSignaturePropertyName = "signature";
|
||||
|
||||
internal const string RuntimesPropertyName = "runtimes";
|
||||
|
||||
internal const string RuntimeTargetsPropertyName = "runtimeTargets";
|
||||
|
||||
internal const string RidPropertyName = "rid";
|
||||
|
||||
internal const string AssetTypePropertyName = "assetType";
|
||||
|
||||
internal const string RuntimeAssetType = "runtime";
|
||||
|
||||
internal const string NativeAssetType = "native";
|
||||
|
||||
internal const string ResourceAssembliesPropertyName = "resources";
|
||||
|
||||
internal const string LocalePropertyName = "locale";
|
||||
|
||||
internal const string CompilationOnlyPropertyName = "compileOnly";
|
||||
}
|
||||
}
|
|
@ -1,341 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class DependencyContextWriter
|
||||
{
|
||||
public void Write(DependencyContext context, Stream stream)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
}
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
using (var jsonWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented })
|
||||
{
|
||||
Write(context).WriteTo(jsonWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private JObject Write(DependencyContext context)
|
||||
{
|
||||
var contextObject = new JObject(
|
||||
new JProperty(DependencyContextStrings.RuntimeTargetPropertyName, WriteRuntimeTargetInfo(context)),
|
||||
new JProperty(DependencyContextStrings.CompilationOptionsPropertName, WriteCompilationOptions(context.CompilationOptions)),
|
||||
new JProperty(DependencyContextStrings.TargetsPropertyName, WriteTargets(context)),
|
||||
new JProperty(DependencyContextStrings.LibrariesPropertyName, WriteLibraries(context))
|
||||
);
|
||||
if (context.RuntimeGraph.Any())
|
||||
{
|
||||
contextObject.Add(new JProperty(DependencyContextStrings.RuntimesPropertyName, WriteRuntimeGraph(context)));
|
||||
}
|
||||
return contextObject;
|
||||
}
|
||||
|
||||
private JObject WriteRuntimeTargetInfo(DependencyContext context)
|
||||
{
|
||||
return new JObject(
|
||||
new JProperty(DependencyContextStrings.RuntimeTargetNamePropertyName,
|
||||
context.Target.IsPortable ?
|
||||
context.Target.Framework :
|
||||
context.Target.Framework + DependencyContextStrings.VersionSeperator + context.Target.Runtime
|
||||
),
|
||||
new JProperty(DependencyContextStrings.RuntimeTargetSignaturePropertyName,
|
||||
context.Target.RuntimeSignature
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private JObject WriteRuntimeGraph(DependencyContext context)
|
||||
{
|
||||
return new JObject(
|
||||
context.RuntimeGraph.Select(g => new JProperty(g.Runtime, new JArray(g.Fallbacks)))
|
||||
);
|
||||
}
|
||||
|
||||
private JObject WriteCompilationOptions(CompilationOptions compilationOptions)
|
||||
{
|
||||
var o = new JObject();
|
||||
if (compilationOptions.Defines?.Any() == true)
|
||||
{
|
||||
o[DependencyContextStrings.DefinesPropertyName] = new JArray(compilationOptions.Defines);
|
||||
}
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.LanguageVersionPropertyName, compilationOptions.LanguageVersion);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.PlatformPropertyName, compilationOptions.Platform);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.AllowUnsafePropertyName, compilationOptions.AllowUnsafe);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.WarningsAsErrorsPropertyName, compilationOptions.WarningsAsErrors);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.OptimizePropertyName, compilationOptions.Optimize);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.KeyFilePropertyName, compilationOptions.KeyFile);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.DelaySignPropertyName, compilationOptions.DelaySign);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.PublicSignPropertyName, compilationOptions.PublicSign);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.EmitEntryPointPropertyName, compilationOptions.EmitEntryPoint);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.GenerateXmlDocumentationPropertyName, compilationOptions.GenerateXmlDocumentation);
|
||||
AddPropertyIfNotNull(o, DependencyContextStrings.DebugTypePropertyName, compilationOptions.DebugType);
|
||||
return o;
|
||||
}
|
||||
|
||||
private void AddPropertyIfNotNull<T>(JObject o, string name, T value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
o.Add(new JProperty(name, value));
|
||||
}
|
||||
}
|
||||
|
||||
private JObject WriteTargets(DependencyContext context)
|
||||
{
|
||||
if (context.Target.IsPortable)
|
||||
{
|
||||
return new JObject(
|
||||
new JProperty(context.Target.Framework, WritePortableTarget(context.RuntimeLibraries, context.CompileLibraries))
|
||||
);
|
||||
}
|
||||
|
||||
return new JObject(
|
||||
new JProperty(context.Target.Framework, WriteTarget(context.CompileLibraries)),
|
||||
new JProperty(context.Target.Framework + DependencyContextStrings.VersionSeperator + context.Target.Runtime,
|
||||
WriteTarget(context.RuntimeLibraries))
|
||||
);
|
||||
}
|
||||
|
||||
private JObject WriteTarget(IReadOnlyList<Library> libraries)
|
||||
{
|
||||
return new JObject(
|
||||
libraries.Select(library =>
|
||||
// TODO: remove the hack of calling "ToLowerInvariant()" on library Name and Version once
|
||||
// https://github.com/dotnet/core-setup/pull/64/ is merged and taken into the CLI
|
||||
new JProperty(library.Name.ToLowerInvariant() + DependencyContextStrings.VersionSeperator + library.Version.ToLowerInvariant(), WriteTargetLibrary(library))));
|
||||
}
|
||||
|
||||
private JObject WritePortableTarget(IReadOnlyList<RuntimeLibrary> runtimeLibraries, IReadOnlyList<CompilationLibrary> compilationLibraries)
|
||||
{
|
||||
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
|
||||
var compileLookup = compilationLibraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var targetObject = new JObject();
|
||||
|
||||
foreach (var packageName in runtimeLookup.Keys.Concat(compileLookup.Keys).Distinct())
|
||||
{
|
||||
RuntimeLibrary runtimeLibrary;
|
||||
runtimeLookup.TryGetValue(packageName, out runtimeLibrary);
|
||||
|
||||
CompilationLibrary compilationLibrary;
|
||||
compileLookup.TryGetValue(packageName, out compilationLibrary);
|
||||
|
||||
if (compilationLibrary != null && runtimeLibrary != null)
|
||||
{
|
||||
Debug.Assert(compilationLibrary.Serviceable == runtimeLibrary.Serviceable);
|
||||
Debug.Assert(compilationLibrary.Version == runtimeLibrary.Version);
|
||||
Debug.Assert(compilationLibrary.Hash == runtimeLibrary.Hash);
|
||||
Debug.Assert(compilationLibrary.Type == runtimeLibrary.Type);
|
||||
}
|
||||
|
||||
var library = (Library)compilationLibrary ?? (Library)runtimeLibrary;
|
||||
targetObject.Add(
|
||||
// TODO: remove the hack of calling "ToLowerInvariant()" on library Name and Version once
|
||||
// https://github.com/dotnet/core-setup/pull/64/ is merged and taken into the CLI
|
||||
new JProperty(library.Name.ToLowerInvariant() + DependencyContextStrings.VersionSeperator + library.Version.ToLowerInvariant(),
|
||||
WritePortableTargetLibrary(runtimeLibrary, compilationLibrary)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
return targetObject;
|
||||
}
|
||||
|
||||
private void AddCompilationAssemblies(JObject libraryObject, IEnumerable<string> compilationAssemblies)
|
||||
{
|
||||
if (!compilationAssemblies.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
libraryObject.Add(new JProperty(DependencyContextStrings.CompileTimeAssembliesKey,
|
||||
WriteAssetList(compilationAssemblies))
|
||||
);
|
||||
}
|
||||
|
||||
private void AddAssets(JObject libraryObject, string key, RuntimeAssetGroup group)
|
||||
{
|
||||
if (group == null || !group.AssetPaths.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
libraryObject.Add(new JProperty(key,
|
||||
WriteAssetList(group.AssetPaths))
|
||||
);
|
||||
}
|
||||
|
||||
private void AddDependencies(JObject libraryObject, IEnumerable<Dependency> dependencies)
|
||||
{
|
||||
if (!dependencies.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
libraryObject.AddFirst(
|
||||
new JProperty(DependencyContextStrings.DependenciesPropertyName,
|
||||
new JObject(
|
||||
dependencies.Select(dependency => new JProperty(dependency.Name, dependency.Version))))
|
||||
);
|
||||
}
|
||||
|
||||
private void AddResourceAssemblies(JObject libraryObject, IEnumerable<ResourceAssembly> resourceAssemblies)
|
||||
{
|
||||
if (!resourceAssemblies.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
libraryObject.Add(DependencyContextStrings.ResourceAssembliesPropertyName,
|
||||
new JObject(resourceAssemblies.Select(a =>
|
||||
new JProperty(NormalizePath(a.Path), new JObject(new JProperty(DependencyContextStrings.LocalePropertyName, a.Locale))))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private JObject WriteTargetLibrary(Library library)
|
||||
{
|
||||
var runtimeLibrary = library as RuntimeLibrary;
|
||||
if (runtimeLibrary != null)
|
||||
{
|
||||
var libraryObject = new JObject();
|
||||
AddDependencies(libraryObject, runtimeLibrary.Dependencies);
|
||||
|
||||
// Add runtime-agnostic assets
|
||||
AddAssets(libraryObject, DependencyContextStrings.RuntimeAssembliesKey, runtimeLibrary.RuntimeAssemblyGroups.GetDefaultGroup());
|
||||
AddAssets(libraryObject, DependencyContextStrings.NativeLibrariesKey, runtimeLibrary.NativeLibraryGroups.GetDefaultGroup());
|
||||
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
||||
|
||||
return libraryObject;
|
||||
}
|
||||
|
||||
var compilationLibrary = library as CompilationLibrary;
|
||||
if (compilationLibrary != null)
|
||||
{
|
||||
var libraryObject = new JObject();
|
||||
AddDependencies(libraryObject, compilationLibrary.Dependencies);
|
||||
AddCompilationAssemblies(libraryObject, compilationLibrary.Assemblies);
|
||||
return libraryObject;
|
||||
}
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
private JObject WritePortableTargetLibrary(RuntimeLibrary runtimeLibrary, CompilationLibrary compilationLibrary)
|
||||
{
|
||||
var libraryObject = new JObject();
|
||||
|
||||
var dependencies = new HashSet<Dependency>();
|
||||
if (runtimeLibrary != null)
|
||||
{
|
||||
// Add runtime-agnostic assets
|
||||
AddAssets(libraryObject, DependencyContextStrings.RuntimeAssembliesKey, runtimeLibrary.RuntimeAssemblyGroups.GetDefaultGroup());
|
||||
AddAssets(libraryObject, DependencyContextStrings.NativeLibrariesKey, runtimeLibrary.NativeLibraryGroups.GetDefaultGroup());
|
||||
AddResourceAssemblies(libraryObject, runtimeLibrary.ResourceAssemblies);
|
||||
|
||||
// Add runtime-specific assets
|
||||
var runtimeTargets = new JObject();
|
||||
AddRuntimeSpecificAssetGroups(runtimeTargets, DependencyContextStrings.RuntimeAssetType, runtimeLibrary.RuntimeAssemblyGroups);
|
||||
AddRuntimeSpecificAssetGroups(runtimeTargets, DependencyContextStrings.NativeAssetType, runtimeLibrary.NativeLibraryGroups);
|
||||
if (runtimeTargets.Count > 0)
|
||||
{
|
||||
libraryObject.Add(DependencyContextStrings.RuntimeTargetsPropertyName, runtimeTargets);
|
||||
}
|
||||
|
||||
dependencies.UnionWith(runtimeLibrary.Dependencies);
|
||||
}
|
||||
|
||||
if (compilationLibrary != null)
|
||||
{
|
||||
AddCompilationAssemblies(libraryObject, compilationLibrary.Assemblies);
|
||||
|
||||
dependencies.UnionWith(compilationLibrary.Dependencies);
|
||||
}
|
||||
|
||||
AddDependencies(libraryObject, dependencies);
|
||||
if (compilationLibrary != null && runtimeLibrary == null)
|
||||
{
|
||||
libraryObject.Add(DependencyContextStrings.CompilationOnlyPropertyName, true);
|
||||
}
|
||||
return libraryObject;
|
||||
}
|
||||
|
||||
private void AddRuntimeSpecificAssetGroups(JObject runtimeTargets, string assetType, IEnumerable<RuntimeAssetGroup> assetGroups)
|
||||
{
|
||||
foreach (var group in assetGroups.Where(g => !string.IsNullOrEmpty(g.Runtime)))
|
||||
{
|
||||
if (group.AssetPaths.Any())
|
||||
{
|
||||
AddRuntimeSpecificAssets(runtimeTargets, group.AssetPaths, group.Runtime, assetType);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add a placeholder item
|
||||
// We need to generate a pseudo-path because there could be multiple different asset groups with placeholders
|
||||
// Only the last path segment matters, the rest is basically just a GUID.
|
||||
var pseudoPathFolder = assetType == DependencyContextStrings.RuntimeAssetType ?
|
||||
"lib" :
|
||||
"native";
|
||||
runtimeTargets[$"runtime/{group.Runtime}/{pseudoPathFolder}/_._"] = new JObject(
|
||||
new JProperty(DependencyContextStrings.RidPropertyName, group.Runtime),
|
||||
new JProperty(DependencyContextStrings.AssetTypePropertyName, assetType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddRuntimeSpecificAssets(JObject target, IEnumerable<string> assets, string runtime, string assetType)
|
||||
{
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
target.Add(new JProperty(NormalizePath(asset),
|
||||
new JObject(
|
||||
new JProperty(DependencyContextStrings.RidPropertyName, runtime),
|
||||
new JProperty(DependencyContextStrings.AssetTypePropertyName, assetType)
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private JObject WriteAssetList(IEnumerable<string> assetPaths)
|
||||
{
|
||||
return new JObject(assetPaths.Select(assembly => new JProperty(NormalizePath(assembly), new JObject())));
|
||||
}
|
||||
|
||||
private JObject WriteLibraries(DependencyContext context)
|
||||
{
|
||||
var allLibraries =
|
||||
context.RuntimeLibraries.Cast<Library>().Concat(context.CompileLibraries)
|
||||
// TODO: remove the hack of calling "ToLowerInvariant()" on library Name and Version once
|
||||
// https://github.com/dotnet/core-setup/pull/64/ is merged and taken into the CLI
|
||||
.GroupBy(library => library.Name.ToLowerInvariant() + DependencyContextStrings.VersionSeperator + library.Version.ToLowerInvariant());
|
||||
|
||||
return new JObject(allLibraries.Select(libraries => new JProperty(libraries.Key, WriteLibrary(libraries.First()))));
|
||||
}
|
||||
|
||||
private JObject WriteLibrary(Library library)
|
||||
{
|
||||
return new JObject(
|
||||
new JProperty(DependencyContextStrings.TypePropertyName, library.Type),
|
||||
new JProperty(DependencyContextStrings.ServiceablePropertyName, library.Serviceable),
|
||||
new JProperty(DependencyContextStrings.Sha512PropertyName, library.Hash)
|
||||
);
|
||||
}
|
||||
|
||||
private string NormalizePath(string path)
|
||||
{
|
||||
return path.Replace('\\', '/');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public interface IDependencyContextReader: IDisposable
|
||||
{
|
||||
DependencyContext Read(Stream stream);
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
internal static class JsonTextReaderExtensions
|
||||
{
|
||||
internal static bool TryReadStringProperty(this JsonTextReader reader, out string name, out string value)
|
||||
{
|
||||
name = null;
|
||||
value = null;
|
||||
if (reader.Read() && reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
name = (string)reader.Value;
|
||||
value = reader.ReadAsString();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static void ReadStartObject(this JsonTextReader reader)
|
||||
{
|
||||
reader.Read();
|
||||
CheckStartObject(reader);
|
||||
}
|
||||
|
||||
internal static void CheckStartObject(this JsonTextReader reader)
|
||||
{
|
||||
if (reader.TokenType != JsonToken.StartObject)
|
||||
{
|
||||
throw CreateUnexpectedException(reader, "{");
|
||||
}
|
||||
}
|
||||
|
||||
internal static void CheckEndObject(this JsonTextReader reader)
|
||||
{
|
||||
if (reader.TokenType != JsonToken.EndObject)
|
||||
{
|
||||
throw CreateUnexpectedException(reader, "}");
|
||||
}
|
||||
}
|
||||
|
||||
internal static string[] ReadStringArray(this JsonTextReader reader)
|
||||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType != JsonToken.StartArray)
|
||||
{
|
||||
throw CreateUnexpectedException(reader,"[");
|
||||
}
|
||||
|
||||
var items = new List<string>();
|
||||
|
||||
while (reader.Read() && reader.TokenType == JsonToken.String)
|
||||
{
|
||||
items.Add((string)reader.Value);
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonToken.EndArray)
|
||||
{
|
||||
throw CreateUnexpectedException(reader, "]");
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
||||
internal static Exception CreateUnexpectedException(JsonTextReader reader, string expected)
|
||||
{
|
||||
return new FormatException($"Unexpected character encountered, excepted '{expected}' " +
|
||||
$"at line {reader.LineNumber} position {reader.LinePosition} path {reader.Path}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class Library
|
||||
{
|
||||
public Library(string type, string name, string version, string hash, IEnumerable<Dependency> dependencies, bool serviceable)
|
||||
{
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new ArgumentException(nameof(type));
|
||||
}
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentException(nameof(name));
|
||||
}
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
throw new ArgumentException(nameof(version));
|
||||
}
|
||||
if (dependencies == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(dependencies));
|
||||
}
|
||||
Type = type;
|
||||
Name = name;
|
||||
Version = version;
|
||||
Hash = hash;
|
||||
Dependencies = dependencies.ToArray();
|
||||
Serviceable = serviceable;
|
||||
}
|
||||
|
||||
public string Type { get; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Version { get; }
|
||||
|
||||
public string Hash { get; }
|
||||
|
||||
public IReadOnlyList<Dependency> Dependencies { get; }
|
||||
|
||||
public bool Serviceable { get; }
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>688870c8-9843-4f9e-8576-d39290ad0f25</ProjectGuid>
|
||||
<RootNamespace>Microsoft.Extensions.DependencyModel</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -1,5 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
|
@ -1,121 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class AppBaseCompilationAssemblyResolver : ICompilationAssemblyResolver
|
||||
{
|
||||
private static string RefsDirectoryName = "refs";
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly string _basePath;
|
||||
private readonly DependencyContextPaths _dependencyContextPaths;
|
||||
|
||||
public AppBaseCompilationAssemblyResolver()
|
||||
: this(FileSystemWrapper.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public AppBaseCompilationAssemblyResolver(string basePath)
|
||||
: this(FileSystemWrapper.Default, basePath, DependencyContextPaths.Current)
|
||||
{
|
||||
}
|
||||
|
||||
internal AppBaseCompilationAssemblyResolver(IFileSystem fileSystem)
|
||||
: this(fileSystem, ApplicationEnvironment.ApplicationBasePath, DependencyContextPaths.Current)
|
||||
{
|
||||
}
|
||||
|
||||
internal AppBaseCompilationAssemblyResolver(IFileSystem fileSystem, string basePath, DependencyContextPaths dependencyContextPaths)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_basePath = basePath;
|
||||
_dependencyContextPaths = dependencyContextPaths;
|
||||
}
|
||||
|
||||
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
|
||||
{
|
||||
var isProject = string.Equals(library.Type, "project", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(library.Type, "msbuildproject", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
var isPackage = string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase);
|
||||
if (!isProject &&
|
||||
!isPackage &&
|
||||
!string.Equals(library.Type, "referenceassembly", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var refsPath = Path.Combine(_basePath, RefsDirectoryName);
|
||||
var isPublished = _fileSystem.Directory.Exists(refsPath);
|
||||
|
||||
// Resolving reference assebmlies requires refs folder to exist
|
||||
if (!isProject && !isPackage && !isPublished)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var directories = new List<string>()
|
||||
{
|
||||
_basePath
|
||||
};
|
||||
|
||||
if (isPublished)
|
||||
{
|
||||
directories.Insert(0, refsPath);
|
||||
}
|
||||
|
||||
// Only packages can come from shared runtime
|
||||
var sharedPath = _dependencyContextPaths.SharedRuntime;
|
||||
if (isPublished && isPackage && !string.IsNullOrEmpty(sharedPath))
|
||||
{
|
||||
var sharedDirectory = Path.GetDirectoryName(sharedPath);
|
||||
var sharedRefs = Path.Combine(sharedDirectory, RefsDirectoryName);
|
||||
if (_fileSystem.Directory.Exists(sharedRefs))
|
||||
{
|
||||
directories.Add(sharedRefs);
|
||||
}
|
||||
directories.Add(sharedDirectory);
|
||||
}
|
||||
|
||||
foreach (var assembly in library.Assemblies)
|
||||
{
|
||||
bool resolved = false;
|
||||
var assemblyFile = Path.GetFileName(assembly);
|
||||
foreach (var directory in directories)
|
||||
{
|
||||
string fullName;
|
||||
if (ResolverUtils.TryResolveAssemblyFile(_fileSystem, directory, assemblyFile, out fullName))
|
||||
{
|
||||
assemblies.Add(fullName);
|
||||
resolved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!resolved)
|
||||
{
|
||||
// throw in case when we are published app and nothing found
|
||||
// because we cannot rely on nuget package cache in this case
|
||||
if (isPublished)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Can not find assembly file {assemblyFile} at '{string.Join(",", directories)}'");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
// 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.Extensions.DependencyModel.Resolution;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class CompositeCompilationAssemblyResolver: ICompilationAssemblyResolver
|
||||
{
|
||||
private readonly ICompilationAssemblyResolver[] _resolvers;
|
||||
|
||||
public CompositeCompilationAssemblyResolver(ICompilationAssemblyResolver[] resolvers)
|
||||
{
|
||||
_resolvers = resolvers;
|
||||
}
|
||||
|
||||
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
|
||||
{
|
||||
foreach (var resolver in _resolvers)
|
||||
{
|
||||
if (resolver.TryResolveAssemblyPaths(library, assemblies))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
// 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 Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class DotNetReferenceAssembliesPathResolver
|
||||
{
|
||||
public static readonly string DotNetReferenceAssembliesPathEnv = "DOTNET_REFERENCE_ASSEMBLIES_PATH";
|
||||
|
||||
internal static string Resolve(IEnvironment envirnment, IFileSystem fileSystem)
|
||||
{
|
||||
var path = envirnment.GetEnvironmentVariable(DotNetReferenceAssembliesPathEnv);
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
return GetDefaultDotNetReferenceAssembliesPath(fileSystem);
|
||||
}
|
||||
|
||||
public static string Resolve()
|
||||
{
|
||||
return Resolve(EnvironmentWrapper.Default, FileSystemWrapper.Default);
|
||||
}
|
||||
|
||||
private static string GetDefaultDotNetReferenceAssembliesPath(IFileSystem fileSystem)
|
||||
{
|
||||
var os = RuntimeEnvironment.OperatingSystemPlatform;
|
||||
|
||||
if (os == Platform.Windows)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (os == Platform.Darwin &&
|
||||
fileSystem.Directory.Exists("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks"))
|
||||
{
|
||||
return "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks";
|
||||
}
|
||||
|
||||
if (fileSystem.Directory.Exists("/usr/local/lib/mono/xbuild-frameworks"))
|
||||
{
|
||||
return "/usr/local/lib/mono/xbuild-frameworks";
|
||||
}
|
||||
|
||||
if (fileSystem.Directory.Exists("/usr/lib/mono/xbuild-frameworks"))
|
||||
{
|
||||
return "/usr/lib/mono/xbuild-frameworks";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// 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;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public interface ICompilationAssemblyResolver
|
||||
{
|
||||
bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies);
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class PackageCacheCompilationAssemblyResolver: ICompilationAssemblyResolver
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly string _packageCacheDirectory;
|
||||
|
||||
public PackageCacheCompilationAssemblyResolver()
|
||||
: this(FileSystemWrapper.Default, EnvironmentWrapper.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public PackageCacheCompilationAssemblyResolver(string packageCacheDirectory)
|
||||
: this(FileSystemWrapper.Default, packageCacheDirectory)
|
||||
{
|
||||
}
|
||||
|
||||
internal PackageCacheCompilationAssemblyResolver(IFileSystem fileSystem, IEnvironment environment)
|
||||
: this(fileSystem, GetDefaultPackageCacheDirectory(environment))
|
||||
{
|
||||
}
|
||||
|
||||
internal PackageCacheCompilationAssemblyResolver(IFileSystem fileSystem, string packageCacheDirectory)
|
||||
{
|
||||
_packageCacheDirectory = packageCacheDirectory;
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
|
||||
{
|
||||
if (!string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_packageCacheDirectory))
|
||||
{
|
||||
var hashSplitterPos = library.Hash.IndexOf('-');
|
||||
if (hashSplitterPos <= 0 || hashSplitterPos == library.Hash.Length - 1)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid hash entry '{library.Hash}' for package '{library.Name}'");
|
||||
}
|
||||
|
||||
string packagePath;
|
||||
if (ResolverUtils.TryResolvePackagePath(_fileSystem, library, _packageCacheDirectory, out packagePath))
|
||||
{
|
||||
var hashAlgorithm = library.Hash.Substring(0, hashSplitterPos);
|
||||
var cacheHashFileName = $"{library.Name.ToLowerInvariant()}.{library.Version.ToLowerInvariant()}.nupkg.{hashAlgorithm}";
|
||||
var cacheHashPath = Path.Combine(packagePath, cacheHashFileName);
|
||||
|
||||
if (_fileSystem.File.Exists(cacheHashPath) &&
|
||||
_fileSystem.File.ReadAllText(cacheHashPath) == library.Hash.Substring(hashSplitterPos + 1))
|
||||
{
|
||||
assemblies.AddRange(ResolverUtils.ResolveFromPackagePath(_fileSystem, library, packagePath));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static string GetDefaultPackageCacheDirectory(IEnvironment environment)
|
||||
{
|
||||
return environment.GetEnvironmentVariable("DOTNET_PACKAGES_CACHE");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class PackageCompilationAssemblyResolver: ICompilationAssemblyResolver
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly string _nugetPackageDirectory;
|
||||
|
||||
public PackageCompilationAssemblyResolver()
|
||||
: this(EnvironmentWrapper.Default, FileSystemWrapper.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public PackageCompilationAssemblyResolver(string nugetPackageDirectory)
|
||||
: this(FileSystemWrapper.Default, nugetPackageDirectory)
|
||||
{
|
||||
}
|
||||
|
||||
internal PackageCompilationAssemblyResolver(IEnvironment environment,
|
||||
IFileSystem fileSystem)
|
||||
: this(fileSystem, GetDefaultPackageDirectory(environment))
|
||||
{
|
||||
}
|
||||
|
||||
internal PackageCompilationAssemblyResolver(IFileSystem fileSystem, string nugetPackageDirectory)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_nugetPackageDirectory = nugetPackageDirectory;
|
||||
}
|
||||
|
||||
private static string GetDefaultPackageDirectory(IEnvironment environment) =>
|
||||
GetDefaultPackageDirectory(RuntimeEnvironment.OperatingSystemPlatform, environment);
|
||||
|
||||
internal static string GetDefaultPackageDirectory(Platform osPlatform, IEnvironment environment)
|
||||
{
|
||||
var packageDirectory = environment.GetEnvironmentVariable("NUGET_PACKAGES");
|
||||
|
||||
if (!string.IsNullOrEmpty(packageDirectory))
|
||||
{
|
||||
return packageDirectory;
|
||||
}
|
||||
|
||||
string basePath;
|
||||
if (osPlatform == Platform.Windows)
|
||||
{
|
||||
basePath = environment.GetEnvironmentVariable("USERPROFILE");
|
||||
}
|
||||
else
|
||||
{
|
||||
basePath = environment.GetEnvironmentVariable("HOME");
|
||||
}
|
||||
if (string.IsNullOrEmpty(basePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Path.Combine(basePath, ".nuget", "packages");
|
||||
}
|
||||
|
||||
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_nugetPackageDirectory) ||
|
||||
!string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string packagePath;
|
||||
|
||||
if (ResolverUtils.TryResolvePackagePath(_fileSystem, library, _nugetPackageDirectory, out packagePath))
|
||||
{
|
||||
assemblies.AddRange(ResolverUtils.ResolveFromPackagePath(_fileSystem, library, packagePath));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
public class ReferenceAssemblyPathResolver: ICompilationAssemblyResolver
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly string _defaultReferenceAssembliesPath;
|
||||
private readonly string[] _fallbackSearchPaths;
|
||||
|
||||
public ReferenceAssemblyPathResolver()
|
||||
: this(FileSystemWrapper.Default, EnvironmentWrapper.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public ReferenceAssemblyPathResolver(string defaultReferenceAssembliesPath, string[] fallbackSearchPaths)
|
||||
: this(FileSystemWrapper.Default, defaultReferenceAssembliesPath, fallbackSearchPaths)
|
||||
{
|
||||
}
|
||||
|
||||
internal ReferenceAssemblyPathResolver(IFileSystem fileSystem, IEnvironment environment)
|
||||
: this(fileSystem,
|
||||
GetDefaultReferenceAssembliesPath(fileSystem, RuntimeEnvironment.OperatingSystemPlatform, environment),
|
||||
GetFallbackSearchPaths(fileSystem, RuntimeEnvironment.OperatingSystemPlatform, environment))
|
||||
{
|
||||
}
|
||||
|
||||
internal ReferenceAssemblyPathResolver(IFileSystem fileSystem, string defaultReferenceAssembliesPath, string[] fallbackSearchPaths)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_defaultReferenceAssembliesPath = defaultReferenceAssembliesPath;
|
||||
_fallbackSearchPaths = fallbackSearchPaths;
|
||||
}
|
||||
|
||||
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
|
||||
{
|
||||
if (!string.Equals(library.Type, "referenceassembly", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (var assembly in library.Assemblies)
|
||||
{
|
||||
string fullName;
|
||||
if (!TryResolveReferenceAssembly(assembly, out fullName))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find reference assembly '{assembly}' file for package {library.Name}");
|
||||
}
|
||||
assemblies.Add(fullName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryResolveReferenceAssembly(string path, out string fullPath)
|
||||
{
|
||||
fullPath = null;
|
||||
|
||||
if (_defaultReferenceAssembliesPath != null)
|
||||
{
|
||||
var relativeToReferenceAssemblies = Path.Combine(_defaultReferenceAssembliesPath, path);
|
||||
if (_fileSystem.File.Exists(relativeToReferenceAssemblies))
|
||||
{
|
||||
fullPath = relativeToReferenceAssemblies;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var name = Path.GetFileName(path);
|
||||
foreach (var fallbackPath in _fallbackSearchPaths)
|
||||
{
|
||||
var fallbackFile = Path.Combine(fallbackPath, name);
|
||||
if (_fileSystem.File.Exists(fallbackFile))
|
||||
{
|
||||
fullPath = fallbackFile;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static string[] GetFallbackSearchPaths(IFileSystem fileSystem, Platform platform, IEnvironment environment)
|
||||
{
|
||||
if (platform != Platform.Windows)
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
var net20Dir = Path.Combine(environment.GetEnvironmentVariable("WINDIR"), "Microsoft.NET", "Framework", "v2.0.50727");
|
||||
|
||||
if (!fileSystem.Directory.Exists(net20Dir))
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
return new[] { net20Dir };
|
||||
}
|
||||
|
||||
internal static string GetDefaultReferenceAssembliesPath(IFileSystem fileSystem, Platform platform, IEnvironment environment)
|
||||
{
|
||||
// Allow setting the reference assemblies path via an environment variable
|
||||
var referenceAssembliesPath = DotNetReferenceAssembliesPathResolver.Resolve(environment, fileSystem);
|
||||
if (!string.IsNullOrEmpty(referenceAssembliesPath))
|
||||
{
|
||||
return referenceAssembliesPath;
|
||||
}
|
||||
|
||||
if (platform != Platform.Windows)
|
||||
{
|
||||
// There is no reference assemblies path outside of windows
|
||||
// The environment variable can be used to specify one
|
||||
return null;
|
||||
}
|
||||
|
||||
// References assemblies are in %ProgramFiles(x86)% on
|
||||
// 64 bit machines
|
||||
var programFiles = environment.GetEnvironmentVariable("ProgramFiles(x86)");
|
||||
|
||||
if (string.IsNullOrEmpty(programFiles))
|
||||
{
|
||||
// On 32 bit machines they are in %ProgramFiles%
|
||||
programFiles = environment.GetEnvironmentVariable("ProgramFiles");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(programFiles))
|
||||
{
|
||||
// Reference assemblies aren't installed
|
||||
return null;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
programFiles,
|
||||
"Reference Assemblies", "Microsoft", "Framework");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Resolution
|
||||
{
|
||||
internal static class ResolverUtils
|
||||
{
|
||||
internal static bool TryResolvePackagePath(IFileSystem fileSystem, CompilationLibrary library, string basePath, out string packagePath)
|
||||
{
|
||||
packagePath = Path.Combine(
|
||||
basePath,
|
||||
library.Name.ToLowerInvariant(),
|
||||
library.Version.ToLowerInvariant());
|
||||
|
||||
if (fileSystem.Directory.Exists(packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> ResolveFromPackagePath(IFileSystem fileSystem, CompilationLibrary library, string basePath)
|
||||
{
|
||||
foreach (var assembly in library.Assemblies)
|
||||
{
|
||||
string fullName;
|
||||
if (!TryResolveAssemblyFile(fileSystem, basePath, assembly, out fullName))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find assembly file for package {library.Name} at '{fullName}'");
|
||||
}
|
||||
yield return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool TryResolveAssemblyFile(IFileSystem fileSystem, string basePath, string assemblyPath, out string fullName)
|
||||
{
|
||||
fullName = Path.Combine(basePath, assemblyPath);
|
||||
if (fileSystem.File.Exists(fullName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// 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;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class ResourceAssembly
|
||||
{
|
||||
public ResourceAssembly(string path, string locale)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentException(nameof(path));
|
||||
}
|
||||
if (string.IsNullOrEmpty(locale))
|
||||
{
|
||||
throw new ArgumentException(nameof(locale));
|
||||
}
|
||||
Locale = locale;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public string Locale { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
// 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;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class RuntimeAssembly
|
||||
{
|
||||
private const string NativeImageSufix = ".ni";
|
||||
private readonly string _assemblyName;
|
||||
|
||||
public RuntimeAssembly(string assemblyName, string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(assemblyName))
|
||||
{
|
||||
throw new ArgumentException(nameof(assemblyName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentException(nameof(path));
|
||||
}
|
||||
_assemblyName = assemblyName;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public AssemblyName Name => new AssemblyName(_assemblyName);
|
||||
|
||||
public string Path { get; }
|
||||
|
||||
public static RuntimeAssembly Create(string path)
|
||||
{
|
||||
var assemblyName = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||
if (assemblyName == null)
|
||||
{
|
||||
throw new ArgumentException($"Provided path has empty file name '{path}'", nameof(path));
|
||||
}
|
||||
|
||||
if (assemblyName.EndsWith(NativeImageSufix))
|
||||
{
|
||||
assemblyName = assemblyName.Substring(0, assemblyName.Length - NativeImageSufix.Length);
|
||||
}
|
||||
return new RuntimeAssembly(assemblyName, path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// 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.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class RuntimeAssetGroup
|
||||
{
|
||||
public RuntimeAssetGroup(string runtime, params string[] assetPaths) : this(runtime, (IEnumerable<string>)assetPaths) { }
|
||||
|
||||
public RuntimeAssetGroup(string runtime, IEnumerable<string> assetPaths)
|
||||
{
|
||||
Runtime = runtime;
|
||||
AssetPaths = assetPaths.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The runtime ID associated with this group (may be empty if the group is runtime-agnostic)
|
||||
/// </summary>
|
||||
public string Runtime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of assets provided in this runtime group
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> AssetPaths { get; }
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class RuntimeFallbacks
|
||||
{
|
||||
public string Runtime { get; set; }
|
||||
public IReadOnlyList<string> Fallbacks { get; set; }
|
||||
|
||||
public RuntimeFallbacks(string runtime, params string[] fallbacks) : this(runtime, (IEnumerable<string>)fallbacks) { }
|
||||
public RuntimeFallbacks(string runtime, IEnumerable<string> fallbacks)
|
||||
{
|
||||
if (string.IsNullOrEmpty(runtime))
|
||||
{
|
||||
throw new ArgumentException(nameof(runtime));
|
||||
}
|
||||
if (fallbacks == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(fallbacks));
|
||||
}
|
||||
Runtime = runtime;
|
||||
Fallbacks = fallbacks.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class RuntimeLibrary : Library
|
||||
{
|
||||
public RuntimeLibrary(
|
||||
string type,
|
||||
string name,
|
||||
string version,
|
||||
string hash,
|
||||
IReadOnlyList<RuntimeAssetGroup> runtimeAssemblyGroups,
|
||||
IReadOnlyList<RuntimeAssetGroup> nativeLibraryGroups,
|
||||
IEnumerable<ResourceAssembly> resourceAssemblies,
|
||||
IEnumerable<Dependency> dependencies,
|
||||
bool serviceable)
|
||||
: base(type, name, version, hash, dependencies, serviceable)
|
||||
{
|
||||
if (runtimeAssemblyGroups == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(runtimeAssemblyGroups));
|
||||
}
|
||||
if (nativeLibraryGroups == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(nativeLibraryGroups));
|
||||
}
|
||||
if (resourceAssemblies == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(resourceAssemblies));
|
||||
}
|
||||
RuntimeAssemblyGroups = runtimeAssemblyGroups;
|
||||
ResourceAssemblies = resourceAssemblies.ToArray();
|
||||
NativeLibraryGroups = nativeLibraryGroups;
|
||||
|
||||
Assemblies = new RuntimeAssembly[0];
|
||||
NativeLibraries = new string[0];
|
||||
}
|
||||
|
||||
// Temporary (legacy) properties: https://github.com/dotnet/cli/issues/1998
|
||||
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
||||
public IReadOnlyList<string> NativeLibraries { get; }
|
||||
|
||||
public IReadOnlyList<RuntimeAssetGroup> RuntimeAssemblyGroups { get; }
|
||||
|
||||
public IReadOnlyList<RuntimeAssetGroup> NativeLibraryGroups { get; }
|
||||
|
||||
public IReadOnlyList<ResourceAssembly> ResourceAssemblies { get; }
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
// 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;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class TargetInfo
|
||||
{
|
||||
public TargetInfo(string framework,
|
||||
string runtime,
|
||||
string runtimeSignature,
|
||||
bool isPortable)
|
||||
{
|
||||
if (string.IsNullOrEmpty(framework))
|
||||
{
|
||||
throw new ArgumentException(nameof(framework));
|
||||
}
|
||||
|
||||
Framework = framework;
|
||||
Runtime = runtime;
|
||||
RuntimeSignature = runtimeSignature;
|
||||
IsPortable = isPortable;
|
||||
}
|
||||
|
||||
public string Framework { get; }
|
||||
|
||||
public string Runtime { get; }
|
||||
|
||||
public string RuntimeSignature { get; }
|
||||
|
||||
public bool IsPortable { get; }
|
||||
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"description": "Abstractions for reading `.deps` files.",
|
||||
"version": "1.0.1-beta-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"keyFile": "../../tools/Key.snk"
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
},
|
||||
"Newtonsoft.Json": "9.0.1"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"netstandard1.3": {
|
||||
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50",
|
||||
"dependencies": {
|
||||
"System.Diagnostics.Debug": "4.0.11",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Linq": "4.1.0"
|
||||
}
|
||||
},
|
||||
"netstandard1.6": {
|
||||
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50",
|
||||
"dependencies": {
|
||||
"System.Diagnostics.Debug": "4.0.11",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Linq": "4.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {},
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dotnet/cli"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"description": "Abstractions for test runners to communicate to a tool, such as Visual Studio.",
|
||||
"version": "1.0.0-featmsbuild-*",
|
||||
"version": "1.0.1-featmsbuild-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"allowUnsafe": true,
|
||||
|
|
|
@ -5,7 +5,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Runtime.Loader;
|
|||
using System.Text;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.Tools.Build;
|
||||
using Microsoft.DotNet.Tools.Compiler;
|
||||
using Microsoft.DotNet.Tools.Compiler.Csc;
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.ApplicationInsights;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Cli
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
"dependencies": {
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24",
|
||||
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
|
||||
},
|
||||
"testRunner": "xunit",
|
||||
"frameworks": {
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.New
|
||||
{
|
||||
|
|
|
@ -65,7 +65,8 @@
|
|||
|
||||
"Microsoft.DotNet.Core.Build.Tasks": {
|
||||
"target": "project"
|
||||
}
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.1.0",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"xunit": "2.1.0",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.runner.console": "2.1.0",
|
||||
"Microsoft.Deployment.WindowsInstaller": "1.0.0"
|
||||
},
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"Microsoft.DotNet.Cli.Utils": {
|
||||
"target": "project"
|
||||
},
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
"target": "project"
|
||||
},
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue