Merge pull request #1357 from dotnet/prkrishn/net451
Target net451 in ProjectModel
This commit is contained in:
commit
c881516abf
20 changed files with 134 additions and 89 deletions
|
@ -123,7 +123,11 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
public ICommand EnvironmentVariable(string name, string value)
|
public ICommand EnvironmentVariable(string name, string value)
|
||||||
{
|
{
|
||||||
|
#if NET451
|
||||||
|
_process.StartInfo.EnvironmentVariables[name] = value;
|
||||||
|
#else
|
||||||
_process.StartInfo.Environment[name] = value;
|
_process.StartInfo.Environment[name] = value;
|
||||||
|
#endif
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NuGet.Frameworks;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.ProjectModel.Graph;
|
using Microsoft.DotNet.ProjectModel.Graph;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
using NuGet.Frameworks;
|
||||||
using NuGet.Packaging;
|
using NuGet.Packaging;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
private static CommandSpec ResolveFromAppBase(string commandName, IEnumerable<string> args, bool useComSpec = false)
|
private static CommandSpec ResolveFromAppBase(string commandName, IEnumerable<string> args, bool useComSpec = false)
|
||||||
{
|
{
|
||||||
var commandPath = Env.GetCommandPathFromAppBase(AppContext.BaseDirectory, commandName);
|
var commandPath = Env.GetCommandPathFromAppBase(PlatformServices.Default.Application.ApplicationBasePath, commandName);
|
||||||
return commandPath == null
|
return commandPath == null
|
||||||
? null
|
? null
|
||||||
: CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.BaseDirectory, useComSpec);
|
: CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.BaseDirectory, useComSpec);
|
||||||
|
@ -210,7 +210,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
CommandResolutionStrategy resolutionStrategy,
|
CommandResolutionStrategy resolutionStrategy,
|
||||||
bool useComSpec = false)
|
bool useComSpec = false)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows &&
|
||||||
Path.GetExtension(commandPath).Equals(".cmd", StringComparison.OrdinalIgnoreCase))
|
Path.GetExtension(commandPath).Equals(".cmd", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var preferredCommandPath = Env.GetCommandPath(commandName, ".exe");
|
var preferredCommandPath = Env.GetCommandPath(commandName, ".exe");
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
// 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.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
|
private static Platform CurrentPlatform => PlatformServices.Default.Runtime.OperatingSystemPlatform;
|
||||||
|
|
||||||
public static readonly string ProjectFileName = "project.json";
|
public static readonly string ProjectFileName = "project.json";
|
||||||
public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;
|
public static readonly string ExeSuffix = CurrentPlatform == Platform.Windows ? ".exe" : string.Empty;
|
||||||
|
|
||||||
// Priority order of runnable suffixes to look for and run
|
// Priority order of runnable suffixes to look for and run
|
||||||
public static readonly string[] RunnableSuffixes = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
public static readonly string[] RunnableSuffixes = CurrentPlatform == Platform.Windows
|
||||||
? new string[] { ".exe", ".cmd", ".bat" }
|
? new string[] { ".exe", ".cmd", ".bat" }
|
||||||
: new string[] { string.Empty };
|
: new string[] { string.Empty };
|
||||||
|
|
||||||
|
@ -19,22 +21,23 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
public static readonly string BinDirectoryName = "bin";
|
public static readonly string BinDirectoryName = "bin";
|
||||||
public static readonly string ObjDirectoryName = "obj";
|
public static readonly string ObjDirectoryName = "obj";
|
||||||
|
|
||||||
public static readonly string DynamicLibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".dll" :
|
public static readonly string DynamicLibSuffix = CurrentPlatform == Platform.Windows ? ".dll" :
|
||||||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib" : ".so";
|
CurrentPlatform == Platform.Darwin ? ".dylib" : ".so";
|
||||||
|
|
||||||
public static readonly string LibCoreClrName = (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "coreclr" : "libcoreclr") + DynamicLibSuffix;
|
public static readonly string LibCoreClrName = (CurrentPlatform == Platform.Windows ? "coreclr" : "libcoreclr") + DynamicLibSuffix;
|
||||||
|
|
||||||
public static readonly string RuntimeIdentifier = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "win7-x64" :
|
public static readonly string RuntimeIdentifier = CurrentPlatform == Platform.Windows ? "win7-x64" :
|
||||||
RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "osx.10.10-x64" : "ubuntu.14.04-x64";
|
CurrentPlatform == Platform.Darwin ? "osx.10.10-x64" : "ubuntu.14.04-x64";
|
||||||
|
|
||||||
public static readonly string StaticLibSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".lib" : ".a" ;
|
public static readonly string StaticLibSuffix = CurrentPlatform == Platform.Windows ? ".lib" : ".a";
|
||||||
|
|
||||||
public static readonly string ResponseFileSuffix = ".rsp";
|
public static readonly string ResponseFileSuffix = ".rsp";
|
||||||
|
|
||||||
public static readonly string HostExecutableName = "corehost" + ExeSuffix;
|
public static readonly string HostExecutableName = "corehost" + ExeSuffix;
|
||||||
public static readonly string[] HostBinaryNames = new string[] {
|
public static readonly string[] HostBinaryNames = new string[] {
|
||||||
HostExecutableName,
|
HostExecutableName,
|
||||||
(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "hostpolicy" : "libhostpolicy") + DynamicLibSuffix
|
(CurrentPlatform == Platform.Windows ? "hostpolicy" : "libhostpolicy") + DynamicLibSuffix
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
|
@ -12,7 +11,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the version of corehost that was shipped with this command
|
/// Gets the path to the version of corehost that was shipped with this command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string LocalHostExePath => Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
|
public static string LocalHostExePath => Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, Constants.HostExecutableName);
|
||||||
|
|
||||||
public static string HostExePath
|
public static string HostExePath
|
||||||
{
|
{
|
||||||
|
@ -33,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
if (_hostDir == null)
|
if (_hostDir == null)
|
||||||
{
|
{
|
||||||
_hostDir = Path.GetDirectoryName(Env.GetCommandPath(
|
_hostDir = Path.GetDirectoryName(Env.GetCommandPath(
|
||||||
Constants.HostExecutableName, new[] {string.Empty}));
|
Constants.HostExecutableName, new[] { string.Empty }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _hostDir;
|
return _hostDir;
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
if (_executableExtensions == null)
|
if (_executableExtensions == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
_executableExtensions = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
_executableExtensions = PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows
|
||||||
? Environment.GetEnvironmentVariable("PATHEXT")
|
? Environment.GetEnvironmentVariable("PATHEXT")
|
||||||
.Split(';')
|
.Split(';')
|
||||||
.Select(e => e.ToLower().Trim('"'))
|
.Select(e => e.ToLower().Trim('"'))
|
||||||
|
@ -35,7 +36,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
if (_searchPaths == null)
|
if (_searchPaths == null)
|
||||||
{
|
{
|
||||||
var searchPaths = new List<string> {AppContext.BaseDirectory};
|
var searchPaths = new List<string> { PlatformServices.Default.Application.ApplicationBasePath };
|
||||||
|
|
||||||
searchPaths.AddRange(Environment
|
searchPaths.AddRange(Environment
|
||||||
.GetEnvironmentVariable("PATH")
|
.GetEnvironmentVariable("PATH")
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Common
|
namespace Microsoft.DotNet.Tools.Common
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
StringComparison compare;
|
StringComparison compare;
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||||
{
|
{
|
||||||
compare = StringComparison.OrdinalIgnoreCase;
|
compare = StringComparison.OrdinalIgnoreCase;
|
||||||
// check if paths are on the same volume
|
// check if paths are on the same volume
|
||||||
|
@ -154,7 +154,7 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
path += ".." + separator;
|
path += ".." + separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = index; len2 - 1 > i; ++i)
|
for (var i = index; len2 - 1 > i; ++i)
|
||||||
{
|
{
|
||||||
path += path2Segments[i] + separator;
|
path += path2Segments[i] + separator;
|
||||||
|
@ -216,7 +216,7 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
{
|
{
|
||||||
var comparison = StringComparison.Ordinal;
|
var comparison = StringComparison.Ordinal;
|
||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||||
{
|
{
|
||||||
comparison = StringComparison.OrdinalIgnoreCase;
|
comparison = StringComparison.OrdinalIgnoreCase;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
public static Reporter Create(Func<bool, AnsiConsole> getter)
|
public static Reporter Create(Func<bool, AnsiConsole> getter)
|
||||||
{
|
{
|
||||||
return new Reporter(getter(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)));
|
return new Reporter(getter(PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message)
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Microsoft.DotNet.Cli.Utils.CommandParsing;
|
using Microsoft.DotNet.Cli.Utils.CommandParsing;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Utils
|
namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
var useComSpec = false;
|
var useComSpec = false;
|
||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||||
{
|
{
|
||||||
// Only forward slashes are used in script blocks. Replace with backslashes to correctly
|
// Only forward slashes are used in script blocks. Replace with backslashes to correctly
|
||||||
// locate the script. The directory separator is platform-specific.
|
// locate the script. The directory separator is platform-specific.
|
||||||
|
@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
var comSpec = Environment.GetEnvironmentVariable("ComSpec");
|
||||||
if (!string.IsNullOrEmpty(comSpec))
|
if (!string.IsNullOrEmpty(comSpec))
|
||||||
{
|
{
|
||||||
useComSpec=true;
|
useComSpec = true;
|
||||||
|
|
||||||
scriptArguments = new string[] { comSpec }
|
scriptArguments = new string[] { comSpec }
|
||||||
.Concat(scriptArguments)
|
.Concat(scriptArguments)
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
private StringBuilder _builder;
|
private StringBuilder _builder;
|
||||||
private StringWriter _capture;
|
private StringWriter _capture;
|
||||||
private Action<string> _write;
|
|
||||||
private Action<string> _writeLine;
|
private Action<string> _writeLine;
|
||||||
|
|
||||||
public string CapturedOutput
|
public string CapturedOutput
|
||||||
|
|
|
@ -2,20 +2,24 @@
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
|
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"keyFile": "../../tools/Key.snk"
|
"keyFile": "../../tools/Key.snk",
|
||||||
|
"warningsAsErrors": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
|
||||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||||
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
||||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537"
|
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537"
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
"net451": { },
|
||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"imports": "portable-net45+win8"
|
"imports": "portable-net45+win8",
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool EnumerableEquals(IEnumerable<string> left, IEnumerable<string> right)
|
private static bool EnumerableEquals(IEnumerable<string> left, IEnumerable<string> right)
|
||||||
=> Enumerable.SequenceEqual(left ?? Array.Empty<string>(), right ?? Array.Empty<string>());
|
=> Enumerable.SequenceEqual(left ?? EmptyArray<string>.Value, right ?? EmptyArray<string>.Value);
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
if (@new != null)
|
if (@new != null)
|
||||||
{
|
{
|
||||||
old = old ?? Array.Empty<string>();
|
old = old ?? EmptyArray<string>.Value;
|
||||||
return old.Concat(@new).Distinct().ToArray();
|
return old.Concat(@new).Distinct().ToArray();
|
||||||
}
|
}
|
||||||
return old;
|
return old;
|
||||||
|
|
|
@ -162,7 +162,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
var analyzers = GetAnalyzerReferences(package);
|
var analyzers = GetAnalyzerReferences(package);
|
||||||
|
|
||||||
return new LibraryExport(package, compileAssemblies,
|
return new LibraryExport(package, compileAssemblies,
|
||||||
sourceReferences, runtimeAssemblies, Array.Empty<LibraryAsset>(), nativeLibraries, analyzers);
|
sourceReferences, runtimeAssemblies, EmptyArray<LibraryAsset>.Value, nativeLibraries, analyzers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LibraryExport ExportProject(ProjectDescription project)
|
private LibraryExport ExportProject(ProjectDescription project)
|
||||||
|
@ -175,8 +175,8 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
sourceReferences: Enumerable.Empty<string>(),
|
sourceReferences: Enumerable.Empty<string>(),
|
||||||
nativeLibraries: Enumerable.Empty<LibraryAsset>(),
|
nativeLibraries: Enumerable.Empty<LibraryAsset>(),
|
||||||
runtimeAssets: Enumerable.Empty<LibraryAsset>(),
|
runtimeAssets: Enumerable.Empty<LibraryAsset>(),
|
||||||
runtimeAssemblies: Array.Empty<LibraryAsset>(),
|
runtimeAssemblies: EmptyArray<LibraryAsset>.Value,
|
||||||
analyzers: Array.Empty<AnalyzerReference>());
|
analyzers: EmptyArray<AnalyzerReference>.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var compileAssemblies = new List<LibraryAsset>();
|
var compileAssemblies = new List<LibraryAsset>();
|
||||||
|
@ -226,7 +226,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
// just the same as compileAssemblies and nativeLibraries are empty
|
// just the same as compileAssemblies and nativeLibraries are empty
|
||||||
// Also no support for analyzer projects
|
// Also no support for analyzer projects
|
||||||
return new LibraryExport(project, compileAssemblies, sourceReferences,
|
return new LibraryExport(project, compileAssemblies, sourceReferences,
|
||||||
compileAssemblies, runtimeAssets, Array.Empty<LibraryAsset>(), Array.Empty<AnalyzerReference>());
|
compileAssemblies, runtimeAssets, EmptyArray<LibraryAsset>.Value, EmptyArray<AnalyzerReference>.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ResolvePath(Project project, string configuration, string path)
|
private static string ResolvePath(Project project, string configuration, string path)
|
||||||
|
@ -250,13 +250,13 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
return new LibraryExport(
|
return new LibraryExport(
|
||||||
library,
|
library,
|
||||||
string.IsNullOrEmpty(library.Path) ?
|
string.IsNullOrEmpty(library.Path) ?
|
||||||
Array.Empty<LibraryAsset>() :
|
EmptyArray<LibraryAsset>.Value :
|
||||||
new[] { new LibraryAsset(library.Identity.Name, library.Path, library.Path) },
|
new[] { new LibraryAsset(library.Identity.Name, library.Path, library.Path) },
|
||||||
Array.Empty<string>(),
|
EmptyArray<string>.Value,
|
||||||
Array.Empty<LibraryAsset>(),
|
EmptyArray<LibraryAsset>.Value,
|
||||||
Array.Empty<LibraryAsset>(),
|
EmptyArray<LibraryAsset>.Value,
|
||||||
Array.Empty<LibraryAsset>(),
|
EmptyArray<LibraryAsset>.Value,
|
||||||
Array.Empty<AnalyzerReference>());
|
EmptyArray<AnalyzerReference>.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> GetSharedSources(PackageDescription package)
|
private IEnumerable<string> GetSharedSources(PackageDescription package)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.ProjectModel
|
namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
|
@ -11,11 +11,17 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return Windows; }
|
switch (PlatformServices.Default.Runtime.OperatingSystemPlatform)
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return Linux; }
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return OSX; }
|
case Platform.Windows:
|
||||||
|
return Windows;
|
||||||
throw new InvalidOperationException("Unknown Platform");
|
case Platform.Darwin:
|
||||||
|
return OSX;
|
||||||
|
case Platform.Linux:
|
||||||
|
return Linux;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException("Unknown Platform");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
src/Microsoft.DotNet.ProjectModel/Internal/EmptyArray.cs
Normal file
14
src/Microsoft.DotNet.ProjectModel/Internal/EmptyArray.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// 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.ProjectModel
|
||||||
|
{
|
||||||
|
internal static class EmptyArray<T>
|
||||||
|
{
|
||||||
|
#if NET451
|
||||||
|
public static readonly T[] Value = new T[0];
|
||||||
|
#else
|
||||||
|
public static readonly T[] Value = System.Array.Empty<T>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
|
@ -144,9 +144,9 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
project.CompilerName = rawProject.ValueAsString("compilerName");
|
project.CompilerName = rawProject.ValueAsString("compilerName");
|
||||||
project.TestRunner = rawProject.ValueAsString("testRunner");
|
project.TestRunner = rawProject.ValueAsString("testRunner");
|
||||||
|
|
||||||
project.Authors = rawProject.ValueAsStringArray("authors") ?? Array.Empty<string>();
|
project.Authors = rawProject.ValueAsStringArray("authors") ?? EmptyArray<string>.Value;
|
||||||
project.Owners = rawProject.ValueAsStringArray("owners") ?? Array.Empty<string>();
|
project.Owners = rawProject.ValueAsStringArray("owners") ?? EmptyArray<string>.Value;
|
||||||
project.Tags = rawProject.ValueAsStringArray("tags") ?? Array.Empty<string>();
|
project.Tags = rawProject.ValueAsStringArray("tags") ?? EmptyArray<string>.Value;
|
||||||
|
|
||||||
project.Language = rawProject.ValueAsString("language");
|
project.Language = rawProject.ValueAsString("language");
|
||||||
project.ReleaseNotes = rawProject.ValueAsString("releaseNotes");
|
project.ReleaseNotes = rawProject.ValueAsString("releaseNotes");
|
||||||
|
|
|
@ -5,10 +5,10 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.ProjectModel.Resolution
|
namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
|
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
return referenceAssembliesPath;
|
return referenceAssembliesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform != Platform.Windows)
|
||||||
{
|
{
|
||||||
// There is no reference assemblies path outside of windows
|
// There is no reference assemblies path outside of windows
|
||||||
// The environment variable can be used to specify one
|
// The environment variable can be used to specify one
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.ProjectModel.Utilities
|
namespace Microsoft.DotNet.ProjectModel.Utilities
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ namespace Microsoft.DotNet.ProjectModel.Utilities
|
||||||
}
|
}
|
||||||
|
|
||||||
StringComparison compare;
|
StringComparison compare;
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||||
{
|
{
|
||||||
compare = StringComparison.OrdinalIgnoreCase;
|
compare = StringComparison.OrdinalIgnoreCase;
|
||||||
// check if paths are on the same volume
|
// check if paths are on the same volume
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
// 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.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
#if !NET451
|
||||||
using System.Runtime.Loader;
|
using System.Runtime.Loader;
|
||||||
|
#endif
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
|
|
||||||
|
@ -16,7 +19,11 @@ namespace Microsoft.DotNet.ProjectModel.Utilities
|
||||||
|
|
||||||
internal static NuGetVersion GetAssemblyVersion(string path)
|
internal static NuGetVersion GetAssemblyVersion(string path)
|
||||||
{
|
{
|
||||||
|
#if NET451
|
||||||
|
return new NuGetVersion(AssemblyName.GetAssemblyName(path).Version);
|
||||||
|
#else
|
||||||
return new NuGetVersion(AssemblyLoadContext.GetAssemblyName(path).Version);
|
return new NuGetVersion(AssemblyLoadContext.GetAssemblyName(path).Version);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string RenderVersion(VersionRange range)
|
public static string RenderVersion(VersionRange range)
|
||||||
|
|
|
@ -5,15 +5,9 @@
|
||||||
},
|
},
|
||||||
"description": "Types to model a .NET Project",
|
"description": "Types to model a .NET Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
||||||
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
|
||||||
"System.Runtime.Loader": "4.0.0-rc2-23811",
|
|
||||||
"System.Dynamic.Runtime": "4.0.11-rc2-23811",
|
|
||||||
"System.Security.Cryptography.Algorithms": "4.0.0-rc2-23811",
|
|
||||||
"Microsoft.CSharp": "4.0.1-rc2-23811",
|
|
||||||
"System.Xml.XDocument": "4.0.11-rc2-23811",
|
|
||||||
"NuGet.Packaging": "3.4.0-beta-583",
|
|
||||||
|
|
||||||
|
"NuGet.Packaging": "3.4.0-beta-583",
|
||||||
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
||||||
"Microsoft.Extensions.JsonParser.Sources": {
|
"Microsoft.Extensions.JsonParser.Sources": {
|
||||||
"type": "build",
|
"type": "build",
|
||||||
|
@ -28,11 +22,23 @@
|
||||||
"version": "1.0.0-*"
|
"version": "1.0.0-*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
"net451": {
|
||||||
|
"frameworkAssemblies": {
|
||||||
|
"System.IO": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
"dnxcore50": {
|
"dnxcore50": {
|
||||||
"imports": "portable-net45+win8"
|
"imports": "portable-net45+win8",
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
|
"System.Dynamic.Runtime": "4.0.11-rc2-23811",
|
||||||
|
"System.Runtime.Loader": "4.0.0-rc2-23811",
|
||||||
|
"System.Security.Cryptography.Algorithms": "4.0.0-rc2-23811",
|
||||||
|
"Microsoft.CSharp": "4.0.1-rc2-23811",
|
||||||
|
"System.Xml.XDocument": "4.0.11-rc2-23811"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
{
|
{
|
||||||
"description": "Abstractions for test runners to communicate to a tool, such as Visual Studio.",
|
"description": "Abstractions for test runners to communicate to a tool, such as Visual Studio.",
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/dotnet/cli"
|
"url": "git://github.com/dotnet/cli"
|
||||||
},
|
},
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"warningsAsErrors": true,
|
"warningsAsErrors": true,
|
||||||
"keyFile": "../../tools/Key.snk"
|
"keyFile": "../../tools/Key.snk"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Newtonsoft.Json": "7.0.1",
|
"Newtonsoft.Json": "7.0.1",
|
||||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||||
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16040",
|
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16040"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net451": { },
|
||||||
|
"dnxcore50": {
|
||||||
|
"imports": "portable-net45+win8",
|
||||||
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
"System.Resources.ResourceManager": "4.0.1-rc2-23811",
|
"System.Resources.ResourceManager": "4.0.1-rc2-23811",
|
||||||
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811"
|
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811"
|
||||||
},
|
}
|
||||||
"frameworks": {
|
|
||||||
"dnxcore50": {
|
|
||||||
"imports": "portable-net45+win8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"scripts": { }
|
||||||
|
}
|
Loading…
Reference in a new issue