Merge pull request #3857 from dotnet/ajbaaska/fix-dup-mappings

Fixed few bugs in include patterns and mappings
This commit is contained in:
Eric Erhardt 2016-07-14 15:18:37 -05:00 committed by GitHub
commit dd5ae66215
6 changed files with 8 additions and 4 deletions

View file

@ -20,11 +20,12 @@
"files": {
"includeFiles": "packfiles/pack1.txt",
"mappings": {
"newpath/": "packfiles/pack2.txt"
"newpath/": "packfiles/pack2.txt",
"anotherpath/": "packfiles/pack2.txt"
}
}
},
"publishOptions": "testpublishfile.txt",
"publishOptions": [ "testpublishfile.txt", "publishfiles" ],
"frameworks": {
"netcoreapp1.0": {}
},

View file

@ -40,7 +40,8 @@ namespace Microsoft.DotNet.ProjectModel.Files
var token = rawObject.Value<JToken>(option);
if (token.Type != JTokenType.Object)
{
IncludePatterns = new List<string>(ExtractValues(token));
IncludePatterns = CreateCollection(
sourceBasePath, option, ExtractValues(token), literalPath: false);
}
else
{

View file

@ -150,7 +150,7 @@ namespace Microsoft.DotNet.ProjectModel.Files
file.IsCustomTarget = true;
// Prefer named targets over default ones
includeEntries.RemoveWhere(f => string.Equals(f.SourcePath, file.SourcePath));
includeEntries.RemoveWhere(f => string.Equals(f.SourcePath, file.SourcePath) && !f.IsCustomTarget);
includeEntries.Add(file);
}
}

View file

@ -113,6 +113,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read);
zip.Entries.Should().Contain(e => e.FullName == "packfiles/pack1.txt");
zip.Entries.Should().Contain(e => e.FullName == "newpath/pack2.txt");
zip.Entries.Should().Contain(e => e.FullName == "anotherpath/pack2.txt");
}
[Fact]

View file

@ -128,6 +128,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
publishCommand.Execute().Should().Pass();
publishCommand.GetOutputDirectory().Should().HaveFile("testpublishfile.txt");
publishCommand.GetOutputDirectory().Should().HaveFile("publishfiles/anotherpublishfile.txt");
}
[Fact]