Fix: builtIn defaults are not used when builtIn is not specified

This commit is contained in:
Ajay Bhargav Baaskaran 2016-05-02 14:20:48 -07:00
parent 241175dcc3
commit d6d103262d
4 changed files with 18 additions and 11 deletions

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
Some content
</root>

View file

@ -62,18 +62,8 @@ namespace Microsoft.DotNet.ProjectModel.Files
BuiltInsInclude = CreateCollection(
sourceBasePath, "include", ExtractValues(builtIns.Value<JToken>("include")), literalPath: false);
if (defaultBuiltInInclude != null && !BuiltInsInclude.Any())
{
BuiltInsInclude = defaultBuiltInInclude.ToList();
}
BuiltInsExclude = CreateCollection(
sourceBasePath, "exclude", ExtractValues(builtIns.Value<JToken>("exclude")), literalPath: false);
if (defaultBuiltInExclude != null && !BuiltInsExclude.Any())
{
BuiltInsExclude = defaultBuiltInExclude.ToList();
}
}
var mappings = token.Value<JToken>("mappings") as JObject;
@ -94,6 +84,18 @@ namespace Microsoft.DotNet.ProjectModel.Files
}
}
}
if (defaultBuiltInInclude != null &&
(BuiltInsInclude == null || !BuiltInsInclude.Any()))
{
BuiltInsInclude = defaultBuiltInInclude.ToList();
}
if (defaultBuiltInExclude != null &&
(BuiltInsExclude == null || !BuiltInsExclude.Any()))
{
BuiltInsExclude = defaultBuiltInExclude.ToList();
}
}
public string SourceBasePath { get; }

View file

@ -62,7 +62,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
'buildOptions': {
'compile': {
'includeFiles': [ 'files/file1.cs', 'files/file2.cs' ],
'exclude': 'files/*ex.cs'
'exclude': '**/*.cs'
}
}}");

View file

@ -166,6 +166,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
var objDirInfo = new DirectoryInfo(Path.Combine(root, "obj", "Debug", DefaultFramework));
objDirInfo.Should().HaveFile("EndToEndTestApp.resource1.resources");
objDirInfo.Should().HaveFile("myresource.resources");
objDirInfo.Should().HaveFile("EndToEndTestApp.defaultresource.resources");
}
[Fact]