Do not search for runtime output in dependencies
This commit is contained in:
parent
23b1b077dd
commit
4462dc21f8
9 changed files with 124 additions and 12 deletions
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"emitEntryPoint": true
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"TestLibrary": { "target":"project"},
|
"TestLibrary": { "target":"project", "version":"1.0.0-*" },
|
||||||
|
|
||||||
"NETStandard.Library": "1.0.0-rc2-23810"
|
"NETStandard.Library": "1.0.0-rc2-23810"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// 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.Diagnostics;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static int Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine(TestLibrary.Helper.GetMessage());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"TestLibraryWithAppDependency": { "target":"project", "version":"1.0.0-*" },
|
||||||
|
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
namespace TestLibrary2
|
||||||
|
{
|
||||||
|
public static class Helper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A message</returns>
|
||||||
|
public static string GetMessage()
|
||||||
|
{
|
||||||
|
return "This string came from the test library!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SayHi()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello there!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"dependencies": {
|
||||||
|
"TestApp": { "target":"project", "version":"1.0.0-*" },
|
||||||
|
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -91,7 +91,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
|
|
||||||
private bool NeedsRebuilding(ProjectContext project, ProjectDependenciesFacade dependencies, string baseBuildPath)
|
private bool NeedsRebuilding(ProjectContext project, ProjectDependenciesFacade dependencies, string baseBuildPath)
|
||||||
{
|
{
|
||||||
var compilerIO = GetCompileIO(project, _args.ConfigValue, baseBuildPath, _args.OutputValue, dependencies);
|
var compilerIO = GetCompileIO(project, _args.ConfigValue, baseBuildPath, _args.OutputValue, dependencies, project == _rootProject);
|
||||||
|
|
||||||
// rebuild if empty inputs / outputs
|
// rebuild if empty inputs / outputs
|
||||||
if (!(compilerIO.Outputs.Any() && compilerIO.Inputs.Any()))
|
if (!(compilerIO.Outputs.Any() && compilerIO.Inputs.Any()))
|
||||||
|
@ -437,12 +437,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
// computes all the inputs and outputs that would be used in the compilation of a project
|
// computes all the inputs and outputs that would be used in the compilation of a project
|
||||||
// ensures that all paths are files
|
// ensures that all paths are files
|
||||||
// ensures no missing inputs
|
// ensures no missing inputs
|
||||||
public static CompilerIO GetCompileIO(
|
public static CompilerIO GetCompileIO(ProjectContext project, string buildConfiguration, string buildBasePath, string outputPath, ProjectDependenciesFacade dependencies, bool isRootProject)
|
||||||
ProjectContext project,
|
|
||||||
string buildConfiguration,
|
|
||||||
string buildBasePath,
|
|
||||||
string outputPath,
|
|
||||||
ProjectDependenciesFacade dependencies)
|
|
||||||
{
|
{
|
||||||
var compilerIO = new CompilerIO(new List<string>(), new List<string>());
|
var compilerIO = new CompilerIO(new List<string>(), new List<string>());
|
||||||
var calculator = project.GetOutputPaths(buildConfiguration, buildBasePath, outputPath);
|
var calculator = project.GetOutputPaths(buildConfiguration, buildBasePath, outputPath);
|
||||||
|
@ -462,7 +457,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
AddDependencies(dependencies, compilerIO);
|
AddDependencies(dependencies, compilerIO);
|
||||||
|
|
||||||
var allOutputPath = new List<string>(calculator.CompilationFiles.All());
|
var allOutputPath = new List<string>(calculator.CompilationFiles.All());
|
||||||
if (project.ProjectFile.HasRuntimeOutput(buildConfiguration))
|
if (isRootProject && project.ProjectFile.HasRuntimeOutput(buildConfiguration))
|
||||||
{
|
{
|
||||||
allOutputPath.AddRange(calculator.RuntimeFiles.All());
|
allOutputPath.AddRange(calculator.RuntimeFiles.All());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,16 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||||
|
|
||||||
protected readonly string MainProject;
|
protected readonly string MainProject;
|
||||||
protected readonly string ExpectedOutput;
|
protected readonly string ExpectedOutput;
|
||||||
|
protected readonly TempDirectory Root;
|
||||||
|
|
||||||
public IncrementalTestBase(string testProjectsRoot, string mainProject, string expectedOutput)
|
public IncrementalTestBase(string testProjectsRoot, string mainProject, string expectedOutput)
|
||||||
{
|
{
|
||||||
MainProject = mainProject;
|
MainProject = mainProject;
|
||||||
ExpectedOutput = expectedOutput;
|
ExpectedOutput = expectedOutput;
|
||||||
|
|
||||||
var root = Temp.CreateDirectory();
|
Root = Temp.CreateDirectory();
|
||||||
|
|
||||||
TempProjectRoot = root.CopyDirectory(testProjectsRoot);
|
TempProjectRoot = Root.CopyDirectory(testProjectsRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void TouchSourcesOfProject()
|
protected void TouchSourcesOfProject()
|
||||||
|
|
44
test/dotnet-build.Tests/IncrementalTestsTransitiveRuntime.cs
Normal file
44
test/dotnet-build.Tests/IncrementalTestsTransitiveRuntime.cs
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// 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.IO;
|
||||||
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||||
|
{
|
||||||
|
public class IncrementalTestsTransitiveRuntime : IncrementalTestBase
|
||||||
|
{
|
||||||
|
private const string TestLibraryWithAppDependency = "TestLibraryWithAppDependency";
|
||||||
|
private const string LibraryProject = "TestLibrary";
|
||||||
|
private const string AppProject = "TestApp";
|
||||||
|
|
||||||
|
public IncrementalTestsTransitiveRuntime() : base(
|
||||||
|
Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", "TestAppWithTransitiveAppDependency"),
|
||||||
|
"TestAppWithTransitiveAppDependency",
|
||||||
|
"This string came from the test library!" + Environment.NewLine)
|
||||||
|
{
|
||||||
|
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", LibraryProject));
|
||||||
|
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", AppProject));
|
||||||
|
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", TestLibraryWithAppDependency));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestSkipsRebuildWithTransitiveExeDependency()
|
||||||
|
{
|
||||||
|
var buildResult = BuildProject();
|
||||||
|
buildResult.Should().HaveCompiledProject(MainProject);
|
||||||
|
buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency);
|
||||||
|
buildResult.Should().HaveCompiledProject(AppProject);
|
||||||
|
buildResult.Should().HaveCompiledProject(LibraryProject);
|
||||||
|
|
||||||
|
buildResult = BuildProject();
|
||||||
|
|
||||||
|
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
|
||||||
|
buildResult.Should().HaveSkippedProjectCompilation(TestLibraryWithAppDependency);
|
||||||
|
buildResult.Should().HaveSkippedProjectCompilation(AppProject);
|
||||||
|
buildResult.Should().HaveSkippedProjectCompilation(LibraryProject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,8 @@
|
||||||
"../../TestAssets/TestProjects/TestProjectToProjectDependencies/**/*",
|
"../../TestAssets/TestProjects/TestProjectToProjectDependencies/**/*",
|
||||||
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/**/*",
|
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/**/*",
|
||||||
"../../TestAssets/TestProjects/TestProjectWithResource/**/*",
|
"../../TestAssets/TestProjects/TestProjectWithResource/**/*",
|
||||||
|
"../../TestAssets/TestProjects/TestLibraryWithAppDependency/**/*",
|
||||||
|
"../../TestAssets/TestProjects/TestAppWithTransitiveAppDependency/**/*",
|
||||||
"../../TestAssets/TestProjects/global.json"
|
"../../TestAssets/TestProjects/global.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue