internal ProjectFilesCollection(JsonObject rawProject, string projectDirectory, string projectFilePath, ICollection <DiagnosticMessage> warnings = null) { _projectDirectory = projectDirectory; _projectFilePath = projectFilePath; var excludeBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "excludeBuiltIn", DefaultBuiltInExcludePatterns); var excludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "exclude") .Concat(excludeBuiltIns); var contentBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "contentBuiltIn", DefaultContentsBuiltInPatterns); var compileBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "compileBuiltIn", DefaultCompileBuiltInPatterns); var resourceBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "resourceBuiltIn", DefaultResourcesBuiltInPatterns); // TODO: The legacy names will be retired in the future. var legacyPublishExcludePatternName = "bundleExclude"; var legacyPublishExcludePatternToken = rawProject.ValueAsJsonObject(legacyPublishExcludePatternName); if (legacyPublishExcludePatternToken != null) { _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, legacyPublishExcludePatternName, DefaultPublishExcludePatterns); if (warnings != null) { warnings.Add(new DiagnosticMessage( string.Format("Property \"{0}\" is deprecated. It is replaced by \"{1}\".", legacyPublishExcludePatternName, "publishExclude"), projectFilePath, DiagnosticMessageSeverity.Warning, legacyPublishExcludePatternToken.Line, legacyPublishExcludePatternToken.Column)); } } else { _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "publishExclude", DefaultPublishExcludePatterns); } _sharedPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "shared", legacyName: null, warnings: warnings, fallbackIncluding: DefaultSharedPatterns, additionalExcluding: excludePatterns); _resourcePatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "resource", "resources", warnings: warnings, additionalIncluding: resourceBuiltIns, additionalExcluding: excludePatterns); _preprocessPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "preprocess", legacyName: null, warnings: warnings, fallbackIncluding: DefaultPreprocessPatterns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _compilePatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "compile", "code", warnings: warnings, additionalIncluding: compileBuiltIns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _contentPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "content", "files", warnings: warnings, additionalIncluding: contentBuiltIns, additionalExcluding: excludePatterns.Concat(_publishExcludePatterns)) .ExcludeGroup(_compilePatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _namedResources = NamedResourceReader.ReadNamedResources(rawProject, projectFilePath); }
internal ProjectFilesCollection(JsonObject rawProject, string projectDirectory, string projectFilePath, ICollection<DiagnosticMessage> warnings = null) { _projectDirectory = projectDirectory; _projectFilePath = projectFilePath; var excludeBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "excludeBuiltIn", DefaultBuiltInExcludePatterns); var excludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "exclude") .Concat(excludeBuiltIns); var contentBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "contentBuiltIn", DefaultContentsBuiltInPatterns); var compileBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "compileBuiltIn", DefaultCompileBuiltInPatterns); var resourceBuiltIns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "resourceBuiltIn", DefaultResourcesBuiltInPatterns); // TODO: The legacy names will be retired in the future. var legacyPublishExcludePatternName = "bundleExclude"; var legacyPublishExcludePatternToken = rawProject.ValueAsJsonObject(legacyPublishExcludePatternName); if (legacyPublishExcludePatternToken != null) { _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, legacyPublishExcludePatternName, DefaultPublishExcludePatterns); if (warnings != null) { warnings.Add(new DiagnosticMessage( string.Format("Property \"{0}\" is deprecated. It is replaced by \"{1}\".", legacyPublishExcludePatternName, "publishExclude"), projectFilePath, DiagnosticMessageSeverity.Warning, legacyPublishExcludePatternToken.Line, legacyPublishExcludePatternToken.Column)); } } else { _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(rawProject, projectDirectory, projectFilePath, "publishExclude", DefaultPublishExcludePatterns); } _sharedPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "shared", legacyName: null, warnings: warnings, fallbackIncluding: DefaultSharedPatterns, additionalExcluding: excludePatterns); _resourcePatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "resource", "resources", warnings: warnings, additionalIncluding: resourceBuiltIns, additionalExcluding: excludePatterns); _preprocessPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "preprocess", legacyName: null, warnings: warnings, fallbackIncluding: DefaultPreprocessPatterns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _compilePatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "compile", "code", warnings: warnings, additionalIncluding: compileBuiltIns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _contentPatternsGroup = PatternGroup.Build(rawProject, projectDirectory, projectFilePath, "content", "files", warnings: warnings, additionalIncluding: contentBuiltIns, additionalExcluding: excludePatterns.Concat(_publishExcludePatterns)) .ExcludeGroup(_compilePatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _namedResources = NamedResourceReader.ReadNamedResources(rawProject, projectFilePath); }
internal void EnsureInitialized() { if (_initialized) { return; } var excludeBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "excludeBuiltIn", DefaultBuiltInExcludePatterns); var excludePatterns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "exclude") .Concat(excludeBuiltIns); var contentBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "contentBuiltIn", DefaultContentsBuiltInPatterns); var compileBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "compileBuiltIn", DefaultCompileBuiltInPatterns); var resourceBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "resourceBuiltIn", DefaultResourcesBuiltInPatterns); _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "publishExclude", DefaultPublishExcludePatterns); _sharedPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "shared", fallbackIncluding: DefaultSharedPatterns, additionalExcluding: excludePatterns); _resourcePatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "resource", additionalIncluding: resourceBuiltIns, additionalExcluding: excludePatterns); _preprocessPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "preprocess", fallbackIncluding: DefaultPreprocessPatterns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _compilePatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "compile", additionalIncluding: compileBuiltIns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _contentPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "content", additionalIncluding: contentBuiltIns, additionalExcluding: excludePatterns.Concat(_publishExcludePatterns)) .ExcludeGroup(_compilePatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _namedResources = NamedResourceReader.ReadNamedResources(_rawProject, _projectFilePath); // Files to be packed along with the project var packIncludeJson = _rawProject.ValueAsJsonObject(PackIncludePropertyName); if (packIncludeJson != null) { _packInclude = packIncludeJson .Keys .Select(k => new PackIncludeEntry(k, packIncludeJson.Value(k))) .ToList(); } else { _packInclude = new List <PackIncludeEntry>(); } _initialized = true; _rawProject = null; }
internal void EnsureInitialized() { if (_initialized) { return; } var excludeBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "excludeBuiltIn", DefaultBuiltInExcludePatterns); var excludePatterns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "exclude") .Concat(excludeBuiltIns); var contentBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "contentBuiltIn", DefaultContentsBuiltInPatterns); var compileBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "compileBuiltIn", DefaultCompileBuiltInPatterns); var resourceBuiltIns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "resourceBuiltIn", DefaultResourcesBuiltInPatterns); _publishExcludePatterns = PatternsCollectionHelper.GetPatternsCollection(_rawProject, _projectDirectory, _projectFilePath, "publishExclude", DefaultPublishExcludePatterns); _sharedPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "shared", fallbackIncluding: DefaultSharedPatterns, additionalExcluding: excludePatterns); _resourcePatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "resource", additionalIncluding: resourceBuiltIns, additionalExcluding: excludePatterns); _preprocessPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "preprocess", fallbackIncluding: DefaultPreprocessPatterns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _compilePatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "compile", additionalIncluding: compileBuiltIns, additionalExcluding: excludePatterns) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _contentPatternsGroup = PatternGroup.Build(_rawProject, _projectDirectory, _projectFilePath, "content", additionalIncluding: contentBuiltIns, additionalExcluding: excludePatterns.Concat(_publishExcludePatterns)) .ExcludeGroup(_compilePatternsGroup) .ExcludeGroup(_preprocessPatternsGroup) .ExcludeGroup(_sharedPatternsGroup) .ExcludeGroup(_resourcePatternsGroup); _namedResources = NamedResourceReader.ReadNamedResources(_rawProject, _projectFilePath); // Files to be packed along with the project var packIncludeJson = _rawProject.ValueAsJsonObject(PackIncludePropertyName); if (packIncludeJson != null) { _packInclude = packIncludeJson .Keys .Select(k => new PackIncludeEntry(k, packIncludeJson.Value(k))) .ToList(); } else { _packInclude = new List<PackIncludeEntry>(); } _initialized = true; _rawProject = null; }
public IEnumerable <string> GetFilesForBundling(bool includeSource, IEnumerable <string> additionalExcludePatterns) { var patternGroup = new PatternGroup(ContentPatternsGroup.IncludePatterns, ContentPatternsGroup.ExcludePatterns.Concat(additionalExcludePatterns), ContentPatternsGroup.IncludeLiterals); if (!includeSource) { foreach (var excludedGroup in ContentPatternsGroup.ExcludePatternsGroup) { patternGroup.ExcludeGroup(excludedGroup); } } return(patternGroup.SearchFiles(_projectDirectory)); }
public PatternGroup ExcludeGroup(PatternGroup group) { _excludeGroups.Add(group); return(this); }
public PatternGroup ExcludeGroup(PatternGroup group) { _excludeGroups.Add(group); return this; }
public IEnumerable<string> GetFilesForBundling(bool includeSource, IEnumerable<string> additionalExcludePatterns) { var patternGroup = new PatternGroup(ContentPatternsGroup.IncludePatterns, ContentPatternsGroup.ExcludePatterns.Concat(additionalExcludePatterns), ContentPatternsGroup.IncludeLiterals); if (!includeSource) { foreach (var excludedGroup in ContentPatternsGroup.ExcludePatternsGroup) { patternGroup.ExcludeGroup(excludedGroup); } } return patternGroup.SearchFiles(_projectDirectory); }