Fix bug preventing MakeRunnable on dependent project when using globbing build
This commit is contained in:
parent
07b785c183
commit
670dbca45b
8 changed files with 99 additions and 10 deletions
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ConsoleApplication
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"buildOptions": {
|
||||||
|
"emitEntryPoint": true
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"TestApp2": { "target": "project" }
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"type": "platform",
|
||||||
|
"version": "1.0.0-rc3-*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ConsoleApplication
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"buildOptions": {
|
||||||
|
"emitEntryPoint": true
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"type": "platform",
|
||||||
|
"version": "1.0.0-rc3-*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
TestAssets/TestProjects/AppWithAppDependency/global.json
Normal file
1
TestAssets/TestProjects/AppWithAppDependency/global.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -133,6 +133,26 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override CompilationResult Build(ProjectGraphNode projectNode)
|
||||||
|
{
|
||||||
|
var result = base.Build(projectNode);
|
||||||
|
AfterRootBuild(projectNode, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AfterRootBuild(ProjectGraphNode projectNode, CompilationResult result)
|
||||||
|
{
|
||||||
|
if (result != CompilationResult.IncrementalSkip && projectNode.IsRoot)
|
||||||
|
{
|
||||||
|
var success = result == CompilationResult.Success;
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
MakeRunnable(projectNode);
|
||||||
|
}
|
||||||
|
PrintSummary(projectNode, success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override CompilationResult RunCompile(ProjectGraphNode projectNode)
|
protected override CompilationResult RunCompile(ProjectGraphNode projectNode)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -140,15 +160,6 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
var managedCompiler = new ManagedCompiler(_scriptRunner, _commandFactory);
|
var managedCompiler = new ManagedCompiler(_scriptRunner, _commandFactory);
|
||||||
|
|
||||||
var success = managedCompiler.Compile(projectNode.ProjectContext, _args);
|
var success = managedCompiler.Compile(projectNode.ProjectContext, _args);
|
||||||
if (projectNode.IsRoot)
|
|
||||||
{
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
MakeRunnable(projectNode);
|
|
||||||
}
|
|
||||||
PrintSummary(projectNode, success);
|
|
||||||
}
|
|
||||||
|
|
||||||
return success ? CompilationResult.Success : CompilationResult.Failure;
|
return success ? CompilationResult.Success : CompilationResult.Failure;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
|
|
||||||
protected abstract CompilationResult RunCompile(ProjectGraphNode projectNode);
|
protected abstract CompilationResult RunCompile(ProjectGraphNode projectNode);
|
||||||
|
|
||||||
private CompilationResult Build(ProjectGraphNode projectNode)
|
protected virtual CompilationResult Build(ProjectGraphNode projectNode)
|
||||||
{
|
{
|
||||||
CompilationResult result;
|
CompilationResult result;
|
||||||
if (_compilationResults.TryGetValue(projectNode.ProjectContext.Identity, out result))
|
if (_compilationResults.TryGetValue(projectNode.ProjectContext.Identity, out result))
|
||||||
|
|
|
@ -176,6 +176,25 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||||
informationalVersion.Should().BeEquivalentTo("1.0.0-85");
|
informationalVersion.Should().BeEquivalentTo("1.0.0-85");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void BuildGlobbingMakesAllRunnable()
|
||||||
|
{
|
||||||
|
var testInstance = TestAssetsManager.CreateTestInstance("AppWithAppDependency")
|
||||||
|
.WithLockFiles();
|
||||||
|
|
||||||
|
var cmd = new BuildCommand(string.Format("*{0}project.json", Path.DirectorySeparatorChar), skipLoadProject: true)
|
||||||
|
.WithWorkingDirectory(testInstance.TestRoot)
|
||||||
|
.Execute()
|
||||||
|
.Should()
|
||||||
|
.Pass();
|
||||||
|
|
||||||
|
foreach (var project in new [] { "TestApp1", "TestApp2" })
|
||||||
|
{
|
||||||
|
new DirectoryInfo(Path.Combine(testInstance.TestRoot, project, "bin", "Debug", DefaultFramework))
|
||||||
|
.Should().HaveFile($"{project}.deps.json");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
// [InlineData("net20", false, true)]
|
// [InlineData("net20", false, true)]
|
||||||
// [InlineData("net40", true, true)]
|
// [InlineData("net40", true, true)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue