Merge branch 'rel/1.0.0' of https://github.com/MichaelSimons/cli into debianbuild
This commit is contained in:
commit
e82a14de71
17 changed files with 308 additions and 63 deletions
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace StandaloneApp
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
"portable-net45+win8"
|
||||
],
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": "1.0.0-rc2-*"
|
||||
}
|
||||
}
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x64": {},
|
||||
"win7-x86": {},
|
||||
"osx.10.10-x64": {},
|
||||
"osx.10.11-x64": {},
|
||||
"ubuntu.14.04-x64": {},
|
||||
"centos.7-x64": {},
|
||||
"rhel.7.2-x64": {},
|
||||
"debian.8.2-x64": {}
|
||||
},
|
||||
|
||||
"runtimeOptions": {
|
||||
"somethingString": "anything",
|
||||
"somethingBoolean": true,
|
||||
"someArray": ["one", "two"],
|
||||
"someObject": {
|
||||
"someProperty": "someValue"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,9 +12,9 @@
|
|||
"../src/*.cs"
|
||||
],
|
||||
"frameworks": {
|
||||
"netstandardapp1.5": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": "1.0.0-rc2-24008"
|
||||
"Microsoft.NETCore.App": "1.0.0-rc2-3002306"
|
||||
},
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
|
|
|
@ -422,6 +422,9 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
File.Copy(
|
||||
Path.Combine(Dirs.Corehost, HostPolicyBaseName),
|
||||
Path.Combine(SharedFrameworkNameAndVersionRoot, HostPolicyBaseName), true);
|
||||
File.Copy(
|
||||
Path.Combine(Dirs.Corehost, DotnetHostFxrBaseName),
|
||||
Path.Combine(SharedFrameworkNameAndVersionRoot, DotnetHostFxrBaseName), true);
|
||||
|
||||
if (File.Exists(Path.Combine(SharedFrameworkNameAndVersionRoot, "mscorlib.ni.dll")))
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Target(nameof(RestoreTestAssetPackages), nameof(BuildTestAssetPackages))]
|
||||
public static BuildTargetResult SetupTestPackages(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target(nameof(RestoreTestAssetProjects), nameof(RestoreDesktopTestAssetProjects), nameof(BuildTestAssetProjects))]
|
||||
[Target(nameof(RestoreTestAssetProjects), nameof(RestoreDesktopTestAssetProjects), nameof(RestoreCrossPublishTestAssetProjects), nameof(BuildTestAssetProjects))]
|
||||
public static BuildTargetResult SetupTestProjects(BuildTargetContext c) => c.Success();
|
||||
|
||||
[Target]
|
||||
|
@ -137,6 +137,18 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target]
|
||||
public static BuildTargetResult RestoreCrossPublishTestAssetProjects(BuildTargetContext c)
|
||||
{
|
||||
var dotnet = DotNetCli.Stage2;
|
||||
|
||||
dotnet.Restore("--verbosity", "verbose")
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "CrossPublishTestProjects"))
|
||||
.Execute().EnsureSuccessful();
|
||||
|
||||
return c.Success();
|
||||
}
|
||||
|
||||
[Target(nameof(CleanTestPackages), nameof(CleanProductPackages))]
|
||||
public static BuildTargetResult BuildTestAssetPackages(BuildTargetContext c)
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
public static readonly string ResponseFileSuffix = ".rsp";
|
||||
|
||||
public static readonly string PublishedHostExecutableName = "dotnet";
|
||||
public static readonly string HostExecutableName = "corehost" + ExeSuffix;
|
||||
public static readonly string[] HostBinaryNames = new string[] {
|
||||
HostExecutableName,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
|
|
|
@ -54,9 +54,9 @@ namespace Microsoft.DotNet.ProjectModel.Server
|
|||
|
||||
_messengers = new List<Messenger<ProjectContextSnapshot>>
|
||||
{
|
||||
new DependencyDiagnosticsMessenger(Transmit),
|
||||
new ReferencesMessenger(Transmit),
|
||||
new DependenciesMessenger(Transmit),
|
||||
new DependencyDiagnosticsMessenger(Transmit),
|
||||
new CompilerOptionsMessenger(Transmit),
|
||||
new SourcesMessenger(Transmit)
|
||||
};
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
}
|
||||
|
||||
// Use a library exporter to collect publish assets
|
||||
var exporter = context.CreateExporter(configuration);
|
||||
var exporter = context.CreateExporter(configuration, buildBasePath);
|
||||
|
||||
var isPortable = string.IsNullOrEmpty(context.RuntimeIdentifier);
|
||||
|
||||
|
@ -139,11 +139,10 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
var exports = exporter.GetAllExports();
|
||||
foreach (var export in exports.Where(e => !collectExclusionList.Contains(e.Library.Identity.Name)))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"Publishing {export.Library.Identity.ToString().Green().Bold()} ...");
|
||||
Reporter.Verbose.WriteLine($"publish: Publishing {export.Library.Identity.ToString().Green().Bold()} ...");
|
||||
|
||||
PublishAssetGroups(export.RuntimeAssemblyGroups, outputPath, nativeSubdirectories: false, includeRuntimeGroups: isPortable);
|
||||
PublishAssetGroups(export.NativeLibraryGroups, outputPath, nativeSubdirectories, includeRuntimeGroups: isPortable);
|
||||
export.RuntimeAssets.StructuredCopyTo(outputPath, outputPaths.IntermediateOutputDirectoryPath);
|
||||
}
|
||||
|
||||
if (options.PreserveCompilationContext.GetValueOrDefault())
|
||||
|
@ -153,19 +152,9 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
PublishRefs(export, outputPath, !collectExclusionList.Contains(export.Library.Identity.Name));
|
||||
}
|
||||
}
|
||||
|
||||
if (context.ProjectFile.HasRuntimeOutput(configuration) && !context.TargetFramework.IsDesktop())
|
||||
{
|
||||
// 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);
|
||||
PublishFiles(
|
||||
new[] {
|
||||
buildOutputPaths.RuntimeFiles.DepsJson,
|
||||
buildOutputPaths.RuntimeFiles.RuntimeConfigJson
|
||||
},
|
||||
outputPath);
|
||||
}
|
||||
|
||||
var buildOutputPaths = context.GetOutputPaths(configuration, buildBasePath, null);
|
||||
PublishBuildOutputFiles(buildOutputPaths, context, outputPath, Configuration);
|
||||
|
||||
var contentFiles = new ContentFiles(context);
|
||||
contentFiles.StructuredCopyTo(outputPath);
|
||||
|
@ -173,17 +162,72 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
// Publish a host if this is an application
|
||||
if (options.EmitEntryPoint.GetValueOrDefault() && !string.IsNullOrEmpty(context.RuntimeIdentifier))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"Copying native host to output to create fully standalone output.");
|
||||
PublishHost(context, outputPath, options);
|
||||
Reporter.Verbose.WriteLine($"publish: Renaming native host in output to create fully standalone output.");
|
||||
RenamePublishedHost(context, outputPath, options);
|
||||
}
|
||||
|
||||
RunScripts(context, ScriptNames.PostPublish, contextVariables);
|
||||
|
||||
Reporter.Output.WriteLine($"Published to {outputPath}".Green().Bold());
|
||||
Reporter.Output.WriteLine($"publish: Published to {outputPath}".Green().Bold());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PublishBuildOutputFiles(OutputPaths buildOutputPaths, ProjectContext context, string outputPath, string configuration)
|
||||
{
|
||||
List<string> filesToPublish = new List<string>();
|
||||
|
||||
string[] buildOutputFiles = null;
|
||||
|
||||
if (context.ProjectFile.HasRuntimeOutput(configuration))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"publish: using runtime build output files");
|
||||
|
||||
buildOutputFiles = new string[]
|
||||
{
|
||||
buildOutputPaths.RuntimeFiles.DepsJson,
|
||||
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(
|
||||
filesToPublish,
|
||||
outputPath);
|
||||
}
|
||||
|
||||
private bool InvokeBuildOnProject(ProjectContext context, string buildBasePath, string configuration)
|
||||
{
|
||||
var args = new List<string>()
|
||||
|
@ -272,33 +316,60 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
}
|
||||
}
|
||||
|
||||
private static int PublishHost(ProjectContext context, string outputPath, CommonCompilerOptions compilationOptions)
|
||||
private static int RenamePublishedHost(ProjectContext context, string outputPath, CommonCompilerOptions compilationOptions)
|
||||
{
|
||||
if (context.TargetFramework.IsDesktop())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach (var binaryName in Constants.HostBinaryNames)
|
||||
var publishedHostFile = ResolvePublishedHostFile(outputPath);
|
||||
if (publishedHostFile == null)
|
||||
{
|
||||
var hostBinaryPath = Path.Combine(AppContext.BaseDirectory, binaryName);
|
||||
if (!File.Exists(hostBinaryPath))
|
||||
{
|
||||
Reporter.Error.WriteLine($"Cannot find {binaryName} in the dotnet directory.".Red());
|
||||
return 1;
|
||||
}
|
||||
Reporter.Output.WriteLine($"publish: warning: host executable not available in dependencies, using host for current platform");
|
||||
// TODO should this be an error?
|
||||
|
||||
var outputBinaryName = binaryName.Equals(Constants.HostExecutableName)
|
||||
? compilationOptions.OutputName + Constants.ExeSuffix
|
||||
: binaryName;
|
||||
var outputBinaryPath = Path.Combine(outputPath, outputBinaryName);
|
||||
CoreHost.CopyTo(outputPath, compilationOptions.OutputName + Constants.ExeSuffix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
File.Copy(hostBinaryPath, outputBinaryPath, overwrite: true);
|
||||
var publishedHostExtension = Path.GetExtension(publishedHostFile);
|
||||
var renamedHostName = compilationOptions.OutputName + publishedHostExtension;
|
||||
var renamedHostFile = Path.Combine(outputPath, renamedHostName);
|
||||
|
||||
try
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"publish: renaming published host {publishedHostFile} to {renamedHostFile}");
|
||||
File.Copy(publishedHostFile, renamedHostFile, true);
|
||||
File.Delete(publishedHostFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Reporter.Error.WriteLine($"publish: Failed to rename {publishedHostFile} to {renamedHostFile}: {e.Message}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static string ResolvePublishedHostFile(string outputPath)
|
||||
{
|
||||
var tryExtensions = new string[] { "", ".exe" };
|
||||
|
||||
foreach (var extension in tryExtensions)
|
||||
{
|
||||
var hostFile = Path.Combine(outputPath, Constants.PublishedHostExecutableName + extension);
|
||||
if (File.Exists(hostFile))
|
||||
{
|
||||
Reporter.Verbose.WriteLine($"resolved published host: {hostFile}");
|
||||
return hostFile;
|
||||
}
|
||||
}
|
||||
|
||||
Reporter.Verbose.WriteLine($"failed to resolve published host in: {outputPath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void PublishFiles(IEnumerable<string> files, string outputPath)
|
||||
{
|
||||
foreach (var file in files)
|
||||
|
@ -326,6 +397,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
|||
Directory.CreateDirectory(destinationDirectory);
|
||||
}
|
||||
|
||||
Reporter.Verbose.WriteLine($"Publishing file {Path.GetFileName(file.RelativePath)} to {destinationDirectory}");
|
||||
File.Copy(file.ResolvedPath, Path.Combine(destinationDirectory, file.FileName), overwrite: true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
projectToolsCommandResolver.GenerateDepsJsonFile(lockFile, depsJsonFile);
|
||||
|
||||
File.ReadAllText(depsJsonFile).Should().Be("temp");
|
||||
File.Delete(depsJsonFile);
|
||||
}
|
||||
|
||||
private ProjectToolsCommandResolver SetupProjectToolsCommandResolver(
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
private Project _project;
|
||||
private readonly string _projectPath;
|
||||
private readonly string _outputDirectory;
|
||||
private readonly string _buidBasePathDirectory;
|
||||
private readonly string _buildBasePathDirectory;
|
||||
private readonly string _configuration;
|
||||
private readonly string _framework;
|
||||
private readonly string _versionSuffix;
|
||||
|
@ -44,9 +44,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
get
|
||||
{
|
||||
return _buidBasePathDirectory == string.Empty ?
|
||||
return _buildBasePathDirectory == string.Empty ?
|
||||
"" :
|
||||
$"-b {_buidBasePathDirectory}";
|
||||
$"-b {_buildBasePathDirectory}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
public BuildCommand(
|
||||
string projectPath,
|
||||
string output="",
|
||||
string buidBasePath="",
|
||||
string buildBasePath = "",
|
||||
string configuration="",
|
||||
string framework="",
|
||||
string runtime="",
|
||||
|
@ -224,7 +224,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
_project = ProjectReader.GetProject(projectPath);
|
||||
|
||||
_outputDirectory = output;
|
||||
_buidBasePathDirectory = buidBasePath;
|
||||
_buildBasePathDirectory = buildBasePath;
|
||||
_configuration = configuration;
|
||||
_versionSuffix = versionSuffix;
|
||||
_framework = framework;
|
||||
|
|
|
@ -21,8 +21,15 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
private readonly string _config;
|
||||
private readonly bool _noBuild;
|
||||
private readonly string _output;
|
||||
private readonly string _buidBasePathDirectory;
|
||||
|
||||
public PublishCommand(string projectPath, string framework = "", string runtime = "", string output = "", string config = "", bool forcePortable = false, bool noBuild = false)
|
||||
public PublishCommand(string projectPath,
|
||||
string framework = "",
|
||||
string runtime = "",
|
||||
string output = "",
|
||||
string config = "",
|
||||
bool noBuild = false,
|
||||
string buildBasePath = "")
|
||||
: base("dotnet")
|
||||
{
|
||||
_path = projectPath;
|
||||
|
@ -32,6 +39,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
_output = output;
|
||||
_config = config;
|
||||
_noBuild = noBuild;
|
||||
_buidBasePathDirectory = buildBasePath;
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
|
@ -93,7 +101,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return $"{_path} {FrameworkOption} {RuntimeOption} {OutputOption} {ConfigOption} {NoBuildFlag}";
|
||||
return $"{_path} {FrameworkOption} {RuntimeOption} {OutputOption} {ConfigOption} {NoBuildFlag} {BuildBasePathOption}";
|
||||
}
|
||||
|
||||
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
||||
|
@ -101,5 +109,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
private string OutputOption => string.IsNullOrEmpty(_output) ? "" : $"-o \"{_output}\"";
|
||||
private string ConfigOption => string.IsNullOrEmpty(_config) ? "" : $"-c {_output}";
|
||||
private string NoBuildFlag => _noBuild ? "--no-build" :"";
|
||||
private string BuildBasePathOption => string.IsNullOrEmpty(_buidBasePathDirectory) ? "" : $"-b {_buidBasePathDirectory}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,13 +55,20 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
if (s_testsAssetsMgr == null)
|
||||
{
|
||||
string assetsRoot = Path.Combine(RepoRoot, "TestAssets", "TestProjects");
|
||||
s_testsAssetsMgr = new TestAssetsManager(assetsRoot);
|
||||
s_testsAssetsMgr = GetTestGroupTestAssetsManager("TestProjects");
|
||||
}
|
||||
|
||||
return s_testsAssetsMgr;
|
||||
}
|
||||
}
|
||||
|
||||
protected static TestAssetsManager GetTestGroupTestAssetsManager(string testGroup)
|
||||
{
|
||||
string assetsRoot = Path.Combine(RepoRoot, "TestAssets", testGroup);
|
||||
var testAssetsMgr = new TestAssetsManager(assetsRoot);
|
||||
|
||||
return testAssetsMgr;
|
||||
}
|
||||
|
||||
protected TestBase()
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
|
||||
new BuildCommand(GetProjectPath(_testAppDirDirInfo),
|
||||
output: outputValue != null ? Path.Combine(_testProjectsRoot, outputValue) : string.Empty,
|
||||
buidBasePath: baseValue != null ? Path.Combine(_testProjectsRoot, baseValue) : string.Empty,
|
||||
buildBasePath: baseValue != null ? Path.Combine(_testProjectsRoot, baseValue) : string.Empty,
|
||||
framework: DefaultFramework)
|
||||
.ExecuteWithCapturedOutput().Should().Pass();
|
||||
|
||||
|
|
|
@ -80,6 +80,43 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DependencyDiagnsoticsAfterDependencies()
|
||||
{
|
||||
var projectPath = Path.Combine(_testAssetsManager.AssetsRoot, "EmptyConsoleApp");
|
||||
Assert.NotNull(projectPath);
|
||||
|
||||
using (var server = new DthTestServer(_loggerFactory))
|
||||
using (var client = new DthTestClient(server, _loggerFactory))
|
||||
{
|
||||
client.Initialize(projectPath);
|
||||
var messages = client.DrainAllMessages()
|
||||
.Select(message => message.MessageType)
|
||||
.ToArray();
|
||||
|
||||
var expectDependencies = true;
|
||||
var expectDependencyDiagnostics = false;
|
||||
for (var i = 0; i < messages.Length; ++i)
|
||||
{
|
||||
if (messages[i] == MessageTypes.Dependencies)
|
||||
{
|
||||
Assert.True(expectDependencies);
|
||||
expectDependencies = false;
|
||||
expectDependencyDiagnostics = true;
|
||||
}
|
||||
else if (messages[i] == MessageTypes.DependencyDiagnostics)
|
||||
{
|
||||
Assert.True(expectDependencyDiagnostics);
|
||||
expectDependencyDiagnostics = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.False(expectDependencies);
|
||||
Assert.False(expectDependencyDiagnostics);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(4, 4)]
|
||||
[InlineData(5, 4)]
|
||||
|
@ -195,19 +232,19 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
|
||||
client.Initialize(movedProjectPath);
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrieveDependencyDiagnosticsCollection()
|
||||
.RetrieveDependencyDiagnosticsErrorAt(0)
|
||||
.AssertProperty<string>("FormattedMessage", message => message.Contains("error NU1002"))
|
||||
.RetrievePropertyAs<JObject>("Source")
|
||||
.AssertProperty("Name", "EmptyLibrary");
|
||||
|
||||
client.DrainTillFirst("Dependencies")
|
||||
.RetrieveDependency("EmptyLibrary")
|
||||
.AssertProperty<JArray>("Errors", errorsArray => errorsArray.Count == 1)
|
||||
.AssertProperty<JArray>("Warnings", warningsArray => warningsArray.Count == 0)
|
||||
.AssertProperty("Name", "EmptyLibrary")
|
||||
.AssertProperty("Resolved", false);
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrieveDependencyDiagnosticsCollection()
|
||||
.RetrieveDependencyDiagnosticsErrorAt(0)
|
||||
.AssertProperty<string>("FormattedMessage", message => message.Contains("error NU1002"))
|
||||
.RetrievePropertyAs<JObject>("Source")
|
||||
.AssertProperty("Name", "EmptyLibrary");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,17 +267,17 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
.RetrievePropertyAs<JArray>("ProjectSearchPaths")
|
||||
.AssertJArrayCount(2);
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrievePayloadAs<JObject>()
|
||||
.AssertProperty<JArray>("Errors", array => array.Count == 0)
|
||||
.AssertProperty<JArray>("Warnings", array => array.Count == 0);
|
||||
|
||||
client.DrainTillFirst("Dependencies")
|
||||
.RetrieveDependency("Newtonsoft.Json")
|
||||
.AssertProperty("Type", "Project")
|
||||
.AssertProperty("Resolved", true)
|
||||
.AssertProperty<JArray>("Errors", array => array.Count == 0, _ => "Dependency shouldn't contain any error.");
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrievePayloadAs<JObject>()
|
||||
.AssertProperty<JArray>("Errors", array => array.Count == 0)
|
||||
.AssertProperty<JArray>("Warnings", array => array.Count == 0);
|
||||
|
||||
// Overwrite the global.json to remove search path to ext
|
||||
File.WriteAllText(
|
||||
Path.Combine(projectPath, "home", GlobalSettings.FileName),
|
||||
|
@ -254,11 +291,6 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
.AssertJArrayCount(1)
|
||||
.AssertJArrayElement(0, Path.Combine(projectPath, "home", "src"));
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrieveDependencyDiagnosticsCollection()
|
||||
.RetrieveDependencyDiagnosticsErrorAt<JObject>(0)
|
||||
.AssertProperty("ErrorCode", "NU1010");
|
||||
|
||||
client.DrainTillFirst("Dependencies")
|
||||
.RetrieveDependency("Newtonsoft.Json")
|
||||
.AssertProperty("Type", "")
|
||||
|
@ -267,6 +299,11 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
.AssertJArrayCount(1)
|
||||
.RetrieveArraryElementAs<JObject>(0)
|
||||
.AssertProperty("ErrorCode", "NU1010");
|
||||
|
||||
client.DrainTillFirst("DependencyDiagnostics")
|
||||
.RetrieveDependencyDiagnosticsCollection()
|
||||
.RetrieveDependencyDiagnosticsErrorAt<JObject>(0)
|
||||
.AssertProperty("ErrorCode", "NU1010");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,61 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
publishCommand.Execute().Should().Fail();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("centos.7-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
|
||||
[InlineData("rhel.7.2-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
|
||||
[InlineData("ubuntu.14.04-x64", "", new string[] { "libhostfxr.so", "libcoreclr.so", "libhostpolicy.so" })]
|
||||
[InlineData("win7-x64", ".exe", new string[] { "hostfxr.dll", "coreclr.dll", "hostpolicy.dll" })]
|
||||
[InlineData("osx.10.11-x64", "", new string[] { "libhostfxr.dylib", "libcoreclr.dylib", "libhostpolicy.dylib" })]
|
||||
public void CrossPublishingSucceedsAndHasExpectedArtifacts(string rid, string hostExtension, string[] expectedArtifacts)
|
||||
{
|
||||
var testNugetCache = "packages_cross_publish_test";
|
||||
TestInstance instance = GetTestGroupTestAssetsManager("CrossPublishTestProjects")
|
||||
.CreateTestInstance("StandaloneAppCrossPublish");
|
||||
|
||||
var testProject = Path.Combine(instance.TestRoot, "project.json");
|
||||
|
||||
var restoreCommand = new RestoreCommand();
|
||||
|
||||
restoreCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
|
||||
restoreCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
|
||||
restoreCommand.Execute().Should().Pass();
|
||||
|
||||
var buildCommand = new BuildCommand(testProject, runtime: rid);
|
||||
|
||||
buildCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
|
||||
buildCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
|
||||
buildCommand.Execute().Should().Pass();
|
||||
|
||||
var publishCommand = new PublishCommand(testProject, runtime: rid, noBuild: true);
|
||||
publishCommand.Environment["NUGET_PACKAGES"] = testNugetCache;
|
||||
publishCommand.WorkingDirectory = Path.GetDirectoryName(testProject);
|
||||
publishCommand.Execute().Should().Pass();
|
||||
|
||||
var publishedDir = publishCommand.GetOutputDirectory();
|
||||
publishedDir.Should().HaveFile("StandaloneAppCrossPublish"+ hostExtension);
|
||||
|
||||
foreach (var artifact in expectedArtifacts)
|
||||
{
|
||||
publishedDir.Should().HaveFile(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PublishesWhenPrebuildWithBuildBasePath()
|
||||
{
|
||||
TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary")
|
||||
.WithLockFiles();
|
||||
|
||||
string basePath = Path.Combine(instance.TestRoot, "build");
|
||||
string testProject = _getProjectJson(instance.TestRoot, "TestApp");
|
||||
var buildCommand = new BuildCommand(testProject, buildBasePath: basePath);
|
||||
buildCommand.Execute().Should().Pass();
|
||||
|
||||
var publishCommand = new PublishCommand(testProject, buildBasePath: basePath, noBuild: true);
|
||||
publishCommand.Execute().Should().Pass();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LibraryPublishTest()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue