Example #1
0
 protected internal virtual bool ComputeOutOfDateSources()
 {
     if (this.TrackerIntermediateDirectory != null)
     {
         string intermediateDirectory = this.TrackerIntermediateDirectory;
     }
     else
     {
         string str = string.Empty;
     }
     if (this.MinimalRebuildFromTracking || this.TrackFileAccess)
     {
         this.AssignDefaultTLogPaths();
     }
     if (this.MinimalRebuildFromTracking && !this.ForcedRebuildRequired())
     {
         this.sourceOutputs      = new CanonicalTrackedOutputFiles((ITask)this, this.TLogWriteFiles);
         this.sourceDependencies = new CanonicalTrackedInputFiles((ITask)this, this.TLogReadFiles, this.TrackedInputFiles, this.ExcludedInputPaths, this.sourceOutputs, this.UseMinimalRebuildOptimization, this.MaintainCompositeRootingMarkers);
         this.SourcesCompiled    = this.MergeOutOfDateSourceLists(this.SourceDependencies.ComputeSourcesNeedingCompilation(false), this.GenerateSourcesOutOfDateDueToCommandLine());
         if (this.SourcesCompiled.Length == 0)
         {
             this.SkippedExecution = true;
             return(this.SkippedExecution);
         }
         this.SourcesCompiled = this.AssignOutOfDateSources(this.SourcesCompiled);
         this.SourceDependencies.RemoveEntriesForSource(this.SourcesCompiled);
         this.SourceDependencies.SaveTlog();
         if (this.DeleteOutputOnExecute)
         {
             TrackedVCToolTask.DeleteFiles(this.sourceOutputs.OutputsForSource(this.SourcesCompiled));
         }
         this.sourceOutputs.RemoveEntriesForSource(this.SourcesCompiled);
         this.sourceOutputs.SaveTlog();
     }
     else
     {
         this.SourcesCompiled = this.TrackedInputFiles;
         if (this.SourcesCompiled == null || this.SourcesCompiled.Length == 0)
         {
             this.SkippedExecution = true;
             return(this.SkippedExecution);
         }
     }
     if (this.TrackFileAccess)
     {
         this.RootSource = FileTracker.FormatRootingMarker(this.SourcesCompiled);
     }
     this.SkippedExecution = false;
     return(this.SkippedExecution);
 }
Example #2
0
 protected virtual int PostExecuteTool(int exitCode)
 {
     if (this.MinimalRebuildFromTracking || this.TrackFileAccess)
     {
         this.SourceOutputs      = new CanonicalTrackedOutputFiles(this.TLogWriteFiles);
         this.SourceDependencies = new CanonicalTrackedInputFiles(this.TLogReadFiles, this.TrackedInputFiles, this.ExcludedInputPaths, this.SourceOutputs, false, this.MaintainCompositeRootingMarkers);
         string[] strArray = (string[])null;
         IDictionary <string, string> sourcesToCommandLines = this.MapSourcesToCommandLines();
         if (exitCode != 0)
         {
             this.SourceOutputs.RemoveEntriesForSource(this.SourcesCompiled);
             this.SourceOutputs.SaveTlog();
             this.SourceDependencies.RemoveEntriesForSource(this.SourcesCompiled);
             this.SourceDependencies.SaveTlog();
             if (this.TrackCommandLines)
             {
                 if (this.MaintainCompositeRootingMarkers)
                 {
                     sourcesToCommandLines.Remove(FileTracker.FormatRootingMarker(this.SourcesCompiled));
                 }
                 else
                 {
                     foreach (ITaskItem source in this.SourcesCompiled)
                     {
                         sourcesToCommandLines.Remove(FileTracker.FormatRootingMarker(source));
                     }
                 }
                 this.WriteSourcesToCommandLinesTable(sourcesToCommandLines);
             }
         }
         else
         {
             this.AddTaskSpecificOutputs(this.SourcesCompiled, this.SourceOutputs);
             this.RemoveTaskSpecificOutputs(this.SourceOutputs);
             this.SourceOutputs.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled);
             if (this.MaintainCompositeRootingMarkers)
             {
                 strArray = this.SourceOutputs.RemoveRootsWithSharedOutputs(this.SourcesCompiled);
                 foreach (string rootingMarker in strArray)
                 {
                     this.SourceDependencies.RemoveEntryForSourceRoot(rootingMarker);
                 }
             }
             if (this.TrackedOutputFilesToIgnore != null && this.TrackedOutputFilesToIgnore.Length != 0)
             {
                 Dictionary <string, ITaskItem> trackedOutputFilesToRemove = new Dictionary <string, ITaskItem>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase);
                 foreach (ITaskItem taskItem in this.TrackedOutputFilesToIgnore)
                 {
                     trackedOutputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem);
                 }
                 this.SourceOutputs.SaveTlog((DependencyFilter)(fullTrackedPath => !trackedOutputFilesToRemove.ContainsKey(fullTrackedPath)));
             }
             else
             {
                 this.SourceOutputs.SaveTlog();
             }
             TrackedVCToolTask.DeleteEmptyFile(this.TLogWriteFiles);
             this.RemoveTaskSpecificInputs(this.SourceDependencies);
             this.SourceDependencies.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled);
             if (this.TrackedInputFilesToIgnore != null && this.TrackedInputFilesToIgnore.Length != 0)
             {
                 Dictionary <string, ITaskItem> trackedInputFilesToRemove = new Dictionary <string, ITaskItem>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase);
                 foreach (ITaskItem taskItem in this.TrackedInputFilesToIgnore)
                 {
                     trackedInputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem);
                 }
                 this.SourceDependencies.SaveTlog((DependencyFilter)(fullTrackedPath => !trackedInputFilesToRemove.ContainsKey(fullTrackedPath)));
             }
             else
             {
                 this.SourceDependencies.SaveTlog();
             }
             TrackedVCToolTask.DeleteEmptyFile(this.TLogReadFiles);
             if (this.TrackCommandLines)
             {
                 if (this.MaintainCompositeRootingMarkers)
                 {
                     string str = this.GenerateCommandLine(VCToolTask.CommandLineFormat.ForTracking, VCToolTask.EscapeFormat.Default);
                     sourcesToCommandLines[FileTracker.FormatRootingMarker(this.SourcesCompiled)] = str;
                     if (strArray != null)
                     {
                         foreach (string key in strArray)
                         {
                             sourcesToCommandLines.Remove(key);
                         }
                     }
                 }
                 else
                 {
                     string str = this.GenerateCommandLineExceptSwitches(new string[1]
                     {
                         this.SourcesPropertyName ?? "Sources"
                     }, VCToolTask.CommandLineFormat.ForTracking, VCToolTask.EscapeFormat.Default);
                     foreach (ITaskItem source in this.SourcesCompiled)
                     {
                         sourcesToCommandLines[FileTracker.FormatRootingMarker(source)] = str + " " + source.GetMetadata("FullPath").ToUpperInvariant();
                     }
                 }
                 this.WriteSourcesToCommandLinesTable(sourcesToCommandLines);
             }
         }
     }
     return(exitCode);
 }