Fix the paths at which CompileContext locates resgen outputs.
Fixes #1136
This commit is contained in:
parent
98b37fdd5e
commit
1d25d2574d
15 changed files with 568 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
30
test/dotnet-build.Tests/IncrementalTestsOnResources.cs
Normal file
30
test/dotnet-build.Tests/IncrementalTestsOnResources.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,8 @@
|
|||
"../../TestAssets/TestProjects/TestLibrary/**/*",
|
||||
"../../TestAssets/TestProjects/TestSimpleIncrementalApp/*",
|
||||
"../../TestAssets/TestProjects/TestProjectToProjectDependencies/**/*",
|
||||
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/**/*",
|
||||
"../../TestAssets/TestProjects/TestProjectWithResource/**/*",
|
||||
"../../TestAssets/TestProjects/global.json"
|
||||
],
|
||||
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
"content": [
|
||||
"../../TestAssets/TestProjects/TestLibraryWithAnalyzer/*",
|
||||
"../../TestAssets/TestProjects/TestLibrary/*",
|
||||
"../../TestAssets/TestProjects/TestProjectWithCultureSpecificResource/*",
|
||||
"../../TestAssets/TestProjects/global.json"
|
||||
],
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue