private void InternalConstruct(ITask ownerTask, ITaskItem[] tlogFiles, ITaskItem[] sourceFiles, ITaskItem[] outputFiles, ITaskItem[] excludedInputPaths, CanonicalTrackedOutputFiles outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers)
 {
     if (ownerTask != null)
     {
         this.Log = new TaskLoggingHelper(ownerTask);
         this.Log.TaskResources     = AssemblyResources.PrimaryResources;
         this.Log.HelpKeywordPrefix = "MSBuild.";
     }
     this.tlogFiles     = TrackedDependencies.ExpandWildcards(tlogFiles);
     this.tlogAvailable = TrackedDependencies.ItemsExist(this.tlogFiles);
     this.sourceFiles   = sourceFiles;
     this.outputs       = outputs;
     this.outputFiles   = outputFiles;
     this.useMinimalRebuildOptimization   = useMinimalRebuildOptimization;
     this.maintainCompositeRootingMarkers = maintainCompositeRootingMarkers;
     if (excludedInputPaths != null)
     {
         foreach (ITaskItem item in excludedInputPaths)
         {
             string str = FileUtilities.EnsureNoTrailingSlash(FileUtilities.NormalizePath(item.ItemSpec)).ToUpperInvariant();
             this.excludedInputPaths.Add(str);
         }
     }
     this.dependencyTable = new Dictionary <string, Dictionary <string, string> >(StringComparer.OrdinalIgnoreCase);
     if (this.tlogFiles != null)
     {
         this.ConstructDependencyTable();
     }
 }
 private void InternalConstruct(ITask ownerTask, ITaskItem[] tlogFilesLocal, ITaskItem[] tlogFilesToIgnore, bool skipMissingFiles, DateTime missingFileTimeUtc, string[] excludedInputPaths)
 {
     if (ownerTask != null)
     {
         this.Log = new TaskLoggingHelper(ownerTask);
         this.Log.TaskResources     = AssemblyResources.PrimaryResources;
         this.Log.HelpKeywordPrefix = "MSBuild.";
     }
     ITaskItem[] itemArray = TrackedDependencies.ExpandWildcards(tlogFilesLocal);
     if (tlogFilesToIgnore != null)
     {
         ITaskItem[] itemArray2 = TrackedDependencies.ExpandWildcards(tlogFilesToIgnore);
         if (itemArray2.Length > 0)
         {
             HashSet <string> set  = new HashSet <string>();
             List <ITaskItem> list = new List <ITaskItem>();
             foreach (ITaskItem item in itemArray2)
             {
                 set.Add(item.ItemSpec);
             }
             foreach (ITaskItem item2 in itemArray)
             {
                 if (!set.Contains(item2.ItemSpec))
                 {
                     list.Add(item2);
                 }
             }
             this.tlogFiles = list.ToArray();
         }
         else
         {
             this.tlogFiles = itemArray;
         }
     }
     else
     {
         this.tlogFiles = itemArray;
     }
     if ((this.tlogFiles == null) || (this.tlogFiles.Length == 0))
     {
         this.tlogMarker = tlogFilesLocal[0].ItemSpec.Replace("*", "1");
         this.tlogMarker = this.tlogMarker.Replace("?", "2");
     }
     if (excludedInputPaths != null)
     {
         foreach (string str in excludedInputPaths)
         {
             string str2 = FileUtilities.EnsureTrailingSlash(FileUtilities.NormalizePath(str)).ToUpperInvariant();
             this.excludedInputPaths.Add(str2);
         }
     }
     this.tlogsAvailable     = TrackedDependencies.ItemsExist(this.tlogFiles);
     this.skipMissingFiles   = skipMissingFiles;
     this.missingFileTimeUtc = missingFileTimeUtc.ToUniversalTime();
     if (this.tlogFiles != null)
     {
         this.ConstructFileTable();
     }
 }
Exemple #3
0
 private void InternalConstruct(ITask ownerTask, ITaskItem[] tlogFiles, bool constructOutputsFromTLogs)
 {
     if (ownerTask != null)
     {
         this.Log = new TaskLoggingHelper(ownerTask);
         this.Log.TaskResources     = AssemblyResources.PrimaryResources;
         this.Log.HelpKeywordPrefix = "MSBuild.";
     }
     this.tlogFiles       = TrackedDependencies.ExpandWildcards(tlogFiles);
     this.tlogAvailable   = TrackedDependencies.ItemsExist(this.tlogFiles);
     this.dependencyTable = new Dictionary <string, Dictionary <string, DateTime> >(StringComparer.OrdinalIgnoreCase);
     if ((this.tlogFiles != null) && constructOutputsFromTLogs)
     {
         this.ConstructOutputTable();
     }
 }
        /// <summary>
        /// Internal constructor
        /// </summary>
        /// <param name="ownerTask">The task that is using file tracker</param>
        /// <param name="tlogFiles">The .write. tlog files to interpret</param>
        /// <param name="skipMissingFiles">Ignore files that do not exist on disk</param>
        /// <param name="excludedInputPaths">The set of paths that contain files that are to be ignored during up to date check</param>
        private void InternalConstruct(ITask ownerTask, ITaskItem[] tlogFilesLocal, ITaskItem[] tlogFilesToIgnore, bool skipMissingFiles, DateTime missingFileTimeUtc, string[] excludedInputPaths)
        {
            if (ownerTask != null)
            {
                _log = new TaskLoggingHelper(ownerTask);
                _log.TaskResources     = AssemblyResources.PrimaryResources;
                _log.HelpKeywordPrefix = "MSBuild.";
            }

            ITaskItem[] expandedTlogFiles = TrackedDependencies.ExpandWildcards(tlogFilesLocal);

            if (tlogFilesToIgnore != null)
            {
                ITaskItem[] expandedTlogFilesToIgnore = TrackedDependencies.ExpandWildcards(tlogFilesToIgnore);

                if (expandedTlogFilesToIgnore.Length > 0)
                {
                    HashSet <string> ignore             = new HashSet <string>();
                    List <ITaskItem> remainingTlogFiles = new List <ITaskItem>();

                    foreach (ITaskItem tlogFileToIgnore in expandedTlogFilesToIgnore)
                    {
                        ignore.Add(tlogFileToIgnore.ItemSpec);
                    }

                    foreach (ITaskItem tlogFile in expandedTlogFiles)
                    {
                        if (!ignore.Contains(tlogFile.ItemSpec))
                        {
                            remainingTlogFiles.Add(tlogFile);
                        }
                    }

                    _tlogFiles = remainingTlogFiles.ToArray();
                }
                else
                {
                    _tlogFiles = expandedTlogFiles;
                }
            }
            else
            {
                _tlogFiles = expandedTlogFiles;
            }

            // We have no TLog files on disk, create a TLog marker from the
            // TLogFiles ItemSpec so we can fabricate one if we need to
            // This becomes our "first" tlog, since on the very first run, no tlogs
            // will exist, and if a compaction has been run (as part of the initial up-to-date check) then this
            // marker tlog will be created as empty.
            if (_tlogFiles == null || _tlogFiles.Length == 0)
            {
                _tlogMarker = tlogFilesLocal[0].ItemSpec.Replace("*", "1");
                _tlogMarker = _tlogMarker.Replace("?", "2");
            }

            if (excludedInputPaths != null)
            {
                // Assign our exclude paths to our lookup - and make sure that all recorded paths end in a slash so that
                // our "starts with" comparison doesn't pick up incomplete matches, such as C:\Foo matching C:\FooFile.txt
                foreach (string excludePath in excludedInputPaths)
                {
                    string fullexcludePath = FileUtilities.EnsureTrailingSlash(FileUtilities.NormalizePath(excludePath)).ToUpperInvariant();
                    _excludedInputPaths.Add(fullexcludePath);
                }
            }

            _tlogsAvailable     = TrackedDependencies.ItemsExist(_tlogFiles);
            _skipMissingFiles   = skipMissingFiles;
            _missingFileTimeUtc = missingFileTimeUtc.ToUniversalTime();
            if (_tlogFiles != null)
            {
                // Read the TLogs into our internal structures
                ConstructFileTable();
            }
        }