Remove the SDK artifacts from the CLI.

These are now contained in github.com/dotnet/sdk.
This commit is contained in:
Eric Erhardt 2016-08-05 17:57:46 -05:00
parent a0244b9946
commit 736652fe71
16 changed files with 0 additions and 861 deletions

View file

@ -148,8 +148,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FF498306-2
build\test\TestProjects.targets = build\test\TestProjects.targets
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Core.Build.Tasks", "src\Microsoft.DotNet.Core.Build.Tasks\Microsoft.DotNet.Core.Build.Tasks.xproj", "{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Tests.Utilities", "test\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.xproj", "{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Core.Build.Tasks.Tests", "test\Microsoft.DotNet.Core.Build.Tasks.Tests\Microsoft.DotNet.Core.Build.Tasks.Tests.xproj", "{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}"
@ -860,22 +858,6 @@ Global
{49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{49D7318E-D198-4E2B-BBEA-3A24D805F88D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|x64.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Debug|x64.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|Any CPU.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|x64.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.Release|x64.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -964,7 +946,6 @@ Global
{FD7D515A-D10F-4F49-B8AE-21CF7ED071AE} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{8E3354BD-827F-41B7-9EE6-6BE1F1EDD8E9} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{FF498306-2DE2-47F6-8C35-3CF0589CF2B8} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{E8E7D24B-4830-4662-80A8-255D6FE3B0BE} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{27B12960-ABB0-4903-9C60-5E9157E659C8} = {89905EC4-BC0F-443B-8ADF-691321F10108}

View file

@ -1,17 +0,0 @@
<!--
***********************************************************************************************
Microsoft.NETCore.ImportBefore.props
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NETCoreProps Condition="'$(NETCoreProps)'==''">$(MSBuildExtensionsPath)\Microsoft.DotNet.Core.Sdk.props</NETCoreProps>
</PropertyGroup>
<Import Condition="Exists('$(NETCoreProps)')" Project="$(NETCoreProps)" />
</Project>

View file

@ -1,17 +0,0 @@
<!--
***********************************************************************************************
Microsoft.NETCore.ImportAfter.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NETCoreTargets Condition="'$(NETCoreTargets)'==''">$(MSBuildExtensionsPath)\Microsoft.DotNet.Core.Sdk.targets</NETCoreTargets>
</PropertyGroup>
<Import Condition="Exists('$(NETCoreTargets)')" Project="$(NETCoreTargets)" />
</Project>

View file

@ -1,68 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<!-- User-facing configuration-agnostic defaults -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform>AnyCPU</Platform>
<FileAlignment>512</FileAlignment>
<GlobalExclude>bin\**;obj\**;</GlobalExclude>
</PropertyGroup>
<!-- User-facing configuration-specific defaults -->
<PropertyGroup>
<!-- TODO: This property can't be set in the CLI since ResolveNuGetPackageAssets needs an exact RID from the project.json, and the RID is made up of the PlatformTarget -->
<!--<PlatformTarget>AnyCPU</PlatformTarget>-->
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>$(NoWarn);1701</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<!-- Default settings for .NET Core build logic -->
<PropertyGroup>
<GenerateDependencyFile Condition=" '$(GenerateDependencyFile)' == '' ">true</GenerateDependencyFile>
<!-- This will turn off the base 'ResolveNuGetPackages' target since it is UWP specific, and .NET Core needs it to be split up -->
<!--<ResolveNuGetPackages>false</ResolveNuGetPackages>-->
</PropertyGroup>
<PropertyGroup>
<NoStdLib>true</NoStdLib>
<!-- TODO: Need to figure out runtimes -->
<!-- TODO: Below are hacks eerhardt made on top of davkean's .props file -->
<!-- Temp Hack: davkean had this, but that casues all references not to be copied to output dir:
<CopyNuGetImplementations>false</CopyNuGetImplementations>
This will be set to false during "build", but set to true during "publish"
-->
<!-- Temp Hack: https://github.com/dotnet/roslyn/issues/12167 -->
<NoLogo>true</NoLogo>
<!-- Need to revisit this and see if this is the correct default for both Debug and Release -->
<DebugType>portable</DebugType>
<!-- Temp Hack: https://github.com/Microsoft/msbuild/issues/720 -->
<OverrideToolHost Condition=" '$(DotnetHostPath)' != '' and '$(OverrideToolHost)' == ''">$(DotnetHostPath)</OverrideToolHost>
</PropertyGroup>
</Project>

View file

@ -1,120 +0,0 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MicrosoftDotNetCoreBuildTasksDirectoryRoot>$(MSBuildThisFileDirectory)../../lib/</MicrosoftDotNetCoreBuildTasksDirectoryRoot>
<MicrosoftDotNetCoreBuildTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netstandard1.6</MicrosoftDotNetCoreBuildTasksTFM>
<MicrosoftDotNetCoreBuildTasksTFM Condition=" '$(MicrosoftDotNetCoreBuildTasksTFM)' == ''">net451</MicrosoftDotNetCoreBuildTasksTFM>
<MicrosoftDotNetCoreBuildTasksDirectory>$(MicrosoftDotNetCoreBuildTasksDirectoryRoot)$(MicrosoftDotNetCoreBuildTasksTFM)/</MicrosoftDotNetCoreBuildTasksDirectory>
<!-- If the build task directory doesn't exist (since we aren't in a NuGet package), load the task assembly in the tools path -->
<MicrosoftDotNetCoreBuildTasksDirectory Condition=" !Exists('$(MicrosoftDotNetCoreBuildTasksDirectory)') ">$(MSBuildToolsPath)/</MicrosoftDotNetCoreBuildTasksDirectory>
</PropertyGroup>
<PropertyGroup>
<!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
to prevent it from outputting a warning (MSB3644).
-->
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
</PropertyGroup>
<PropertyGroup>
<GenerateRuntimeConfigurationFiles Condition=" '$(GenerateRuntimeConfigurationFiles)' == '' and '$(OutputType)' == 'exe' ">true</GenerateRuntimeConfigurationFiles>
<UserRuntimeConfig Condition=" '$(UserRuntimeConfig)' == '' ">$(MSBuildProjectDirectory)/runtimeconfig.template.json</UserRuntimeConfig>
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">1.0.0</VersionPrefix>
<VersionSuffix Condition=" '$(VersionSuffix)' == '' "></VersionSuffix>
<Version Condition=" '$(Version)' == '' and '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
</PropertyGroup>
<UsingTask TaskName="GenerateDepsFile" AssemblyFile="$(MicrosoftDotNetCoreBuildTasksDirectory)Microsoft.DotNet.Core.Build.Tasks.dll" />
<UsingTask TaskName="GenerateRuntimeConfigurationFiles" AssemblyFile="$(MicrosoftDotNetCoreBuildTasksDirectory)Microsoft.DotNet.Core.Build.Tasks.dll" />
<PropertyGroup>
<CoreBuildDependsOn>
$(CoreBuildDependsOn);
GenerateDependencyFile;
GenerateRuntimeConfigurationFiles
</CoreBuildDependsOn>
</PropertyGroup>
<Target Name="GenerateDependencyFile"
Condition=" '$(GenerateDependencyFile)' == 'true'">
<!--
TODO: Is this the best way? Should we just tell CSC to output $(AssemblyName).dll directly?
-->
<Move SourceFiles="$(TargetPath)" DestinationFiles="$(TargetDir)/$(AssemblyName).dll" />
<!--
TODO: Get RuntimeIdentifier
-->
<GenerateDepsFile LockFilePath="$(MSBuildProjectDirectory)/project.lock.json"
DepsFilePath="$(TargetDir)$(AssemblyName).deps.json"
TargetFramework="$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)"
AssemblyName="$(AssemblyName)"
AssemblyVersion="$(Version)"
RuntimeIdentifier="" />
<!--
TODO: When OutputType == 'exe' and !IsPortable, we need to verify CoreClr is present in the deps graph, and copy in a host to the output
See https://github.com/dotnet/cli/blob/6b54ae0bcc5c63e7c989ac19d851f234f9172bea/src/Microsoft.DotNet.Compiler.Common/Executable.cs#L102-L107
-->
</Target>
<Target Name="GenerateRuntimeConfigurationFiles"
Condition=" '$(GenerateRuntimeConfigurationFiles)' == 'true'">
<GenerateRuntimeConfigurationFiles LockFilePath="$(MSBuildProjectDirectory)/project.lock.json"
RuntimeConfigPath="$(TargetDir)/$(AssemblyName).runtimeconfig.json"
RuntimeConfigDevPath="$(TargetDir)/$(AssemblyName).runtimeconfig.dev.json"
UserRuntimeConfig="$(UserRuntimeConfig)" />
</Target>
<!--
============================================================
GetRunInformation
Returns the ProcessStart information that can be used to run this project.
============================================================
-->
<Target Name="GetRunInformation"
DependsOnTargets="GenerateRunInformation"
Outputs="@(RunInformation)" />
<Target Name="GenerateRunInformation">
<ItemGroup>
<RunInformation Include="$(MSBuildProjectFullPath)">
<!-- TODO: Need to get the Muxer path from MSBuild -->
<CommandName>dotnet</CommandName>
<Args>exec;$(TargetDir)/$(AssemblyName).dll</Args>
</RunInformation>
</ItemGroup>
</Target>
<!--
============================================================
Publish
Override the "in-box" publish, which is very ClickOnce centric.
============================================================
-->
<PropertyGroup>
<PublishDependsOn>
Build;
CopyPublishArtifacts
</PublishDependsOn>
<PublishDir Condition=" '$(PublishDir)' == '' ">$(OutDir)publish\</PublishDir>
</PropertyGroup>
<Target
Name="Publish"
DependsOnTargets="$(PublishDependsOn)" />
<Target Name="CopyPublishArtifacts">
<Message Text="TODO: Implement CopyPublishArtifacts" />
</Target>
</Project>

View file

@ -1,270 +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.Security.Cryptography;
using System.Text;
using Microsoft.Extensions.DependencyModel;
using NuGet.Frameworks;
using NuGet.Packaging.Core;
using NuGet.ProjectModel;
namespace Microsoft.DotNet.Core.Build.Tasks
{
public class DependencyContextBuilder
{
public DependencyContextBuilder()
{
}
public DependencyContext Build(
string projectName,
string projectVersion,
CompilationOptions compilerOptions,
LockFile lockFile,
NuGetFramework framework,
string runtime)
{
LockFileTarget lockFileTarget = lockFile.GetTarget(framework, runtime);
IEnumerable<LockFileTargetLibrary> runtimeExports = lockFileTarget.Libraries;
// TODO: get this from the lock file once https://github.com/NuGet/Home/issues/2695 is fixed.
var platformPackageName = "Microsoft.NETCore.App";
var platformExport = lockFileTarget
.Libraries
.FirstOrDefault(e => e.Name.Equals(platformPackageName, StringComparison.OrdinalIgnoreCase));
bool portable = platformExport != null;
if (portable)
{
runtimeExports = FilterPlatformDependencies(runtimeExports, platformExport);
}
var dependencyLookup = runtimeExports
.Select(identity => new Dependency(identity.Name, identity.Version.ToString()))
.ToDictionary(dependency => dependency.Name, StringComparer.OrdinalIgnoreCase);
var libraryLookup = lockFile.Libraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
var runtimeSignature = GenerateRuntimeSignature(runtimeExports);
IEnumerable<RuntimeLibrary> runtimeLibraries =
new[] { GetProjectLibrary(projectName, projectVersion, lockFile, lockFileTarget, dependencyLookup) }
.Concat(GetLibraries(runtimeExports, libraryLookup, dependencyLookup, runtime: true).Cast<RuntimeLibrary>());
return new DependencyContext(
new TargetInfo(framework.DotNetFrameworkName, runtime, runtimeSignature, portable),
compilerOptions ?? CompilationOptions.Default,
Enumerable.Empty<CompilationLibrary>(), //GetLibraries(compilationExports, dependencyLookup, runtime: false).Cast<CompilationLibrary>(),
runtimeLibraries,
new RuntimeFallbacks[] { });
}
private static IEnumerable<LockFileTargetLibrary> FilterPlatformDependencies(
IEnumerable<LockFileTargetLibrary> runtimeExports,
LockFileTargetLibrary platformExport)
{
var exportsLookup = runtimeExports.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase);
HashSet<string> exclusionList = GetPlatformExclusionList(platformExport, exportsLookup);
return runtimeExports.Where(e => !exclusionList.Contains(e.Name));
}
private static HashSet<string> GetPlatformExclusionList(
LockFileTargetLibrary platformExport,
IDictionary<string, LockFileTargetLibrary> exportsLookup)
{
var exclusionList = new HashSet<string>();
exclusionList.Add(platformExport.Name);
CollectDependencies(exportsLookup, platformExport.Dependencies, exclusionList);
return exclusionList;
}
private static void CollectDependencies(
IDictionary<string, LockFileTargetLibrary> exportsLookup,
IEnumerable<PackageDependency> dependencies,
HashSet<string> exclusionList)
{
foreach (PackageDependency dependency in dependencies)
{
LockFileTargetLibrary export = exportsLookup[dependency.Id];
if (export.Version.Equals(dependency.VersionRange.MinVersion))
{
exclusionList.Add(export.Name);
CollectDependencies(exportsLookup, export.Dependencies, exclusionList);
}
}
}
private static string GenerateRuntimeSignature(IEnumerable<LockFileTargetLibrary> runtimeExports)
{
var sha1 = SHA1.Create();
var builder = new StringBuilder();
var packages = runtimeExports
.Where(libraryExport => libraryExport.Type == "package");
var separator = "|";
foreach (var libraryExport in packages)
{
builder.Append(libraryExport.Name);
builder.Append(separator);
builder.Append(libraryExport.Version.ToString());
builder.Append(separator);
}
var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(builder.ToString()));
builder.Clear();
foreach (var hashByte in hash)
{
builder.AppendFormat("{0:x2}", hashByte);
}
return builder.ToString();
}
private RuntimeLibrary GetProjectLibrary(
string projectName,
string projectVersion,
LockFile lockFile,
LockFileTarget lockFileTarget,
Dictionary<string, Dependency> dependencyLookup)
{
RuntimeAssetGroup[] runtimeAssemblyGroups = new[] { new RuntimeAssetGroup(string.Empty, $"{projectName}.dll") };
List<Dependency> dependencies = new List<Dependency>();
IEnumerable<ProjectFileDependencyGroup> projectFileDependencies = lockFile
.ProjectFileDependencyGroups
.Where(dg => dg.FrameworkName == string.Empty ||
dg.FrameworkName == lockFileTarget.TargetFramework.DotNetFrameworkName);
foreach (string projectFileDependency in projectFileDependencies.SelectMany(dg => dg.Dependencies))
{
int separatorIndex = projectFileDependency.IndexOf(' ');
string dependencyName = separatorIndex > 0 ?
projectFileDependency.Substring(0, separatorIndex) :
projectFileDependency;
Dependency dependency;
if (dependencyLookup.TryGetValue(dependencyName, out dependency))
{
dependencies.Add(dependency);
}
}
return new RuntimeLibrary(
type: "project",
name: projectName,
version: projectVersion,
hash: string.Empty,
runtimeAssemblyGroups: runtimeAssemblyGroups,
nativeLibraryGroups: new RuntimeAssetGroup[] { },
resourceAssemblies: new ResourceAssembly[] { },
dependencies: dependencies.ToArray(),
serviceable: false);
}
private IEnumerable<Library> GetLibraries(
IEnumerable<LockFileTargetLibrary> exports,
IDictionary<string, LockFileLibrary> libraryLookup,
IDictionary<string, Dependency> dependencyLookup,
bool runtime)
{
return exports.Select(export => GetLibrary(export, libraryLookup, dependencyLookup, runtime));
}
private Library GetLibrary(
LockFileTargetLibrary export,
IDictionary<string, LockFileLibrary> libraryLookup,
IDictionary<string, Dependency> dependencyLookup,
bool runtime)
{
var type = export.Type;
// TEMPORARY: All packages are serviceable in RC2
// See https://github.com/dotnet/cli/issues/2569
var serviceable = export.Type == "package";
var libraryDependencies = new HashSet<Dependency>();
foreach (PackageDependency libraryDependency in export.Dependencies)
{
Dependency dependency;
if (dependencyLookup.TryGetValue(libraryDependency.Id, out dependency))
{
libraryDependencies.Add(dependency);
}
}
string hash = string.Empty;
LockFileLibrary library;
if (libraryLookup.TryGetValue(export.Name, out library))
{
hash = "sha512-" + library.Sha512;
}
if (runtime)
{
return new RuntimeLibrary(
type.ToLowerInvariant(),
export.Name,
export.Version.ToString(),
hash,
CreateRuntimeAssemblyGroups(export),
CreateNativeLibraryGroups(export),
export.ResourceAssemblies.Select(CreateResourceAssembly),
libraryDependencies,
serviceable
);
}
//else
//{
// IEnumerable<string> assemblies = export
// .CompilationAssemblies
// .Select(libraryAsset => libraryAsset.RelativePath);
// return new CompilationLibrary(
// type.ToString().ToLowerInvariant(),
// export.Library.Identity.Name,
// export.Library.Identity.Version.ToString(),
// export.Library.Hash,
// assemblies,
// libraryDependencies,
// serviceable);
//}
return null;
}
private IReadOnlyList<RuntimeAssetGroup> CreateRuntimeAssemblyGroups(LockFileTargetLibrary export)
{
List<RuntimeAssetGroup> assemblyGroups = new List<RuntimeAssetGroup>();
assemblyGroups.Add(
new RuntimeAssetGroup(string.Empty, export.RuntimeAssemblies.Select(a => a.Path)));
// TODO RuntimeTargets
//export.RuntimeTargets.GroupBy(l => l.)
return assemblyGroups;
}
private IReadOnlyList<RuntimeAssetGroup> CreateNativeLibraryGroups(LockFileTargetLibrary export)
{
return new[] { new RuntimeAssetGroup(string.Empty, export.NativeLibraries.Select(a => a.Path)) };
}
private ResourceAssembly CreateResourceAssembly(LockFileItem resourceAssembly)
{
// TODO: implement
return null;
//return new ResourceAssembly(
// path: resourceAssembly.Path,
// locale: resourceAssembly.Locale
// );
}
}
}

View file

@ -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 System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Extensions.DependencyModel;
using Newtonsoft.Json;
using NuGet.Frameworks;
using NuGet.ProjectModel;
namespace Microsoft.DotNet.Core.Build.Tasks
{
/// <summary>
/// Generates the $(project).deps.json file.
/// </summary>
public class GenerateDepsFile : Task
{
[Required]
public string LockFilePath { get; set; }
[Required]
public string DepsFilePath { get; set; }
[Required]
public string TargetFramework { get; set; }
public string RuntimeIdentifier { get; set; }
[Required]
public string AssemblyName { get; set; }
[Required]
public string AssemblyVersion { get; set; }
public override bool Execute()
{
LockFile lockFile = LockFileCache.Instance.GetLockFile(LockFilePath);
DependencyContext dependencyContext = new DependencyContextBuilder().Build(
projectName: AssemblyName,
projectVersion: AssemblyVersion,
compilerOptions: null, // TODO: PreservceCompliationContext
lockFile: lockFile,
framework: TargetFramework == null ? null : NuGetFramework.Parse(TargetFramework),
runtime: RuntimeIdentifier);
var writer = new DependencyContextWriter();
using (var fileStream = File.Create(DepsFilePath))
{
writer.Write(dependencyContext, fileStream);
}
return true;
}
}
}

View file

@ -1,146 +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 Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NuGet.ProjectModel;
namespace Microsoft.DotNet.Core.Build.Tasks
{
/// <summary>
/// Generates the $(project).runtimeconfig.json and optionally $(project).runtimeconfig.dev.json files
/// for a project.
/// </summary>
public class GenerateRuntimeConfigurationFiles : Task
{
[Required]
public string LockFilePath { get; set; }
[Required]
public string RuntimeConfigPath { get; set; }
public string RuntimeConfigDevPath { get; set; }
public string UserRuntimeConfig { get; set; }
private LockFile LockFile { get; set; }
public override bool Execute()
{
LockFile = LockFileCache.Instance.GetLockFile(LockFilePath);
WriteRuntimeConfig();
if (!string.IsNullOrEmpty(RuntimeConfigDevPath))
{
WriteDevRuntimeConfig();
}
return true;
}
private void WriteRuntimeConfig()
{
RuntimeConfig config = new RuntimeConfig();
config.RuntimeOptions = new RuntimeOptions();
AddFramework(config.RuntimeOptions);
AddUserRuntimeOptions(config.RuntimeOptions);
WriteToJsonFile(RuntimeConfigPath, config);
}
private void AddFramework(RuntimeOptions runtimeOptions)
{
// TODO: get this from the lock file once https://github.com/NuGet/Home/issues/2695 is fixed.
var packageName = "Microsoft.NETCore.App";
var redistExport = LockFile
.Libraries
.FirstOrDefault(e => e.Name.Equals(packageName, StringComparison.OrdinalIgnoreCase));
if (redistExport != null)
{
RuntimeConfigFramework framework = new RuntimeConfigFramework();
framework.Name = redistExport.Name;
framework.Version = redistExport.Version.ToNormalizedString();
runtimeOptions.Framework = framework;
}
}
private void AddUserRuntimeOptions(RuntimeOptions runtimeOptions)
{
if (string.IsNullOrEmpty(UserRuntimeConfig) || !File.Exists(UserRuntimeConfig))
{
return;
}
var rawRuntimeOptions = File.ReadAllText(UserRuntimeConfig);
var runtimeOptionsFromProject = JObject.Parse(rawRuntimeOptions);
foreach (var runtimeOption in runtimeOptionsFromProject)
{
runtimeOptions.RawOptions.Add(runtimeOption.Key, runtimeOption.Value);
}
}
private void WriteDevRuntimeConfig()
{
RuntimeConfig devConfig = new RuntimeConfig();
devConfig.RuntimeOptions = new RuntimeOptions();
AddAdditionalProbingPaths(devConfig.RuntimeOptions);
WriteToJsonFile(RuntimeConfigDevPath, devConfig);
}
private void AddAdditionalProbingPaths(RuntimeOptions runtimeOptions)
{
foreach (var packageFolder in LockFile.PackageFolders)
{
if (runtimeOptions.AdditionalProbingPaths == null)
{
runtimeOptions.AdditionalProbingPaths = new List<string>();
}
// DotNetHost doesn't handle additional probing paths with a trailing slash
runtimeOptions.AdditionalProbingPaths.Add(EnsureNoTrailingDirectorySeparator(packageFolder.Path));
}
}
private static string EnsureNoTrailingDirectorySeparator(string path)
{
if (!string.IsNullOrEmpty(path))
{
char lastChar = path[path.Length - 1];
if (lastChar == Path.DirectorySeparatorChar)
{
path = path.Substring(0, path.Length - 1);
}
}
return path;
}
private static void WriteToJsonFile(string fileName, object value)
{
JsonSerializer serializer = new JsonSerializer();
serializer.ContractResolver = new CamelCasePropertyNamesContractResolver();
serializer.Formatting = Formatting.Indented;
serializer.DefaultValueHandling = DefaultValueHandling.Ignore;
using (JsonTextWriter writer = new JsonTextWriter(new StreamWriter(File.Create(fileName))))
{
serializer.Serialize(writer, value);
}
}
}
}

View file

@ -1,37 +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.Concurrent;
using NuGet.Common;
using NuGet.ProjectModel;
namespace Microsoft.DotNet.Core.Build.Tasks
{
internal class LockFileCache
{
public static LockFileCache Instance { get; } = new LockFileCache();
private ConcurrentDictionary<string, LockFile> _cache = new ConcurrentDictionary<string, LockFile>();
private LockFileCache()
{
}
public LockFile GetLockFile(string path)
{
LockFile result;
if (!_cache.TryGetValue(path, out result))
{
result = LoadLockFile(path);
_cache[path] = result;
}
return result;
}
private LockFile LoadLockFile(string path)
{
// TODO adapt task logger to Nuget Logger
return LockFileUtilities.GetLockFile(path, NullLogger.Instance);
}
}
}

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>e8e7d24b-4830-4662-80a8-255d6fe3b0be</ProjectGuid>
<RootNamespace>Microsoft.DotNet.Core.Build.Tasks</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -1,3 +0,0 @@
using System.Reflection;
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]

View file

@ -1,14 +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.Core.Build.Tasks
{
internal class RuntimeConfig
{
public RuntimeOptions RuntimeOptions { get; set; }
public RuntimeConfig()
{
}
}
}

View file

@ -1,16 +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.Core.Build.Tasks
{
internal class RuntimeConfigFramework
{
public string Name { get; set; }
public string Version { get; set; }
public RuntimeConfigFramework()
{
}
}
}

View file

@ -1,23 +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 Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Microsoft.DotNet.Core.Build.Tasks
{
internal class RuntimeOptions
{
public RuntimeConfigFramework Framework { get; set; }
public List<string> AdditionalProbingPaths { get; set; }
[JsonExtensionData]
public IDictionary<string, JToken> RawOptions { get; } = new Dictionary<string, JToken>();
public RuntimeOptions()
{
}
}
}

View file

@ -1,33 +0,0 @@
{
"version": "1.0.0-featmsbuild-*",
"buildOptions": {
"keyFile": "../../tools/Key.snk",
"warningsAsErrors": true
},
"dependencies": {
"NuGet.ProjectModel": "3.5.0-rc1-1697",
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"Microsoft.Build.Utilities.v4.0": {
"type": "build"
},
"Microsoft.Build.Framework": {
"type": "build"
}
}
},
"netstandard1.6": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
],
"dependencies": {
"Microsoft.Build.Framework": "0.1.0-preview-00029-160805",
"Microsoft.Build.Tasks.Core": "0.1.0-preview-00029-160805",
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00029-160805"
}
}
}
}

View file

@ -63,9 +63,6 @@
"Microsoft.Build": "0.1.0-preview-00029-160805",
"Microsoft.Build.Framework": "0.1.0-preview-00029-160805",
"Microsoft.DotNet.Core.Build.Tasks": {
"target": "project"
},
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
},
"frameworks": {