Merge branch 'rel/1.0.0' into brthor/add_back_docker_hub
This commit is contained in:
commit
8d4d9a3b12
30 changed files with 275 additions and 100 deletions
|
@ -83,6 +83,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "update-dependencies", "scri
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Utils.Tests", "test\Microsoft.DotNet.Cli.Utils.Tests\Microsoft.DotNet.Cli.Utils.Tests.xproj", "{09C52F96-EFDD-4448-95EC-6D362DD60BAA}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RuntimeGraphGenerator", "tools\RuntimeGraphGenerator\RuntimeGraphGenerator.xproj", "{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -591,6 +593,22 @@ Global
|
|||
{09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{09C52F96-EFDD-4448-95EC-6D362DD60BAA}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -629,5 +647,6 @@ Global
|
|||
{60C33D0A-A5D8-4AB0-9956-1F804654DF05} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||
{09C52F96-EFDD-4448-95EC-6D362DD60BAA} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{EFC4FE68-83EB-40E4-BFA8-61D0B4626F25} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -29,7 +29,7 @@ Installers
|
|||
|---------|:------:|:------:|:------:|
|
||||
|**Windows x64**||[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-win-x64.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-win-x64.latest.zip)|
|
||||
|**Windows x86**||[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-win-x86.latest.exe)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-win-x86.latest.zip)|
|
||||
|**Ubuntu 14.04**||[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-ubuntu-x64.latest.deb)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-ubuntu-x64.latest.tar.gz)|
|
||||
|**Ubuntu 14.04**||[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-ubuntu-x64.latest.tar.gz)|
|
||||
|**Mac OS X**||[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg)|[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-osx-x64.latest.tar.gz)|
|
||||
|**CentOS 7.1**||N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-centos-x64.latest.tar.gz)|
|
||||
|**RHEL 7.2**||N/A |[Download](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-rhel-x64.latest.tar.gz) |
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"projects": [ "src", "test" ]
|
||||
"projects": [ "src", "test", "tools" ]
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"Microsoft.CSharp": "4.0.1-rc2-23911",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-23911",
|
||||
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*",
|
||||
"NuGet.Versioning": "3.4.0-rtm-0764",
|
||||
"NuGet.Versioning": "3.5.0-beta-1068",
|
||||
"Newtonsoft.Json": "7.0.1",
|
||||
"Octokit": "0.18.0",
|
||||
"Microsoft.Net.Http": "2.2.29"
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
"dependencies": {
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537",
|
||||
"NuGet.Versioning": "3.5.0-beta-1034",
|
||||
"NuGet.Packaging": "3.5.0-beta-1034",
|
||||
"NuGet.Frameworks": "3.5.0-beta-1034",
|
||||
"NuGet.ProjectModel": "3.5.0-beta-1034"
|
||||
"NuGet.Versioning": "3.5.0-beta-1068",
|
||||
"NuGet.Packaging": "3.5.0-beta-1068",
|
||||
"NuGet.Frameworks": "3.5.0-beta-1068",
|
||||
"NuGet.ProjectModel": "3.5.0-beta-1068"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
@ -5,6 +5,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
|
@ -49,16 +51,41 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
var compilationOptions = compilerOptions != null
|
||||
? GetCompilationOptions(compilerOptions)
|
||||
: CompilationOptions.Default;
|
||||
|
||||
var runtimeSignature = GenerateRuntimeSignature(runtimeExports);
|
||||
|
||||
return new DependencyContext(
|
||||
target.DotNetFrameworkName,
|
||||
runtime,
|
||||
portable,
|
||||
new TargetInfo(target.DotNetFrameworkName, runtime, runtimeSignature, portable),
|
||||
compilationOptions,
|
||||
GetLibraries(compilationExports, dependencyLookup, runtime: false).Cast<CompilationLibrary>(),
|
||||
GetLibraries(runtimeExports, dependencyLookup, runtime: true).Cast<RuntimeLibrary>(),
|
||||
new RuntimeFallbacks[] {});
|
||||
}
|
||||
|
||||
private static string GenerateRuntimeSignature(IEnumerable<LibraryExport> runtimeExports)
|
||||
{
|
||||
var sha1 = SHA1.Create();
|
||||
var builder = new StringBuilder();
|
||||
var packages = runtimeExports
|
||||
.Where(libraryExport => libraryExport.Library.Identity.Type == LibraryType.Package);
|
||||
var seperator = "|";
|
||||
foreach (var libraryExport in packages)
|
||||
{
|
||||
builder.Append(libraryExport.Library.Identity.Name);
|
||||
builder.Append(seperator);
|
||||
builder.Append(libraryExport.Library.Identity.Version.ToString());
|
||||
builder.Append(seperator);
|
||||
}
|
||||
var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(builder.ToString()));
|
||||
|
||||
builder.Clear();
|
||||
foreach (var b in hash)
|
||||
{
|
||||
builder.AppendFormat("{0:x2}", b);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private static CompilationOptions GetCompilationOptions(CommonCompilerOptions compilerOptions)
|
||||
{
|
||||
return new CompilationOptions(compilerOptions.Defines,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"description": "Types to model a .NET Project",
|
||||
"dependencies": {
|
||||
"System.Reflection.Metadata": "1.2.0-rc2-23904",
|
||||
"NuGet.Packaging": "3.5.0-beta-1034",
|
||||
"NuGet.Packaging": "3.5.0-beta-1068",
|
||||
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
||||
"Microsoft.Extensions.JsonParser.Sources": {
|
||||
"type": "build",
|
||||
|
|
|
@ -10,21 +10,47 @@ using Microsoft.Extensions.PlatformAbstractions;
|
|||
|
||||
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; }
|
||||
|
||||
}
|
||||
|
||||
public class DependencyContext
|
||||
{
|
||||
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||
|
||||
public DependencyContext(string targetFramework,
|
||||
string runtime,
|
||||
bool isPortable,
|
||||
public DependencyContext(TargetInfo target,
|
||||
CompilationOptions compilationOptions,
|
||||
IEnumerable<CompilationLibrary> compileLibraries,
|
||||
IEnumerable<RuntimeLibrary> runtimeLibraries,
|
||||
IEnumerable<RuntimeFallbacks> runtimeGraph)
|
||||
{
|
||||
if (string.IsNullOrEmpty(targetFramework))
|
||||
if (target == null)
|
||||
{
|
||||
throw new ArgumentException(nameof(targetFramework));
|
||||
throw new ArgumentNullException(nameof(target));
|
||||
}
|
||||
if (compilationOptions == null)
|
||||
{
|
||||
|
@ -43,9 +69,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
throw new ArgumentNullException(nameof(runtimeGraph));
|
||||
}
|
||||
|
||||
TargetFramework = targetFramework;
|
||||
Runtime = runtime;
|
||||
IsPortable = isPortable;
|
||||
Target = target;
|
||||
CompilationOptions = compilationOptions;
|
||||
CompileLibraries = compileLibraries.ToArray();
|
||||
RuntimeLibraries = runtimeLibraries.ToArray();
|
||||
|
@ -54,11 +78,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
public static DependencyContext Default => _defaultContext.Value;
|
||||
|
||||
public string TargetFramework { get; }
|
||||
|
||||
public string Runtime { get; }
|
||||
|
||||
public bool IsPortable { get; }
|
||||
public TargetInfo Target { get; }
|
||||
|
||||
public CompilationOptions CompilationOptions { get; }
|
||||
|
||||
|
@ -76,9 +96,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
}
|
||||
|
||||
return new DependencyContext(
|
||||
TargetFramework,
|
||||
Runtime,
|
||||
IsPortable,
|
||||
Target,
|
||||
CompilationOptions,
|
||||
CompileLibraries.Union(other.CompileLibraries, new LibraryMergeEqualityComparer<CompilationLibrary>()),
|
||||
RuntimeLibraries.Union(other.RuntimeLibraries, new LibraryMergeEqualityComparer<RuntimeLibrary>()),
|
||||
|
|
|
@ -35,8 +35,22 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
var runtime = string.Empty;
|
||||
var target = string.Empty;
|
||||
var isPortable = true;
|
||||
string runtimeTargetName = null;
|
||||
string runtimeSignature = null;
|
||||
|
||||
var runtimeTargetName = root[DependencyContextStrings.RuntimeTargetPropertyName]?.Value<string>();
|
||||
var runtimeTargetInfo = root[DependencyContextStrings.RuntimeTargetPropertyName];
|
||||
|
||||
// This fallback is temporary
|
||||
if (runtimeTargetInfo is JValue)
|
||||
{
|
||||
runtimeTargetName = runtimeTargetInfo.Value<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
var runtimeTargetObject = (JObject) runtimeTargetInfo;
|
||||
runtimeTargetName = runtimeTargetObject?[DependencyContextStrings.RuntimeTargetNamePropertyName]?.Value<string>();
|
||||
runtimeSignature = runtimeTargetObject?[DependencyContextStrings.RuntimeTargetSignaturePropertyName]?.Value<string>();
|
||||
}
|
||||
|
||||
var libraryStubs = ReadLibraryStubs((JObject)root[DependencyContextStrings.LibrariesPropertyName]);
|
||||
var targetsObject = (JObject)root[DependencyContextStrings.TargetsPropertyName];
|
||||
|
@ -98,9 +112,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
}
|
||||
|
||||
return new DependencyContext(
|
||||
target,
|
||||
runtime,
|
||||
isPortable,
|
||||
new TargetInfo(target, runtime, runtimeSignature, isPortable),
|
||||
ReadCompilationOptions((JObject)root[DependencyContextStrings.CompilationOptionsPropertName]),
|
||||
ReadLibraries(compileTarget, false, libraryStubs).Cast<CompilationLibrary>().ToArray(),
|
||||
ReadLibraries(runtimeTarget, true, libraryStubs).Cast<RuntimeLibrary>().ToArray(),
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
context = LoadAssemblyContext(assembly);
|
||||
}
|
||||
|
||||
if (context?.IsPortable == true)
|
||||
if (context?.Target.IsPortable == true)
|
||||
{
|
||||
var runtimeContext = LoadRuntimeContext();
|
||||
if (runtimeContext != null)
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
internal const string RuntimeTargetNamePropertyName = "name";
|
||||
|
||||
internal const string RuntimeTargetSignaturePropertyName = "signature";
|
||||
|
||||
internal const string RuntimesPropertyName = "runtimes";
|
||||
|
||||
internal const string RuntimeTargetsPropertyName = "runtimeTargets";
|
||||
|
|
|
@ -48,11 +48,18 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
return contextObject;
|
||||
}
|
||||
|
||||
private string WriteRuntimeTargetInfo(DependencyContext context)
|
||||
private JObject WriteRuntimeTargetInfo(DependencyContext context)
|
||||
{
|
||||
return context.IsPortable ?
|
||||
context.TargetFramework :
|
||||
context.TargetFramework + DependencyContextStrings.VersionSeperator + context.Runtime;
|
||||
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)
|
||||
|
@ -93,16 +100,16 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
private JObject WriteTargets(DependencyContext context)
|
||||
{
|
||||
if (context.IsPortable)
|
||||
if (context.Target.IsPortable)
|
||||
{
|
||||
return new JObject(
|
||||
new JProperty(context.TargetFramework, WritePortableTarget(context.RuntimeLibraries, context.CompileLibraries))
|
||||
new JProperty(context.Target.Framework, WritePortableTarget(context.RuntimeLibraries, context.CompileLibraries))
|
||||
);
|
||||
}
|
||||
|
||||
return new JObject(
|
||||
new JProperty(context.TargetFramework, WriteTarget(context.CompileLibraries)),
|
||||
new JProperty(context.TargetFramework + DependencyContextStrings.VersionSeperator + context.Runtime,
|
||||
new JProperty(context.Target.Framework, WriteTarget(context.CompileLibraries)),
|
||||
new JProperty(context.Target.Framework + DependencyContextStrings.VersionSeperator + context.Target.Runtime,
|
||||
WriteTarget(context.RuntimeLibraries))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ struct arguments_t
|
|||
pal::string_t app_dir;
|
||||
pal::string_t deps_path;
|
||||
pal::string_t dotnet_servicing;
|
||||
pal::string_t dotnet_runtime_servicing;
|
||||
pal::string_t dotnet_home;
|
||||
pal::string_t probe_dir;
|
||||
pal::string_t dotnet_packages_cache;
|
||||
pal::string_t managed_application;
|
||||
|
@ -25,6 +23,15 @@ struct arguments_t
|
|||
const pal::char_t** app_argv;
|
||||
|
||||
arguments_t();
|
||||
|
||||
inline void print()
|
||||
{
|
||||
if (trace::is_enabled())
|
||||
{
|
||||
trace::verbose(_X("args: own_path=%s app_dir=%s deps=%s servicing=%s probe_dir=%s packages_cache=%s mgd_app=%s"),
|
||||
own_path.c_str(), app_dir.c_str(), deps_path.c_str(), dotnet_servicing.c_str(), probe_dir.c_str(), dotnet_packages_cache.c_str(), managed_application.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool parse_arguments(const pal::string_t& deps_path, const pal::string_t& probe_dir, host_mode_t mode, const int argc, const pal::char_t* argv[], arguments_t* args);
|
||||
|
|
|
@ -292,6 +292,21 @@ bool deps_json_t::load_standalone(const json_value& json, const pal::string_t& t
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (trace::is_enabled())
|
||||
{
|
||||
trace::verbose(_X("The rid fallback graph is: {"));
|
||||
for (const auto& rid : m_rid_fallback_graph)
|
||||
{
|
||||
trace::verbose(_X("%s => ["), rid.first.c_str());
|
||||
for (const auto& fallback : rid.second)
|
||||
{
|
||||
trace::verbose(_X("%s, "), fallback.c_str());
|
||||
}
|
||||
trace::verbose(_X("]"));
|
||||
}
|
||||
trace::verbose(_X("}"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -304,6 +319,7 @@ bool deps_json_t::load(bool portable, const pal::string_t& deps_path, const rid_
|
|||
// If file doesn't exist, then assume parsed.
|
||||
if (!pal::file_exists(deps_path))
|
||||
{
|
||||
trace::verbose(_X("Deps file does not exist [%s]"), deps_path.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -311,6 +327,7 @@ bool deps_json_t::load(bool portable, const pal::string_t& deps_path, const rid_
|
|||
pal::ifstream_t file(deps_path);
|
||||
if (!file.good())
|
||||
{
|
||||
trace::error(_X("Could not open file stream on deps file [%s]"), deps_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -319,7 +336,12 @@ bool deps_json_t::load(bool portable, const pal::string_t& deps_path, const rid_
|
|||
const auto json = json_value::parse(file);
|
||||
|
||||
const auto& runtime_target = json.at(_X("runtimeTarget"));
|
||||
const pal::string_t& name = runtime_target.as_string();
|
||||
|
||||
const pal::string_t& name = runtime_target.is_string()?
|
||||
runtime_target.as_string():
|
||||
runtime_target.at(_X("name")).as_string();
|
||||
|
||||
trace::verbose(_X("Loading deps file... %s as portable=[%d]"), deps_path.c_str(), portable);
|
||||
|
||||
return (portable) ? load_portable(json, name, rid_fallback_graph) : load_standalone(json, name);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
if (m_portable)
|
||||
{
|
||||
m_fx_deps_file = get_fx_deps(fx_dir, config->get_fx_name());
|
||||
trace::verbose(_X("Using %s FX deps file"), m_fx_deps_file.c_str());
|
||||
trace::verbose(_X("Using %s deps file"), m_deps_file.c_str());
|
||||
m_fx_deps = std::unique_ptr<deps_json_t>(new deps_json_t(false, m_fx_deps_file));
|
||||
m_deps = std::unique_ptr<deps_json_t>(new deps_json_t(true, m_deps_file, m_fx_deps->get_rid_fallback_graph()));
|
||||
}
|
||||
|
@ -74,7 +76,7 @@ private:
|
|||
static pal::string_t get_fx_deps(const pal::string_t& fx_dir, const pal::string_t& fx_name)
|
||||
{
|
||||
pal::string_t fx_deps = fx_dir;
|
||||
pal::string_t fx_deps_name = pal::to_lower(fx_name) + _X(".deps.json");
|
||||
pal::string_t fx_deps_name = fx_name + _X(".deps.json");
|
||||
append_path(&fx_deps, fx_deps_name.c_str());
|
||||
return fx_deps;
|
||||
}
|
||||
|
|
|
@ -277,6 +277,7 @@ int fx_muxer_t::execute(const int argc, const pal::char_t* argv[])
|
|||
{
|
||||
std::vector<pal::string_t> known_opts = { _X("--depsfile"), _X("--additionalprobingpath") };
|
||||
|
||||
trace::verbose(_X("Exec mode, parsing known args"));
|
||||
int num_args = 0;
|
||||
std::unordered_map<pal::string_t, pal::string_t> opts;
|
||||
if (!parse_known_args(argc - 2, &argv[2], known_opts, &opts, &num_args))
|
||||
|
@ -302,8 +303,11 @@ int fx_muxer_t::execute(const int argc, const pal::char_t* argv[])
|
|||
pal::string_t deps_file = opts.count(opts_deps_file) ? opts[opts_deps_file] : _X("");
|
||||
pal::string_t probe_path = opts.count(opts_probe_path) ? opts[opts_probe_path] : _X("");
|
||||
|
||||
trace::verbose(_X("Current argv is %s"), argv[cur_i]);
|
||||
|
||||
pal::string_t app_or_deps = deps_file.empty() ? argv[cur_i] : deps_file;
|
||||
auto config_file = get_runtime_config_from_file(app_or_deps);
|
||||
pal::string_t no_json = deps_file.empty() ? app_or_deps : strip_file_ext(app_or_deps);
|
||||
auto config_file = get_runtime_config_from_file(no_json);
|
||||
runtime_config_t config(config_file);
|
||||
if (!config.is_valid())
|
||||
{
|
||||
|
|
|
@ -205,12 +205,30 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[])
|
|||
|
||||
assert(g_init);
|
||||
|
||||
if (trace::is_enabled())
|
||||
{
|
||||
trace::info(_X("--- Invoked policy main = {"));
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
trace::info(_X("%s"), argv[i]);
|
||||
}
|
||||
trace::info(_X("}"));
|
||||
|
||||
trace::info(_X("Host mode: %d"), g_init->host_mode());
|
||||
trace::info(_X("Deps file: %s"), g_init->deps_file().c_str());
|
||||
trace::info(_X("Probe dir: %s"), g_init->probe_dir().c_str());
|
||||
}
|
||||
|
||||
// Take care of arguments
|
||||
arguments_t args;
|
||||
if (!parse_arguments(g_init->deps_file(), g_init->probe_dir(), g_init->host_mode(), argc, argv, &args))
|
||||
{
|
||||
return StatusCode::LibHostInvalidArgs;
|
||||
}
|
||||
if (trace::is_enabled())
|
||||
{
|
||||
args.print();
|
||||
}
|
||||
|
||||
if (g_init->runtime_config())
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
pal::string_t get_runtime_config_from_file(const pal::string_t& file)
|
||||
{
|
||||
auto name = get_filename_without_ext(file);
|
||||
name = name.substr(0, name.find(_X('.')));
|
||||
auto json_name = name + _X(".runtimeconfig.json");
|
||||
auto json_path = get_directory(file);
|
||||
|
||||
|
@ -40,7 +39,7 @@ host_mode_t detect_operating_mode(const int argc, const pal::char_t* argv[], pal
|
|||
pal::string_t own_dll_filename = strip_file_ext(own_name) + _X(".dll");
|
||||
pal::string_t own_dll = own_dir;
|
||||
append_path(&own_dll, own_dll_filename.c_str());
|
||||
trace::info(_X("Exists %s"), own_dll.c_str());
|
||||
trace::info(_X("Own DLL path=[%s]"), own_dll.c_str());
|
||||
if (coreclr_exists_in_dir(own_dir) || pal::file_exists(own_dll))
|
||||
{
|
||||
pal::string_t own_deps_json = own_dir;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#include "pal.h"
|
||||
#include "trace.h"
|
||||
#include "utils.h"
|
||||
#include "cpprest/json.h"
|
||||
#include "runtime_config.h"
|
||||
|
@ -13,6 +14,7 @@ runtime_config_t::runtime_config_t(const pal::string_t& path)
|
|||
, m_portable(false)
|
||||
{
|
||||
m_valid = ensure_parsed();
|
||||
trace::verbose(_X("Runtime config [%s] is valid=[%d]"), path.c_str(), m_valid);
|
||||
}
|
||||
|
||||
bool runtime_config_t::parse_opts(const json_value& opts)
|
||||
|
@ -70,6 +72,7 @@ bool runtime_config_t::ensure_parsed()
|
|||
pal::ifstream_t file(m_path);
|
||||
if (!file.good())
|
||||
{
|
||||
trace::verbose(_X("File stream not good %s"), m_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -85,6 +88,7 @@ bool runtime_config_t::ensure_parsed()
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
trace::warning(_X("Json exception occurred."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -77,7 +77,13 @@ pal::string_t strip_file_ext(const pal::string_t& path)
|
|||
{
|
||||
return path;
|
||||
}
|
||||
return path.substr(0, path.rfind(_X('.')));
|
||||
size_t sep_pos = path.rfind(_X("/\\"));
|
||||
size_t dot_pos = path.rfind(_X('.'));
|
||||
if (sep_pos != pal::string_t::npos && sep_pos > dot_pos)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
return path.substr(0, dot_pos);
|
||||
}
|
||||
|
||||
pal::string_t get_filename_without_ext(const pal::string_t& path)
|
||||
|
@ -167,6 +173,7 @@ bool parse_known_args(
|
|||
return false;
|
||||
}
|
||||
|
||||
trace::verbose(_X("Parsed known arg %s = %s"), arg.c_str(), argv[arg_i + 1]);
|
||||
(*opts)[arg] = argv[arg_i + 1];
|
||||
|
||||
// Increment for both the option and its value.
|
||||
|
|
|
@ -36,6 +36,12 @@ namespace Microsoft.DotNet.Tools.Restore
|
|||
var quiet = args.Any(s => s.Equals("--quiet", StringComparison.OrdinalIgnoreCase));
|
||||
args = args.Where(s => !s.Equals("--quiet", StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
|
||||
// Always infer runtimes in dotnet-restore (for now).
|
||||
if (!args.Any(s => s.Equals("--infer-runtimes", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
args = Enumerable.Concat(new [] { "--infer-runtimes" }, args).ToArray();
|
||||
}
|
||||
|
||||
app.OnExecute(() =>
|
||||
{
|
||||
try
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"NuGet.Commands": {
|
||||
"version": "3.5.0-beta-1034",
|
||||
"version": "3.5.0-beta-1068",
|
||||
"exclude": "compile"
|
||||
},
|
||||
"NuGet.CommandLine.XPlat": "3.5.0-beta-1034",
|
||||
"NuGet.CommandLine.XPlat": "3.5.0-beta-1068",
|
||||
|
||||
"Newtonsoft.Json": "7.0.1",
|
||||
"Microsoft.Net.Compilers.netcore": "1.3.0-beta1-20160225-02",
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"NuGet.Versioning": "3.5.0-beta-1034",
|
||||
"NuGet.Packaging": "3.5.0-beta-1034",
|
||||
"NuGet.Frameworks": "3.5.0-beta-1034",
|
||||
"NuGet.ProjectModel": "3.5.0-beta-1034",
|
||||
"NuGet.Versioning": "3.5.0-beta-1068",
|
||||
"NuGet.Packaging": "3.5.0-beta-1068",
|
||||
"NuGet.Frameworks": "3.5.0-beta-1068",
|
||||
"NuGet.ProjectModel": "3.5.0-beta-1068",
|
||||
|
||||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
|
|
|
@ -84,15 +84,15 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Build(portable: true);
|
||||
|
||||
context.IsPortable.Should().BeTrue();
|
||||
context.Target.IsPortable.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FillsRuntimeAndTarget()
|
||||
{
|
||||
var context = Build(target: new NuGetFramework("SomeFramework",new Version(1,2)), runtime: "win8-x86");
|
||||
context.Runtime.Should().Be("win8-x86");
|
||||
context.TargetFramework.Should().Be("SomeFramework,Version=v1.2");
|
||||
context.Target.Runtime.Should().Be("win8-x86");
|
||||
context.Target.Framework.Should().Be("SomeFramework,Version=v1.2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -291,6 +291,19 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
lib.Dependencies.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GeneratesRuntimeSignatureOutOfPackageNamesAndVersions()
|
||||
{
|
||||
var context = Build(runtimeExports: new[]
|
||||
{
|
||||
Export(PackageDescription("Pack.Age", new NuGetVersion(1, 2, 3))),
|
||||
Export(PackageDescription("Pack.Age", new NuGetVersion(1, 2, 3))),
|
||||
});
|
||||
|
||||
context.Target.RuntimeSignature.Should().Be("d0fc00006ed69e4aae80383dda08599a6892fd31");
|
||||
}
|
||||
|
||||
|
||||
private LibraryExport Export(
|
||||
LibraryDescription description,
|
||||
IEnumerable<LibraryAsset> compilationAssemblies = null,
|
||||
|
|
|
@ -25,14 +25,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""runtimeTarget"": {
|
||||
""name"":"".NETStandardApp,Version=v1.5/osx.10.10-x64""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeFalse();
|
||||
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Runtime.Should().Be("osx.10.10-x64");
|
||||
context.Target.IsPortable.Should().BeFalse();
|
||||
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Target.Runtime.Should().Be("osx.10.10-x64");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -44,7 +46,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
"".NETStandardApp,Version=v1.5"": {}
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeTrue();
|
||||
context.Target.IsPortable.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -52,12 +54,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""runtimeTarget"": {
|
||||
""name"": "".NETStandardApp,Version=v1.5/osx.10.10-x64""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
|
||||
}
|
||||
}");
|
||||
context.IsPortable.Should().BeFalse();
|
||||
context.Target.IsPortable.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -69,7 +73,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
"".NETStandardApp,Version=v1.5"": {}
|
||||
}
|
||||
}");
|
||||
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
context.Target.Framework.Should().Be(".NETStandardApp,Version=v1.5");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -152,7 +156,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5"",
|
||||
""runtimeTarget"": {
|
||||
""name"": "".NETStandardApp,Version=v1.5""
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5"": {
|
||||
""MyApp/1.0.1"": {
|
||||
|
|
|
@ -37,12 +37,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
CompilationOptions compilationOptions = null,
|
||||
CompilationLibrary[] compileLibraries = null,
|
||||
RuntimeLibrary[] runtimeLibraries = null,
|
||||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null)
|
||||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null,
|
||||
string runtimeSignature = null)
|
||||
{
|
||||
return new DependencyContext(
|
||||
return new DependencyContext(new TargetInfo(
|
||||
target ?? "DefaultTarget",
|
||||
runtime ?? string.Empty,
|
||||
isPortable ?? false,
|
||||
runtimeSignature ?? string.Empty,
|
||||
isPortable ?? false),
|
||||
compilationOptions ?? CompilationOptions.Default,
|
||||
compileLibraries ?? new CompilationLibrary[0],
|
||||
runtimeLibraries ?? new RuntimeLibrary[0],
|
||||
|
@ -80,10 +82,13 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
var result = Save(Create(
|
||||
"Target",
|
||||
"runtime",
|
||||
false)
|
||||
false,
|
||||
runtimeSignature: "runtimeSignature")
|
||||
);
|
||||
|
||||
result.Should().HavePropertyValue("runtimeTarget", "Target/runtime");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("name", "Target/runtime");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("signature", "runtimeSignature");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -92,9 +97,13 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
var result = Save(Create(
|
||||
"Target",
|
||||
"runtime",
|
||||
true)
|
||||
true,
|
||||
runtimeSignature: "runtimeSignature")
|
||||
);
|
||||
result.Should().HavePropertyValue("runtimeTarget", "Target");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("name", "Target");
|
||||
result.Should().HavePropertyAsObject("runtimeTarget")
|
||||
.Which.Should().HavePropertyValue("signature", "runtimeSignature");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -39,18 +39,14 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
};
|
||||
|
||||
var context = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
compilationLibraries,
|
||||
runtimeLibraries,
|
||||
new RuntimeFallbacks[] { });
|
||||
|
||||
var contextRedist = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
compilationLibrariesRedist,
|
||||
runtimeLibrariesRedist,
|
||||
|
@ -76,9 +72,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
public void MergeMergesRuntimeGraph()
|
||||
{
|
||||
var context = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
Enumerable.Empty<CompilationLibrary>(),
|
||||
Enumerable.Empty<RuntimeLibrary>(),
|
||||
|
@ -88,9 +82,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
});
|
||||
|
||||
var contextRedist = new DependencyContext(
|
||||
"Framework",
|
||||
"runtime",
|
||||
true,
|
||||
CreateTargetInfo(),
|
||||
CompilationOptions.Default,
|
||||
Enumerable.Empty<CompilationLibrary>(),
|
||||
Enumerable.Empty<RuntimeLibrary>(),
|
||||
|
@ -106,6 +98,15 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
Subject.Fallbacks.Should().BeEquivalentTo("win7-x64", "win7-x86");
|
||||
}
|
||||
|
||||
private TargetInfo CreateTargetInfo()
|
||||
{
|
||||
return new TargetInfo(
|
||||
"Framework",
|
||||
"runtime",
|
||||
"runtimeSignature",
|
||||
true);
|
||||
}
|
||||
|
||||
private CompilationLibrary CreateCompilation(string name)
|
||||
{
|
||||
return new CompilationLibrary(
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
[InlineData("FlibbidyFlob", "FlibbidyFlob")]
|
||||
public void GetRuntimeAssemblyNamesExtractsCorrectAssemblyName(string path, string expected)
|
||||
{
|
||||
var context = new DependencyContext(
|
||||
".NETStandard,Version=v1.3",
|
||||
string.Empty,
|
||||
isPortable: true,
|
||||
var context = new DependencyContext(new TargetInfo(".NETStandard,Version=v1.3", string.Empty, string.Empty, true),
|
||||
compilationOptions: CompilationOptions.Default,
|
||||
compileLibraries: new CompilationLibrary[] { },
|
||||
runtimeLibraries: new[] {
|
||||
|
@ -94,10 +91,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
|
||||
private DependencyContext BuildTestContext()
|
||||
{
|
||||
return new DependencyContext(
|
||||
".NETStandard,Version=v1.3",
|
||||
string.Empty,
|
||||
isPortable: true,
|
||||
return new DependencyContext(new TargetInfo(".NETStandard,Version=v1.3", string.Empty, string.Empty, true),
|
||||
compilationOptions: CompilationOptions.Default,
|
||||
compileLibraries: new[]
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace RuntimeGraphGenerator
|
|||
{
|
||||
context = new DependencyContextJsonReader().Read(depsStream);
|
||||
}
|
||||
var framework = NuGetFramework.Parse(context.TargetFramework);
|
||||
var framework = NuGetFramework.Parse(context.Target.Framework);
|
||||
var projectContext = ProjectContext.Create(projectDirectory, framework);
|
||||
|
||||
// Configuration is used only for P2P dependencies so were don't care
|
||||
|
@ -79,9 +79,7 @@ namespace RuntimeGraphGenerator
|
|||
var expandedGraph = manager.Expand(graph, runtimes);
|
||||
|
||||
context = new DependencyContext(
|
||||
context.TargetFramework,
|
||||
context.Runtime,
|
||||
context.IsPortable,
|
||||
context.Target,
|
||||
context.CompilationOptions,
|
||||
context.CompileLibraries,
|
||||
context.RuntimeLibraries,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {
|
||||
"NuGet.RuntimeModel": "3.5.0-beta-1034",
|
||||
"NuGet.Versioning": "3.5.0-beta-1034",
|
||||
"NuGet.RuntimeModel": "3.5.0-beta-1068",
|
||||
"NuGet.Versioning": "3.5.0-beta-1068",
|
||||
"System.CommandLine": "0.1.0-e160119-1",
|
||||
"System.Runtime.Serialization.Json": "1.0.0-rc2-23911",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
|
|
Loading…
Add table
Reference in a new issue