internal Strings GetConfigurationsNoBlobSourceFiles()

in Sharpmake/Project.cs [716:805]


        internal Strings GetConfigurationsNoBlobSourceFiles(Strings sourceFiles)
        {
            Trace.Assert(_blobPathContents.Count == 0);

            Strings precompSource = new Strings();              // full path
            Strings noBlobbebSourceFiles = new Strings();       // partial path

            if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, sourceFiles))
                Debugger.Break();

            // Add all precomp files
            foreach (Configuration conf in Configurations)
            {
                if (!string.IsNullOrEmpty(conf.PrecompSource))
                    precompSource.Add(conf.PrecompSource);
            }

            // Go through all different BlobPath values to know partial exclusions and total exclusions
            foreach (Configuration conf in Configurations)
            {
                string blobPath = conf.BlobPath;
                BlobPathContent content = null;
                if (!_blobPathContents.TryGetValue(blobPath, out content))
                {
                    if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, conf.ResolvedSourceFilesBuildExclude, conf))
                        Debugger.Break();
                    if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, conf.ResolvedSourceFilesBlobExclude, conf))
                        Debugger.Break();
                    string workBlobHeader = conf.BlobWorkFileHeader ?? DefaultBlobWorkFileHeader;
                    string workBlobFooter = conf.BlobWorkFileFooter ?? DefaultBlobWorkFileFooter;
                    content = new BlobPathContent(conf.ResolvedSourceFilesBuildExclude, conf.ResolvedSourceFilesBlobExclude, workBlobHeader, workBlobFooter);
                    _blobPathContents.Add(blobPath, content);
                }
                else
                {
                    if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, conf.ResolvedSourceFilesBuildExclude, conf))
                        Debugger.Break();
                    if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, conf.ResolvedSourceFilesBlobExclude, conf))
                        Debugger.Break();
                    content.RegisterExclusion(conf.ResolvedSourceFilesBuildExclude, conf.ResolvedSourceFilesBlobExclude);
                }
                content.Configurations.Add(conf);
            }

            Strings excludedInAllBlobPaths = null;
            foreach (var entry in _blobPathContents)
            {
                if (excludedInAllBlobPaths == null)
                    excludedInAllBlobPaths = new Strings(entry.Value.AlwaysExclusions);
                else
                    excludedInAllBlobPaths.IntersectWith(entry.Value.AlwaysExclusions);
            }

            foreach (string sourceFile in sourceFiles)
            {
                if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Blobbing, sourceFile))
                    Debugger.Break();

                foreach (string precompSourceFile in precompSource)
                {
                    if (sourceFile.EndsWith(precompSourceFile, StringComparison.OrdinalIgnoreCase))
                        noBlobbebSourceFiles.Add(sourceFile);
                }

                if (ResolvedSourceFilesBuildExclude.Contains(sourceFile))
                    noBlobbebSourceFiles.Add(sourceFile);

                if (excludedInAllBlobPaths.Contains(sourceFile))
                    noBlobbebSourceFiles.Add(sourceFile);

                // Only unblob files that are excluded in some configs but not all
                foreach (var entry in _blobPathContents)
                {
                    if (entry.Value.PartialExclusions.Contains(sourceFile))
                        noBlobbebSourceFiles.Add(sourceFile);
                }

                foreach (string blobExcludedPath in SourcePathsBlobExclude)
                {
                    string excludedPath = Util.SimplifyPath(blobExcludedPath);
                    if (sourceFile.StartsWith(excludedPath, StringComparison.OrdinalIgnoreCase))
                    {
                        noBlobbebSourceFiles.Add(sourceFile);
                        break;
                    }
                }
            }

            return noBlobbebSourceFiles;
        }