Fix the paths at which CompileContext locates resgen outputs.

Fixes #1136
This commit is contained in:
Pranav K 2016-02-08 16:06:13 -08:00
parent 98b37fdd5e
commit 1d25d2574d
15 changed files with 568 additions and 4 deletions

View file

@ -0,0 +1,31 @@
// 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 IncrementalTestsOnCultureSpecificResource : IncrementalTestBase
{
public IncrementalTestsOnCultureSpecificResource() : base(
Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", "TestProjectWithCultureSpecificResource"),
"TestProjectWithCultureSpecificResource",
"Hello World!" + Environment.NewLine + "Bonjour!" + Environment.NewLine)
{
}
[Fact]
public void TestRebuildSkipsCompilationOnNonCultureResource()
{
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult = BuildProject();
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
}
}
}

View file

@ -0,0 +1,30 @@
// 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 IncrementalTestsOnResources : IncrementalTestBase
{
public IncrementalTestsOnResources() : base(
Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", "TestProjectWithResource"),
"TestProjectWithResource",
"Hello World!" + Environment.NewLine)
{
}
[Fact]
public void TestRebuildSkipsCompilationOnNonCultureResource()
{
var buildResult = BuildProject();
buildResult.Should().HaveCompiledProject(MainProject);
buildResult = BuildProject();
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
}
}
}

View file

@ -25,6 +25,8 @@
"../../TestAssets/TestProjects/TestLibrary/**/*",
"../../TestAssets/TestProjects/TestSimpleIncrementalApp/*",
"../../TestAssets/TestProjects/TestProjectToProjectDependencies/**/*",
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/**/*",
"../../TestAssets/TestProjects/TestProjectWithResource/**/*",
"../../TestAssets/TestProjects/global.json"
],

View file

@ -42,7 +42,33 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
Assert.True(File.Exists(outputXml));
Assert.Contains("Gets the message from the helper", File.ReadAllText(outputXml));
}
[Fact]
public void SatelliteAssemblyIsGeneratedByDotnetBuild()
{
// create unique directories in the 'temp' folder
var root = Temp.CreateDirectory();
var testLibDir = root.CreateDirectory("TestProjectWithCultureSpecificResource");
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestProjectWithCultureSpecificResource");
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
// run compile on a project with resources
var outputDir = Path.Combine(testLibDir.Path, "bin");
var testProject = GetProjectPath(testLibDir);
var buildCmd = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
var result = buildCmd.ExecuteWithCapturedOutput();
result.Should().Pass();
var generatedSatelliteAssemblyPath = Path.Combine(
outputDir,
"Debug",
DefaultFramework,
"fr",
"TestProjectWithCultureSpecificResource.resources.dll");
Assert.True(File.Exists(generatedSatelliteAssemblyPath), $"File {generatedSatelliteAssemblyPath} was not found.");
}
[Fact]
public void LibraryWithAnalyzer()
{

View file

@ -23,6 +23,7 @@
"content": [
"../../TestAssets/TestProjects/TestLibraryWithAnalyzer/*",
"../../TestAssets/TestProjects/TestLibrary/*",
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/*",
"../../TestAssets/TestProjects/global.json"
],