Fix build breaks and some 'build' tests.
This commit is contained in:
parent
f86952cf1d
commit
96e425f8bb
17 changed files with 156 additions and 22 deletions
|
@ -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 100;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>58808bbc-371e-47d6-a3d0-4902145eda4e</ProjectGuid>
|
||||
<RootNamespace>TestApp</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"preserveCompilationContext": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"TestLibrary": { "target":"project", "version":"1.0.0-*" },
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"prepublish" : ["echo prepublish_output ?%publish:ProjectPath%? ?%publish:Configuration%? ?%publish:OutputPath%? ?%publish:Framework%? ?%publish:Runtime%?"],
|
||||
"postpublish" : ["echo postpublish_output ?%publish:ProjectPath%? ?%publish:Configuration%? ?%publish:OutputPath%? ?%publish:Framework%? ?%publish:Runtime%?"]
|
||||
}
|
||||
}
|
|
@ -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 TestLibrary
|
||||
{
|
||||
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,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>947dd232-8d9b-4b78-9c6a-94f807d2dd58</ProjectGuid>
|
||||
<RootNamespace>TestLibrary</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"nowarn": [ "CS1591" ],
|
||||
"xmlDoc": true,
|
||||
"additionalArguments": [ "-highentropyva+" ]
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"projects": [ "."]
|
||||
}
|
|
@ -44,8 +44,10 @@ namespace Microsoft.DotNet.TestFramework
|
|||
.Where(dir =>
|
||||
{
|
||||
dir = dir.ToLower();
|
||||
return !dir.EndsWith("\\bin") && !dir.Contains("\\bin\\")
|
||||
&& !dir.EndsWith("\\obj") && !dir.Contains("\\obj\\");
|
||||
return !dir.EndsWith($"{Path.DirectorySeparatorChar}bin")
|
||||
&& !dir.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}")
|
||||
&& !dir.EndsWith($"{Path.DirectorySeparatorChar}obj")
|
||||
&& !dir.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}");
|
||||
});
|
||||
|
||||
foreach (string sourceDir in sourceDirs)
|
||||
|
@ -58,7 +60,8 @@ namespace Microsoft.DotNet.TestFramework
|
|||
{
|
||||
file = file.ToLower();
|
||||
return !file.EndsWith("project.lock.json")
|
||||
&& !file.Contains("\\bin\\") && !file.Contains("\\obj\\");
|
||||
&& !file.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}")
|
||||
&& !file.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}");
|
||||
});
|
||||
|
||||
foreach (string srcFile in sourceFiles)
|
||||
|
@ -84,8 +87,10 @@ namespace Microsoft.DotNet.TestFramework
|
|||
.Where(dir =>
|
||||
{
|
||||
dir = dir.ToLower();
|
||||
return dir.EndsWith("\\bin") || dir.Contains("\\bin\\")
|
||||
|| dir.EndsWith("\\obj") || dir.Contains("\\obj\\");
|
||||
return dir.EndsWith($"{Path.DirectorySeparatorChar}bin")
|
||||
|| dir.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}")
|
||||
|| dir.EndsWith($"{Path.DirectorySeparatorChar}obj")
|
||||
|| dir.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}");
|
||||
});
|
||||
|
||||
foreach (string dirPath in binDirs)
|
||||
|
@ -97,7 +102,8 @@ namespace Microsoft.DotNet.TestFramework
|
|||
.Where(file =>
|
||||
{
|
||||
file = file.ToLower();
|
||||
return file.Contains("\\bin\\") || file.Contains("\\obj\\");
|
||||
return file.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}")
|
||||
|| file.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}");
|
||||
});
|
||||
|
||||
foreach (string binFile in binFiles)
|
||||
|
|
|
@ -63,18 +63,18 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
|
||||
[Theory]
|
||||
// global.json exists
|
||||
[InlineData(true, null, null, "TestLibrary/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}/{rid}")]
|
||||
[InlineData(true, "out", null, "TestLibrary/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}", "out")]
|
||||
[InlineData(true, null, "build", "build/TestLibrary/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}/{rid}")]
|
||||
[InlineData(true, "out", "build", "build/TestLibrary/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}", "out")]
|
||||
[InlineData("1", true, null, null, "TestLibrary/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}/{rid}")]
|
||||
[InlineData("2", true, "out", null, "TestLibrary/bin/Debug/{fw}", "TestApp/bin/Debug/{fw}", "out")]
|
||||
[InlineData("3", true, null, "build", "build/TestLibrary/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}/{rid}")]
|
||||
[InlineData("4", true, "out", "build", "build/TestLibrary/bin/Debug/{fw}", "build/TestApp/bin/Debug/{fw}", "out")]
|
||||
//no global.json
|
||||
//[InlineData(false, null, null, "TestLibrary/bin/debug/{fw}", "TestApp/bin/debug/{fw}", "TestApp/bin/debug/{fw}/{rid}")]
|
||||
//[InlineData(false, "out", null, "TestLibrary/bin/debug/{fw}", "TestApp/bin/debug/{fw}", "out")]
|
||||
//[InlineData(false, null, "build", "build/TestLibrary/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}/{rid}")]
|
||||
//[InlineData(false, "out", "build", "build/TestLibrary/bin/debug/{fw}", "build/TestApp/bin/debug/{fw}", "out")]
|
||||
public void DefaultPaths(bool global, string outputValue, string baseValue, string expectedLibCompile, string expectedAppCompile, string expectedAppRuntime)
|
||||
public void DefaultPaths(string testIdentifer, bool global, string outputValue, string baseValue, string expectedLibCompile, string expectedAppCompile, string expectedAppRuntime)
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", callingMethod: )
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", identifier: testIdentifer)
|
||||
.WithLockFiles();
|
||||
GetProjectInfo(testInstance.TestRoot);
|
||||
|
||||
|
@ -96,6 +96,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
[Fact]
|
||||
public void ResourceTest()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary")
|
||||
.WithLockFiles();
|
||||
GetProjectInfo(testInstance.TestRoot);
|
||||
|
||||
var names = new[]
|
||||
{
|
||||
"uk-UA",
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
File.SetLastWriteTimeUtc(file, DateTime.UtcNow);
|
||||
}
|
||||
|
||||
protected CommandResult BuildProject(bool defaultOutput = false, bool noIncremental = false, bool expectBuildFailure = false)
|
||||
protected CommandResult BuildProject(bool noIncremental = false, bool expectBuildFailure = false)
|
||||
{
|
||||
var mainProjectFile = GetProjectFile(MainProject);
|
||||
return BuildProject(mainProjectFile, noIncremental, expectBuildFailure);
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
File.Delete(lockFile);
|
||||
Assert.False(File.Exists(lockFile));
|
||||
|
||||
buildResult = BuildProject(expectBuildFailure : true);
|
||||
buildResult = BuildProject(expectBuildFailure: true);
|
||||
Assert.Contains("does not have a lock file", buildResult.StdErr);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,19 +14,18 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
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)
|
||||
public IncrementalTestsTransitiveRuntime()
|
||||
{
|
||||
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));
|
||||
MainProject = "TestLibrary2";
|
||||
ExpectedOutput = "This string came from the test library!" + Environment.NewLine;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSkipsRebuildWithTransitiveExeDependency()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithTransitiveAppDependency")
|
||||
.WithLockFiles();
|
||||
TestProjectRoot = testInstance.TestRoot;
|
||||
var buildResult = BuildProject();
|
||||
buildResult.Should().HaveCompiledProject(MainProject);
|
||||
buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency);
|
||||
|
@ -40,5 +39,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
buildResult.Should().HaveSkippedProjectCompilation(AppProject);
|
||||
buildResult.Should().HaveSkippedProjectCompilation(LibraryProject);
|
||||
}
|
||||
|
||||
protected override string GetProjectDirectory(string projectName)
|
||||
{
|
||||
return Path.Combine(TestProjectRoot, projectName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
"content": [
|
||||
"../../TestAssets/TestProjects/TestLibraryWithAnalyzer/*",
|
||||
"../../TestAssets/TestProjects/TestLibrary/*",
|
||||
"../../TestAssets/TestProjects/TestAppWithLibrary/TestLibrary/*",
|
||||
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/*",
|
||||
"../../TestAssets/TestProjects/global.json"
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue