Remove csv reader
This commit is contained in:
parent
665dc9bcce
commit
6970a75746
8 changed files with 57 additions and 304 deletions
|
@ -1,139 +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 System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyModel
|
|
||||||
{
|
|
||||||
public class DependencyContextCsvReader: IDependencyContextReader
|
|
||||||
{
|
|
||||||
public DependencyContext Read(Stream stream)
|
|
||||||
{
|
|
||||||
if (stream == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(stream));
|
|
||||||
}
|
|
||||||
var lines = new List<DepsFileLine>();
|
|
||||||
using (var reader = new StreamReader(stream))
|
|
||||||
{
|
|
||||||
while (!reader.EndOfStream)
|
|
||||||
{
|
|
||||||
var line = new DepsFileLine();
|
|
||||||
line.LibraryType = ReadValue(reader);
|
|
||||||
line.PackageName = ReadValue(reader);
|
|
||||||
line.PackageVersion = ReadValue(reader);
|
|
||||||
line.PackageHash = ReadValue(reader);
|
|
||||||
line.AssetType = ReadValue(reader);
|
|
||||||
line.AssetName = ReadValue(reader);
|
|
||||||
line.AssetPath = ReadValue(reader);
|
|
||||||
|
|
||||||
if (line.AssetType == "runtime" &&
|
|
||||||
!line.AssetPath.EndsWith(".ni.dll"))
|
|
||||||
{
|
|
||||||
lines.Add(line);
|
|
||||||
}
|
|
||||||
SkipWhitespace(reader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var runtimeLibraries = new List<RuntimeLibrary>();
|
|
||||||
var packageGroups = lines.GroupBy(PackageIdentity);
|
|
||||||
foreach (var packageGroup in packageGroups)
|
|
||||||
{
|
|
||||||
var identity = packageGroup.Key;
|
|
||||||
runtimeLibraries.Add(new RuntimeLibrary(
|
|
||||||
type: identity.Item1,
|
|
||||||
name: identity.Item2,
|
|
||||||
version: identity.Item3,
|
|
||||||
hash: identity.Item4,
|
|
||||||
assemblies: packageGroup.Select(l => RuntimeAssembly.Create(l.AssetPath)),
|
|
||||||
nativeLibraries: Enumerable.Empty<string>(),
|
|
||||||
resourceAssemblies: Enumerable.Empty<ResourceAssembly>(),
|
|
||||||
subTargets: Enumerable.Empty<RuntimeTarget>(),
|
|
||||||
dependencies: Enumerable.Empty<Dependency>(),
|
|
||||||
serviceable: false
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new DependencyContext(
|
|
||||||
targetFramework: string.Empty,
|
|
||||||
runtime: string.Empty,
|
|
||||||
isPortable: false,
|
|
||||||
compilationOptions: CompilationOptions.Default,
|
|
||||||
compileLibraries: Enumerable.Empty<CompilationLibrary>(),
|
|
||||||
runtimeLibraries: runtimeLibraries.ToArray(),
|
|
||||||
runtimeGraph: Enumerable.Empty<RuntimeFallbacks>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Tuple<string, string, string, string> PackageIdentity(DepsFileLine line)
|
|
||||||
{
|
|
||||||
return Tuple.Create(line.LibraryType, line.PackageName, line.PackageVersion, line.PackageHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SkipWhitespace(StreamReader reader)
|
|
||||||
{
|
|
||||||
// skip all whitespace
|
|
||||||
while (!reader.EndOfStream && char.IsWhiteSpace((char)reader.Peek()))
|
|
||||||
{
|
|
||||||
reader.Read();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string ReadValue(StreamReader reader)
|
|
||||||
{
|
|
||||||
SkipWhitespace(reader);
|
|
||||||
|
|
||||||
var c = ReadSucceed(reader.Read());
|
|
||||||
if (c != '"')
|
|
||||||
{
|
|
||||||
throw new FormatException("Deps file value should start with '\"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
var value = new StringBuilder();
|
|
||||||
while (ReadSucceed(reader.Peek()) != '"')
|
|
||||||
{
|
|
||||||
c = ReadSucceed(reader.Read());
|
|
||||||
if (c == '\\')
|
|
||||||
{
|
|
||||||
value.Append(ReadSucceed(reader.Read()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value.Append(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Read last "
|
|
||||||
ReadSucceed(reader.Read());
|
|
||||||
// Read comment
|
|
||||||
if (reader.Peek() == ',')
|
|
||||||
{
|
|
||||||
reader.Read();
|
|
||||||
}
|
|
||||||
return value.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private char ReadSucceed(int c)
|
|
||||||
{
|
|
||||||
if (c == -1)
|
|
||||||
{
|
|
||||||
throw new FormatException("Unexpected end of file");
|
|
||||||
}
|
|
||||||
return (char) c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct DepsFileLine
|
|
||||||
{
|
|
||||||
public string LibraryType;
|
|
||||||
public string PackageName;
|
|
||||||
public string PackageVersion;
|
|
||||||
public string PackageHash;
|
|
||||||
public string AssetType;
|
|
||||||
public string AssetName;
|
|
||||||
public string AssetPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,13 +43,11 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
JObject runtimeTarget = null;
|
JObject runtimeTarget = null;
|
||||||
JObject compileTarget = null;
|
JObject compileTarget = null;
|
||||||
if (targetsObject != null)
|
|
||||||
{
|
|
||||||
var compileTargetProperty = targetsObject.Properties()
|
|
||||||
.FirstOrDefault(p => !IsRuntimeTarget(p.Name));
|
|
||||||
|
|
||||||
compileTarget = (JObject)compileTargetProperty.Value;
|
if (targetsObject == null)
|
||||||
target = compileTargetProperty.Name;
|
{
|
||||||
|
throw new FormatException("Dependency file does not have 'targets' section");
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(runtimeTargetName))
|
if (!string.IsNullOrEmpty(runtimeTargetName))
|
||||||
{
|
{
|
||||||
|
@ -58,20 +56,47 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
throw new FormatException($"Target with name {runtimeTargetName} not found");
|
throw new FormatException($"Target with name {runtimeTargetName} not found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var runtimeTargetProperty = targetsObject.Properties()
|
||||||
|
.FirstOrDefault(p => IsRuntimeTarget(p.Name));
|
||||||
|
|
||||||
|
runtimeTarget = (JObject)runtimeTargetProperty?.Value;
|
||||||
|
runtimeTargetName = runtimeTargetProperty?.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runtimeTargetName != null)
|
||||||
|
{
|
||||||
var seperatorIndex = runtimeTargetName.IndexOf(DependencyContextStrings.VersionSeperator);
|
var seperatorIndex = runtimeTargetName.IndexOf(DependencyContextStrings.VersionSeperator);
|
||||||
if (seperatorIndex > -1 && seperatorIndex < runtimeTargetName.Length)
|
if (seperatorIndex > -1 && seperatorIndex < runtimeTargetName.Length)
|
||||||
{
|
{
|
||||||
runtime = runtimeTargetName.Substring(seperatorIndex + 1);
|
runtime = runtimeTargetName.Substring(seperatorIndex + 1);
|
||||||
|
target = runtimeTargetName.Substring(0, seperatorIndex);
|
||||||
isPortable = false;
|
isPortable = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
runtimeTarget = compileTarget;
|
target = runtimeTargetName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ridlessTargetProperty = targetsObject.Properties().FirstOrDefault(p => !IsRuntimeTarget(p.Name));
|
||||||
|
if (ridlessTargetProperty != null)
|
||||||
|
{
|
||||||
|
compileTarget = (JObject)ridlessTargetProperty.Value;
|
||||||
|
if (runtimeTarget == null)
|
||||||
|
{
|
||||||
|
runtimeTarget = compileTarget;
|
||||||
|
target = ridlessTargetProperty.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runtimeTarget == null)
|
||||||
|
{
|
||||||
|
throw new FormatException("No runtime target found");
|
||||||
|
}
|
||||||
|
|
||||||
return new DependencyContext(
|
return new DependencyContext(
|
||||||
target,
|
target,
|
||||||
runtime,
|
runtime,
|
||||||
|
@ -104,7 +129,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CompilationOptions(
|
return new CompilationOptions(
|
||||||
compilationOptionsObject[DependencyContextStrings.DefinesPropertyName]?.Values<string>(),
|
compilationOptionsObject[DependencyContextStrings.DefinesPropertyName]?.Values<string>() ?? Enumerable.Empty<string>(),
|
||||||
compilationOptionsObject[DependencyContextStrings.LanguageVersionPropertyName]?.Value<string>(),
|
compilationOptionsObject[DependencyContextStrings.LanguageVersionPropertyName]?.Value<string>(),
|
||||||
compilationOptionsObject[DependencyContextStrings.PlatformPropertyName]?.Value<string>(),
|
compilationOptionsObject[DependencyContextStrings.PlatformPropertyName]?.Value<string>(),
|
||||||
compilationOptionsObject[DependencyContextStrings.AllowUnsafePropertyName]?.Value<bool>(),
|
compilationOptionsObject[DependencyContextStrings.AllowUnsafePropertyName]?.Value<bool>(),
|
||||||
|
|
|
@ -14,20 +14,17 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
private static Lazy<string[]> _depsFiles = new Lazy<string[]>(GetHostDepsList);
|
private static Lazy<string[]> _depsFiles = new Lazy<string[]>(GetHostDepsList);
|
||||||
|
|
||||||
private const string DepsJsonExtension = ".deps.json";
|
private const string DepsJsonExtension = ".deps.json";
|
||||||
private const string DepsExtension = ".deps";
|
|
||||||
|
|
||||||
private readonly string _entryPointDepsLocation;
|
private readonly string _entryPointDepsLocation;
|
||||||
private readonly string _runtimeDepsLocation;
|
private readonly string _runtimeDepsLocation;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IDependencyContextReader _jsonReader;
|
private readonly IDependencyContextReader _jsonReader;
|
||||||
private readonly IDependencyContextReader _csvReader;
|
|
||||||
|
|
||||||
public DependencyContextLoader() : this(
|
public DependencyContextLoader() : this(
|
||||||
GetDefaultEntrypointDepsLocation(),
|
GetDefaultEntrypointDepsLocation(),
|
||||||
GetDefaultRuntimeDepsLocation(),
|
GetDefaultRuntimeDepsLocation(),
|
||||||
FileSystemWrapper.Default,
|
FileSystemWrapper.Default,
|
||||||
new DependencyContextJsonReader(),
|
new DependencyContextJsonReader())
|
||||||
new DependencyContextCsvReader())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,14 +32,12 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
string entryPointDepsLocation,
|
string entryPointDepsLocation,
|
||||||
string runtimeDepsLocation,
|
string runtimeDepsLocation,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
IDependencyContextReader jsonReader,
|
IDependencyContextReader jsonReader)
|
||||||
IDependencyContextReader csvReader)
|
|
||||||
{
|
{
|
||||||
_entryPointDepsLocation = entryPointDepsLocation;
|
_entryPointDepsLocation = entryPointDepsLocation;
|
||||||
_runtimeDepsLocation = runtimeDepsLocation;
|
_runtimeDepsLocation = runtimeDepsLocation;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_jsonReader = jsonReader;
|
_jsonReader = jsonReader;
|
||||||
_csvReader = csvReader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DependencyContextLoader Default { get; } = new DependencyContextLoader();
|
public static DependencyContextLoader Default { get; } = new DependencyContextLoader();
|
||||||
|
@ -132,15 +127,6 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var depsFile = Path.ChangeExtension(assembly.Location, DepsExtension);
|
|
||||||
if (_fileSystem.File.Exists(depsFile))
|
|
||||||
{
|
|
||||||
using (var stream = _fileSystem.File.OpenRead(depsFile))
|
|
||||||
{
|
|
||||||
return _csvReader.Read(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,6 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(version));
|
throw new ArgumentException(nameof(version));
|
||||||
}
|
}
|
||||||
// Hash could be empty for projects
|
|
||||||
if (hash == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentException(nameof(hash));
|
|
||||||
}
|
|
||||||
if (dependencies == null)
|
if (dependencies == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(dependencies));
|
throw new ArgumentNullException(nameof(dependencies));
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
|
|
||||||
namespace StreamForwarderTests
|
namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
{
|
{
|
||||||
public class CompositeResolverTests
|
public class CompositeResolverTests
|
||||||
{
|
{
|
||||||
|
@ -55,14 +55,7 @@ namespace StreamForwarderTests
|
||||||
failTwo.Object
|
failTwo.Object
|
||||||
};
|
};
|
||||||
|
|
||||||
var library = new CompilationLibrary(
|
var library = TestLibraryFactory.Create();
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
Enumerable.Empty<string>(),
|
|
||||||
Enumerable.Empty<Dependency>(),
|
|
||||||
false);
|
|
||||||
|
|
||||||
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
||||||
var result = resolver.TryResolveAssemblyPaths(library, null);
|
var result = resolver.TryResolveAssemblyPaths(library, null);
|
||||||
|
@ -90,14 +83,7 @@ namespace StreamForwarderTests
|
||||||
};
|
};
|
||||||
|
|
||||||
var assemblies = new List<string>();
|
var assemblies = new List<string>();
|
||||||
var library = new CompilationLibrary(
|
var library = TestLibraryFactory.Create();
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
string.Empty,
|
|
||||||
Enumerable.Empty<string>(),
|
|
||||||
Enumerable.Empty<Dependency>(),
|
|
||||||
false);
|
|
||||||
|
|
||||||
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
||||||
var result = resolver.TryResolveAssemblyPaths(library, assemblies);
|
var result = resolver.TryResolveAssemblyPaths(library, assemblies);
|
||||||
|
|
|
@ -1,94 +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 System.Threading.Tasks;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.Extensions.DependencyModel;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyModel.Tests
|
|
||||||
{
|
|
||||||
public class DependencyContextCsvReaderTests
|
|
||||||
{
|
|
||||||
private DependencyContext Read(string text)
|
|
||||||
{
|
|
||||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
|
|
||||||
{
|
|
||||||
return new DependencyContextCsvReader().Read(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void GroupsAssetsCorrectlyIntoLibraries()
|
|
||||||
{
|
|
||||||
var context = Read(@"
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.Runtime.dll""
|
|
||||||
");
|
|
||||||
context.RuntimeLibraries.Should().HaveCount(1);
|
|
||||||
var library = context.RuntimeLibraries.Single();
|
|
||||||
library.Type.Should().Be("Package");
|
|
||||||
library.Name.Should().Be("runtime.any.System.AppContext");
|
|
||||||
library.Version.Should().Be("4.1.0-rc2-23811");
|
|
||||||
library.Hash.Should().Be("sha512-1");
|
|
||||||
library.Assemblies.Should().HaveCount(2).And
|
|
||||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll").And
|
|
||||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.Runtime.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void IgnoresAllButRuntimeAssets()
|
|
||||||
{
|
|
||||||
var context = Read(@"
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""native"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext2.so""
|
|
||||||
");
|
|
||||||
context.RuntimeLibraries.Should().HaveCount(1);
|
|
||||||
var library = context.RuntimeLibraries.Single();
|
|
||||||
library.Assemblies.Should().HaveCount(1).And
|
|
||||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void IgnoresNiDllAssemblies()
|
|
||||||
{
|
|
||||||
var context = Read(@"
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.ni.dll""
|
|
||||||
");
|
|
||||||
context.RuntimeLibraries.Should().HaveCount(1);
|
|
||||||
var library = context.RuntimeLibraries.Single();
|
|
||||||
library.Assemblies.Should().HaveCount(1).And
|
|
||||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void UsesTypeNameVersionAndHashToGroup()
|
|
||||||
{
|
|
||||||
var context = Read(@"
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23812"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-2"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Package"",""runtime.any.System.AppContext2"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
""Project"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
|
||||||
");
|
|
||||||
context.RuntimeLibraries.Should().HaveCount(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("text")]
|
|
||||||
[InlineData(" ")]
|
|
||||||
[InlineData("\"")]
|
|
||||||
[InlineData(@""",""")]
|
|
||||||
[InlineData(@"\\")]
|
|
||||||
public void ThrowsFormatException(string intput)
|
|
||||||
{
|
|
||||||
Assert.Throws<FormatException>(() => Read(intput));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -26,7 +26,6 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
@"{
|
@"{
|
||||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||||
""targets"": {
|
""targets"": {
|
||||||
"".NETStandardApp,Version=v1.5"": {},
|
|
||||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
@ -35,21 +34,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
context.Runtime.Should().Be("osx.10.10-x64");
|
context.Runtime.Should().Be("osx.10.10-x64");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void DefaultsToPortable()
|
|
||||||
{
|
|
||||||
var context = Read(
|
|
||||||
@"{
|
|
||||||
}");
|
|
||||||
context.IsPortable.Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SetsPortableIfRuntimeTargetHasNoRid()
|
public void SetsPortableIfRuntimeTargetHasNoRid()
|
||||||
{
|
{
|
||||||
var context = Read(
|
var context = Read(
|
||||||
@"{
|
@"{
|
||||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5"",
|
|
||||||
""targets"": {
|
""targets"": {
|
||||||
"".NETStandardApp,Version=v1.5"": {}
|
"".NETStandardApp,Version=v1.5"": {}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +53,6 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
@"{
|
@"{
|
||||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||||
""targets"": {
|
""targets"": {
|
||||||
"".NETStandardApp,Version=v1.5"": {},
|
|
||||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
|
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
@ -88,6 +76,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
{
|
{
|
||||||
var context = Read(
|
var context = Read(
|
||||||
@"{
|
@"{
|
||||||
|
""targets"": {
|
||||||
|
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||||
|
},
|
||||||
""runtimes"": {
|
""runtimes"": {
|
||||||
""osx.10.10-x64"": [ ],
|
""osx.10.10-x64"": [ ],
|
||||||
""osx.10.11-x64"": [ ""osx"" ],
|
""osx.10.11-x64"": [ ""osx"" ],
|
||||||
|
@ -237,6 +228,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
""publicSign"": true,
|
""publicSign"": true,
|
||||||
""warningsAsErrors"": true,
|
""warningsAsErrors"": true,
|
||||||
""optimize"": true
|
""optimize"": true
|
||||||
|
},
|
||||||
|
""targets"": {
|
||||||
|
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
context.CompilationOptions.AllowUnsafe.Should().Be(true);
|
context.CompilationOptions.AllowUnsafe.Should().Be(true);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
||||||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null)
|
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null)
|
||||||
{
|
{
|
||||||
return new DependencyContext(
|
return new DependencyContext(
|
||||||
target ?? string.Empty,
|
target ?? "DefaultTarget",
|
||||||
runtime ?? string.Empty,
|
runtime ?? string.Empty,
|
||||||
isPortable ?? false,
|
isPortable ?? false,
|
||||||
compilationOptions ?? CompilationOptions.Default,
|
compilationOptions ?? CompilationOptions.Default,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue