Merge branch 'rel/1.0.0' of https://github.com/MichaelSimons/cli into debianbuild

This commit is contained in:
Michael Simons 2016-04-14 18:59:54 -05:00
commit 7bb27eafee
22 changed files with 159 additions and 189 deletions

View file

@ -18,7 +18,6 @@ namespace Microsoft.DotNet.Cli.Build
public class CompileTargets public class CompileTargets
{ {
public static readonly string CoreCLRVersion = "1.0.2-rc2-24008"; public static readonly string CoreCLRVersion = "1.0.2-rc2-24008";
public static readonly string AppDepSdkVersion = "1.0.6-prerelease-00003";
public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86; public static readonly bool IsWinx86 = CurrentPlatform.IsWindows && CurrentArchitecture.Isx86;
public static readonly string[] BinariesForCoreHost = new[] public static readonly string[] BinariesForCoreHost = new[]
@ -49,9 +48,9 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
// Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the // Moving PrepareTargets.RestorePackages after PackagePkgProjects because managed code depends on the
// Microsoft.NETCore.App package that is created during PackagePkgProjects. // Microsoft.NETCore.App package that is created during PackagePkgProjects.
[Target(nameof(PrepareTargets.Init), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))] [Target(nameof(PrepareTargets.Init), nameof(CompileCoreHost), nameof(PackagePkgProjects), nameof(PrepareTargets.RestorePackages), nameof(CompileStage1), nameof(CompileStage2))]
public static BuildTargetResult Compile(BuildTargetContext c) public static BuildTargetResult Compile(BuildTargetContext c)
{ {
return c.Success(); return c.Success();
@ -145,7 +144,7 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
[Target(nameof(CompileCoreHost))] [Target]
public static BuildTargetResult PackagePkgProjects(BuildTargetContext c) public static BuildTargetResult PackagePkgProjects(BuildTargetContext c)
{ {
var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion"); var buildVersion = c.BuildContext.Get<BuildVersion>("BuildVersion");
@ -231,7 +230,6 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult CompileStage1(BuildTargetContext c) public static BuildTargetResult CompileStage1(BuildTargetContext c)
{ {
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src")); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
if (Directory.Exists(Dirs.Stage1)) if (Directory.Exists(Dirs.Stage1))
{ {
@ -259,7 +257,6 @@ namespace Microsoft.DotNet.Cli.Build
var configuration = c.BuildContext.Get<string>("Configuration"); var configuration = c.BuildContext.Get<string>("Configuration");
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src")); CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "src"));
CleanBinObj(c, Path.Combine(c.BuildContext.BuildDirectory, "test"));
if (Directory.Exists(Dirs.Stage2)) if (Directory.Exists(Dirs.Stage2))
{ {
@ -533,13 +530,6 @@ namespace Microsoft.DotNet.Cli.Build
File.Delete(compilersDeps); File.Delete(compilersDeps);
File.Delete(compilersRuntimeConfig); File.Delete(compilersRuntimeConfig);
// Copy AppDeps
var result = CopyAppDeps(c, outputDir);
if (!result.Success)
{
return result;
}
// Generate .version file // Generate .version file
var version = buildVersion.NuGetVersion; var version = buildVersion.NuGetVersion;
var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}"; var content = $@"{c.BuildContext["CommitHash"]}{Environment.NewLine}{version}{Environment.NewLine}";
@ -548,53 +538,6 @@ namespace Microsoft.DotNet.Cli.Build
return c.Success(); return c.Success();
} }
private static BuildTargetResult CopyAppDeps(BuildTargetContext c, string outputDir)
{
var appDepOutputDir = Path.Combine(outputDir, "appdepsdk");
Rmdir(appDepOutputDir);
Mkdirp(appDepOutputDir);
// Find toolchain package
string packageId;
if (CurrentPlatform.IsWindows)
{
if (CurrentArchitecture.Isx86)
{
// https://github.com/dotnet/cli/issues/1550
c.Warn("Native compilation is not yet working on Windows x86");
return c.Success();
}
packageId = "toolchain.win7-x64.Microsoft.DotNet.AppDep";
}
else if (CurrentPlatform.IsUbuntu)
{
packageId = "toolchain.ubuntu.14.04-x64.Microsoft.DotNet.AppDep";
}
else if (CurrentPlatform.IsCentOS || CurrentPlatform.IsRHEL || CurrentPlatform.IsDebian)
{
c.Warn($"Native compilation is not yet working on {CurrentPlatform.Current}");
return c.Success();
}
else if (CurrentPlatform.IsOSX)
{
packageId = "toolchain.osx.10.10-x64.Microsoft.DotNet.AppDep";
}
else
{
return c.Failed("Unsupported OS Platform");
}
var appDepPath = Path.Combine(
Dirs.NuGetPackages,
packageId,
AppDepSdkVersion);
CopyRecursive(appDepPath, appDepOutputDir, overwrite: true);
return c.Success();
}
public static BuildTargetResult CrossgenSharedFx(BuildTargetContext c, string pathToAssemblies) public static BuildTargetResult CrossgenSharedFx(BuildTargetContext c, string pathToAssemblies)
{ {
// Check if we need to skip crossgen // Check if we need to skip crossgen
@ -620,7 +563,7 @@ namespace Microsoft.DotNet.Cli.Build
// in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term // in CompileTargets and the one in the shared library project.json match and are updated in lock step, but long term
// we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR // we need to be able to look at the project.lock.json file and figure out what version of Microsoft.NETCore.Runtime.CoreCLR
// was used, and then select that version. // was used, and then select that version.
ExecSilent(Crossgen.GetCrossgenPathForVersion(CompileTargets.CoreCLRVersion), ExecSilent(Crossgen.GetCrossgenPathForVersion(CoreCLRVersion),
"-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies); "-readytorun", "-in", file, "-out", tempPathName, "-platform_assemblies_paths", pathToAssemblies);
File.Delete(file); File.Delete(file);

View file

@ -228,7 +228,7 @@ namespace Microsoft.DotNet.Cli.Build
{ {
var dotnet = DotNetCli.Stage0; var dotnet = DotNetCli.Stage0;
dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--infer-runtimes", "--fallbacksource", Dirs.Corehost) dotnet.Restore("--verbosity", "verbose", "--disable-parallel", "--fallbacksource", Dirs.Corehost)
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src")) .WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "src"))
.Execute() .Execute()
.EnsureSuccessful(); .EnsureSuccessful();

View file

@ -9,7 +9,7 @@
"Microsoft.CSharp": "4.0.1-rc2-24008", "Microsoft.CSharp": "4.0.1-rc2-24008",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008",
"Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*", "Microsoft.DotNet.Cli.Build.Framework": "1.0.0-*",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"Octokit": "0.18.0", "Octokit": "0.18.0",
"Microsoft.Net.Http": "2.2.29" "Microsoft.Net.Http": "2.2.29"

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli.Utils
{ {
public class ProjectToolsCommandResolver : ICommandResolver public class ProjectToolsCommandResolver : ICommandResolver
{ {
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetStandardApp15; private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly CommandResolutionStrategy s_commandResolutionStrategy = private static readonly CommandResolutionStrategy s_commandResolutionStrategy =
CommandResolutionStrategy.ProjectToolsPackage; CommandResolutionStrategy.ProjectToolsPackage;

View file

@ -7,10 +7,10 @@
"dependencies": { "dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20459", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-20459",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.Frameworks": "3.5.0-beta-1130", "NuGet.Frameworks": "3.5.0-beta-1160",
"NuGet.ProjectModel": "3.5.0-beta-1130" "NuGet.ProjectModel": "3.5.0-beta-1160"
}, },
"frameworks": { "frameworks": {
"net451": { "net451": {
@ -22,8 +22,7 @@
}, },
"netstandard1.5": { "netstandard1.5": {
"imports": [ "imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+wp80+win8+wpa81+dnxcore50"
"dnxcore50"
], ],
"dependencies": { "dependencies": {
"System.Diagnostics.Process": "4.1.0-rc2-24008" "System.Diagnostics.Process": "4.1.0-rc2-24008"

View file

@ -13,8 +13,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"imports": [ "imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+wp80+win8+wpa81+dnxcore50"
"dnxcore50"
] ]
} }
}, },

View file

@ -12,8 +12,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"imports": [ "imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+wp80+win8+wpa81+dnxcore50"
"dnxcore50"
] ]
} }
}, },

View file

@ -12,8 +12,7 @@
"netstandard1.5": { "netstandard1.5": {
"imports": [ "imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net45+win8", "portable-net45+win8"
"dnxcore50"
] ]
} }
} }

View file

@ -16,8 +16,8 @@
"version": "1.0.0-rc2-20221" "version": "1.0.0-rc2-20221"
}, },
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.RuntimeModel": "3.5.0-beta-1130", "NuGet.RuntimeModel": "3.5.0-beta-1160",
"System.Reflection.Metadata": "1.3.0-rc2-24008" "System.Reflection.Metadata": "1.3.0-rc2-24008"
}, },
"frameworks": { "frameworks": {

View file

@ -12,8 +12,7 @@
"frameworks": { "frameworks": {
"netstandard1.5": { "netstandard1.5": {
"imports": [ "imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+wp80+win8+wpa81+dnxcore50"
"dnxcore50"
] ]
} }
} }

View file

@ -292,7 +292,7 @@ int fx_muxer_t::parse_args_and_execute(
} }
app_candidate = argv[cur_i]; app_candidate = argv[cur_i];
bool is_app_runnable = ends_with(app_candidate, _X(".dll"), false) || ends_with(app_candidate, _X(".exe"), false); bool is_app_runnable = (ends_with(app_candidate, _X(".dll"), false) || ends_with(app_candidate, _X(".exe"), false)) && pal::realpath(&app_candidate);
trace::verbose(_X("App %s runnable=[%d]"), app_candidate.c_str(), is_app_runnable); trace::verbose(_X("App %s runnable=[%d]"), app_candidate.c_str(), is_app_runnable);
// If exec mode is on, then check we have a dll at this point // If exec mode is on, then check we have a dll at this point
if (exec_mode) if (exec_mode)
@ -300,6 +300,7 @@ int fx_muxer_t::parse_args_and_execute(
if (!is_app_runnable) if (!is_app_runnable)
{ {
trace::error(_X("dotnet exec needs a dll to execute. Try dotnet [--help]")); trace::error(_X("dotnet exec needs a dll to execute. Try dotnet [--help]"));
*is_an_app = false;
return InvalidArgFailure; return InvalidArgFailure;
} }
} }

View file

@ -12,6 +12,7 @@ using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Utilities; using Microsoft.DotNet.ProjectModel.Utilities;
using Microsoft.DotNet.Tools.Compiler; using Microsoft.DotNet.Tools.Compiler;
using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.DotNet.ProjectModel.Compilation;
namespace Microsoft.DotNet.Tools.Build namespace Microsoft.DotNet.Tools.Build
{ {
@ -79,7 +80,7 @@ namespace Microsoft.DotNet.Tools.Build
return true; return true;
} }
foreach (var dependency in Sort(_rootProjectDependencies.ProjectDependenciesWithSources)) foreach (var dependency in Sort(_rootProjectDependencies))
{ {
var dependencyProjectContext = ProjectContext.Create(dependency.Path, dependency.Framework, new[] { _rootProject.RuntimeIdentifier }); var dependencyProjectContext = ProjectContext.Create(dependency.Path, dependency.Framework, new[] { _rootProject.RuntimeIdentifier });
@ -514,31 +515,40 @@ namespace Microsoft.DotNet.Tools.Build
executable.MakeCompilationOutputRunnable(); executable.MakeCompilationOutputRunnable();
} }
private static ISet<ProjectDescription> Sort(Dictionary<string, ProjectDescription> projects) private static IEnumerable<ProjectDescription> Sort(ProjectDependenciesFacade dependencies)
{ {
var outputs = new HashSet<ProjectDescription>(); var outputs = new List<ProjectDescription>();
foreach (var pair in projects) foreach (var pair in dependencies.Dependencies)
{ {
Sort(pair.Value, projects, outputs); Sort(pair.Value, dependencies, outputs);
} }
return outputs; return outputs.Distinct(new ProjectComparer());
} }
private static void Sort(ProjectDescription project, Dictionary<string, ProjectDescription> projects, ISet<ProjectDescription> outputs) private static void Sort(LibraryExport node, ProjectDependenciesFacade dependencies, IList<ProjectDescription> outputs)
{ {
// Sorts projects in dependency order so that we only build them once per chain // Sorts projects in dependency order so that we only build them once per chain
foreach (var dependency in project.Dependencies) ProjectDescription projectDependency;
foreach (var dependency in node.Library.Dependencies)
{ {
ProjectDescription projectDependency; // Sort the children
if (projects.TryGetValue(dependency.Name, out projectDependency)) Sort(dependencies.Dependencies[dependency.Name], dependencies, outputs);
{
Sort(projectDependency, projects, outputs);
}
} }
outputs.Add(project); // Add this node to the list if it is a project
if (dependencies.ProjectDependenciesWithSources.TryGetValue(node.Library.Identity.Name, out projectDependency))
{
// Add to the list of projects to build
outputs.Add(projectDependency);
}
}
private class ProjectComparer : IEqualityComparer<ProjectDescription>
{
public bool Equals(ProjectDescription x, ProjectDescription y) => string.Equals(x.Identity.Name, y.Identity.Name, StringComparison.Ordinal);
public int GetHashCode(ProjectDescription obj) => obj.Identity.Name.GetHashCode();
} }
public struct CompilerIO public struct CompilerIO

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Build
{ {
// projectName -> ProjectDescription // projectName -> ProjectDescription
public Dictionary<string, ProjectDescription> ProjectDependenciesWithSources { get; } public Dictionary<string, ProjectDescription> ProjectDependenciesWithSources { get; }
public List<LibraryExport> Dependencies { get; } public Dictionary<string, LibraryExport> Dependencies { get; }
public ProjectDependenciesFacade(ProjectContext rootProject, string configValue) public ProjectDependenciesFacade(ProjectContext rootProject, string configValue)
{ {
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Tools.Build
// Build project references // Build project references
foreach (var dependency in Dependencies) foreach (var dependency in Dependencies)
{ {
var projectDependency = dependency.Library as ProjectDescription; var projectDependency = dependency.Value.Library as ProjectDescription;
if (projectDependency != null && projectDependency.Resolved && projectDependency.Project.Files.SourceFiles.Any()) if (projectDependency != null && projectDependency.Resolved && projectDependency.Project.Files.SourceFiles.Any())
{ {
@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Build
} }
// todo make extension of ProjectContext? // todo make extension of ProjectContext?
private static List<LibraryExport> GetProjectDependencies(ProjectContext projectContext, string configuration) private static Dictionary<string, LibraryExport> GetProjectDependencies(ProjectContext projectContext, string configuration)
{ {
// Create the library exporter // Create the library exporter
var exporter = projectContext.CreateExporter(configuration); var exporter = projectContext.CreateExporter(configuration);
@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Tools.Build
// Gather exports for the project // Gather exports for the project
var dependencies = exporter.GetDependencies().ToList(); var dependencies = exporter.GetDependencies().ToList();
return dependencies; return dependencies.ToDictionary(d => d.Library.Identity.Name);
} }
} }

View file

@ -1,21 +1,20 @@
// 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 Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Compilation;
using NuGet.Frameworks;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Microsoft.DotNet.Cli.Compiler.Common; using Microsoft.DotNet.Cli.Compiler.Common;
using Microsoft.Extensions.PlatformAbstractions; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Files; using Microsoft.DotNet.Files;
using Microsoft.DotNet.Tools.Common; using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Utilities; using Microsoft.DotNet.ProjectModel.Compilation;
using Microsoft.DotNet.ProjectModel.Graph; using Microsoft.DotNet.ProjectModel.Graph;
using NuGet.Versioning; using Microsoft.DotNet.ProjectModel.Utilities;
using Microsoft.DotNet.Tools.Common;
using Microsoft.Extensions.PlatformAbstractions;
using NuGet.Frameworks;
namespace Microsoft.DotNet.Tools.Publish namespace Microsoft.DotNet.Tools.Publish
{ {
@ -134,6 +133,10 @@ namespace Microsoft.DotNet.Tools.Publish
.ToDictionary(e => e.Library.Identity.Name); .ToDictionary(e => e.Library.Identity.Name);
var collectExclusionList = context.IsPortable ? GetExclusionList(context, packageExports) : new HashSet<string>(); var collectExclusionList = context.IsPortable ? GetExclusionList(context, packageExports) : new HashSet<string>();
// Get the output paths used by the call to `dotnet build` above (since we didn't pass `--output`, they will be different from
// our current output paths)
var buildOutputPaths = context.GetOutputPaths(configuration, buildBasePath);
var exports = exporter.GetAllExports(); var exports = exporter.GetAllExports();
foreach (var export in exports.Where(e => !collectExclusionList.Contains(e.Library.Identity.Name))) foreach (var export in exports.Where(e => !collectExclusionList.Contains(e.Library.Identity.Name)))
{ {
@ -141,6 +144,19 @@ namespace Microsoft.DotNet.Tools.Publish
PublishAssetGroups(export.RuntimeAssemblyGroups, outputPath, nativeSubdirectories: false, includeRuntimeGroups: context.IsPortable); PublishAssetGroups(export.RuntimeAssemblyGroups, outputPath, nativeSubdirectories: false, includeRuntimeGroups: context.IsPortable);
PublishAssetGroups(export.NativeLibraryGroups, outputPath, nativeSubdirectories, includeRuntimeGroups: context.IsPortable); PublishAssetGroups(export.NativeLibraryGroups, outputPath, nativeSubdirectories, includeRuntimeGroups: context.IsPortable);
var runtimeAssetsToCopy = export.RuntimeAssets.Where(a => ShouldCopyExportRuntimeAsset(context, buildOutputPaths, export, a));
runtimeAssetsToCopy.StructuredCopyTo(outputPath, outputPaths.IntermediateOutputDirectoryPath);
}
if (context.ProjectFile.HasRuntimeOutput(configuration) && !context.TargetFramework.IsDesktop())
{
PublishFiles(
new[] {
buildOutputPaths.RuntimeFiles.DepsJson,
buildOutputPaths.RuntimeFiles.RuntimeConfigJson
},
outputPath);
} }
if (options.PreserveCompilationContext.GetValueOrDefault()) if (options.PreserveCompilationContext.GetValueOrDefault())
@ -151,9 +167,6 @@ namespace Microsoft.DotNet.Tools.Publish
} }
} }
var buildOutputPaths = context.GetOutputPaths(configuration, buildBasePath, null);
PublishBuildOutputFiles(buildOutputPaths, context, outputPath, Configuration);
var contentFiles = new ContentFiles(context); var contentFiles = new ContentFiles(context);
contentFiles.StructuredCopyTo(outputPath); contentFiles.StructuredCopyTo(outputPath);
@ -171,59 +184,26 @@ namespace Microsoft.DotNet.Tools.Publish
return true; return true;
} }
private void PublishBuildOutputFiles(OutputPaths buildOutputPaths, ProjectContext context, string outputPath, string configuration) /// <summary>
/// Filters which export's RuntimeAssets should get copied to the output path.
/// </summary>
/// <returns>
/// True if the asset should be copied to the output path; otherwise, false.
/// </returns>
private static bool ShouldCopyExportRuntimeAsset(ProjectContext context, OutputPaths buildOutputPaths, LibraryExport export, LibraryAsset asset)
{ {
List<string> filesToPublish = new List<string>(); // The current project has the host .exe in its runtime assets, but it shouldn't be copied
// to the output path during publish. The host will come from the export that has the real host in it.
string[] buildOutputFiles = null; if (context.RootProject.Identity == export.Library.Identity)
if (context.ProjectFile.HasRuntimeOutput(configuration))
{ {
Reporter.Verbose.WriteLine($"publish: using runtime build output files"); if (asset.ResolvedPath == buildOutputPaths.RuntimeFiles.Executable)
buildOutputFiles = new string[]
{ {
buildOutputPaths.RuntimeFiles.DepsJson, return false;
buildOutputPaths.RuntimeFiles.RuntimeConfigJson,
buildOutputPaths.RuntimeFiles.Config,
buildOutputPaths.RuntimeFiles.Assembly,
buildOutputPaths.RuntimeFiles.PdbPath,
Path.ChangeExtension(buildOutputPaths.RuntimeFiles.Assembly, "xml")
};
filesToPublish.AddRange(buildOutputPaths.RuntimeFiles.Resources());
}
else
{
Reporter.Verbose.WriteLine($"publish: using compilation build output files");
buildOutputFiles = new string[]
{
buildOutputPaths.CompilationFiles.Assembly,
buildOutputPaths.CompilationFiles.PdbPath,
Path.ChangeExtension(buildOutputPaths.CompilationFiles.Assembly, "xml")
};
filesToPublish.AddRange(buildOutputPaths.CompilationFiles.Resources());
}
foreach (var buildOutputFile in buildOutputFiles)
{
if (File.Exists(buildOutputFile))
{
filesToPublish.Add(buildOutputFile);
}
else
{
Reporter.Verbose.WriteLine($"publish: build output file not found {buildOutputFile} ");
} }
} }
Reporter.Verbose.WriteLine($"publish: Copying build output files:\n {string.Join("\n", filesToPublish)}");
PublishFiles( return true;
filesToPublish,
outputPath);
} }
private bool InvokeBuildOnProject(ProjectContext context, string buildBasePath, string configuration) private bool InvokeBuildOnProject(ProjectContext context, string buildBasePath, string configuration)

View file

@ -17,10 +17,10 @@
], ],
"dependencies": { "dependencies": {
"NuGet.Commands": { "NuGet.Commands": {
"version": "3.5.0-beta-1130", "version": "3.5.0-beta-1160",
"exclude": "compile" "exclude": "compile"
}, },
"NuGet.CommandLine.XPlat": "3.5.0-beta-1130", "NuGet.CommandLine.XPlat": "3.5.0-beta-1160",
"Newtonsoft.Json": "7.0.1", "Newtonsoft.Json": "7.0.1",
"System.Text.Encoding.CodePages": "4.0.1-rc2-24008", "System.Text.Encoding.CodePages": "4.0.1-rc2-24008",
"System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24008", "System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24008",
@ -55,13 +55,13 @@
} }
}, },
"frameworks": { "frameworks": {
"netstandard1.5": { "netcoreapp1.0": {
"imports": [ "imports": [
"dnxcore50", "dnxcore50",
"netstandardapp1.5", "netstandardapp1.5",
"portable-net45+win8", "portable-net45+win8",
"portable-net45+wp80+win8+wpa81+dnxcore50" "portable-net45+wp80+win8+wpa81+dnxcore50"
] ]
} }
} }
} }

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
{ {
public class GivenAProjectToolsCommandResolver public class GivenAProjectToolsCommandResolver
{ {
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetStandardApp15; private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
private static readonly string s_liveProjectDirectory = private static readonly string s_liveProjectDirectory =
Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithToolDependency"); Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithToolDependency");

View file

@ -10,10 +10,10 @@
}, },
"System.Diagnostics.TraceSource": "4.0.0-rc2-24008", "System.Diagnostics.TraceSource": "4.0.0-rc2-24008",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008", "System.Runtime.Serialization.Primitives": "4.1.1-rc2-24008",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"NuGet.Packaging": "3.5.0-beta-1130", "NuGet.Packaging": "3.5.0-beta-1160",
"NuGet.Frameworks": "3.5.0-beta-1130", "NuGet.Frameworks": "3.5.0-beta-1160",
"NuGet.ProjectModel": "3.5.0-beta-1130", "NuGet.ProjectModel": "3.5.0-beta-1160",
"Microsoft.DotNet.ProjectModel": { "Microsoft.DotNet.ProjectModel": {
"target": "project" "target": "project"
}, },

View file

@ -0,0 +1,46 @@
// 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.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace Microsoft.DotNet.Tools.Publish.Tests
{
public class PublishAppWithDependencies : TestBase
{
[Fact]
public void PublishTestAppWithContentPackage()
{
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithContentPackage")
.WithLockFiles();
var publishCommand = new PublishCommand(testInstance.TestRoot);
var publishResult = publishCommand.Execute();
publishResult.Should().Pass();
var publishDir = publishCommand.GetOutputDirectory(portable: false);
publishDir.Should().HaveFiles(new[]
{
$"AppWithContentPackage{publishCommand.GetExecutableExtension()}",
"AppWithContentPackage.dll",
"AppWithContentPackage.deps.json"
});
// these files come from the contentFiles of the SharedContentA dependency
publishDir
.Sub("scripts")
.Should()
.Exist()
.And
.HaveFile("run.cmd");
publishDir
.Should()
.HaveFile("config.xml");
}
}
}

View file

@ -21,7 +21,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
{ {
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = var testInstance =
testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests").WithLockFiles(); testAssetManager.CreateTestInstance("ProjectWithTests", identifier: "ConsoleTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework( var contexts = ProjectContext.CreateContextForEachFramework(
@ -29,6 +29,11 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
null, null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); _defaultOutputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
} }

View file

@ -20,7 +20,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
public GivenThatWeWantToUseDotnetTestE2EInDesignTime() public GivenThatWeWantToUseDotnetTestE2EInDesignTime()
{ {
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets")); var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets"));
var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests").WithLockFiles(); var testInstance = testAssetManager.CreateTestInstance("ProjectWithTests");
_projectFilePath = Path.Combine(testInstance.TestRoot, "project.json"); _projectFilePath = Path.Combine(testInstance.TestRoot, "project.json");
var contexts = ProjectContext.CreateContextForEachFramework( var contexts = ProjectContext.CreateContextForEachFramework(
@ -28,6 +28,11 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
null, null,
PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers()); PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers());
// Restore the project again in the destination to resolve projects
// Since the lock file has project relative paths in it, those will be broken
// unless we re-restore
new RestoreCommand() { WorkingDirectory = testInstance.TestRoot }.Execute().Should().Pass();
_outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0"); _outputPath = Path.Combine(testInstance.TestRoot, "bin", "Debug", "netcoreapp1.0");
var buildCommand = new BuildCommand(_projectFilePath); var buildCommand = new BuildCommand(_projectFilePath);
var result = buildCommand.Execute(); var result = buildCommand.Execute();

View file

@ -4,8 +4,8 @@
"emitEntryPoint": true "emitEntryPoint": true
}, },
"dependencies": { "dependencies": {
"NuGet.RuntimeModel": "3.5.0-beta-1130", "NuGet.RuntimeModel": "3.5.0-beta-1160",
"NuGet.Versioning": "3.5.0-beta-1130", "NuGet.Versioning": "3.5.0-beta-1160",
"System.CommandLine": "0.1.0-e160119-1", "System.CommandLine": "0.1.0-e160119-1",
"System.Runtime.Serialization.Json": "4.0.2-rc2-24008", "System.Runtime.Serialization.Json": "4.0.2-rc2-24008",
"Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.ProjectModel": "1.0.0-*",

View file

@ -1,15 +0,0 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24008",
"Microsoft.DotNet.AppDep": "1.0.6-prerelease-00003"
},
"frameworks": {
"netstandardapp1.5": {
"imports": "dnxcore50"
}
}
}