protected internal virtual bool ComputeOutOfDateSources() { if (MinimalRebuildFromTracking || TrackFileAccess) { AssignDefaultTLogPaths(); } if (MinimalRebuildFromTracking && !ForcedRebuildRequired()) { var outputs = new CanonicalTrackedOutputFiles(this, TLogWriteFiles); SourceDependencies = new CanonicalTrackedInputFiles( this, TLogReadFiles, TrackedInputFiles, ExcludedInputPaths, outputs, UseMinimalRebuildOptimization, MaintainCompositeRootingMarkers); ITaskItem[] sourcesOutOfDateThroughTracking = SourceDependencies.ComputeSourcesNeedingCompilation(false); List <ITaskItem> sourcesWithChangedOptions = GenerateSourcesOutOfDateDueToOptions(); SourcesCompiled = MergeOutOfDateSourceLists( sourcesOutOfDateThroughTracking, sourcesWithChangedOptions); if (SourcesCompiled.Length == 0) { SkippedExecution = true; return(SkippedExecution); } SourcesCompiled = AssignOutOfDateSources(SourcesCompiled); SourceDependencies.RemoveEntriesForSource(SourcesCompiled); SourceDependencies.SaveTlog(); outputs.RemoveEntriesForSource(SourcesCompiled); outputs.SaveTlog(); } else { SourcesCompiled = TrackedInputFiles; if (SourcesCompiled == null || SourcesCompiled.Length == 0) { SkippedExecution = true; return(SkippedExecution); } } if (TrackFileAccess) { RootSource = FileTracker.FormatRootingMarker(SourcesCompiled); } SkippedExecution = false; return(SkippedExecution); }
protected override bool ComputeOutOfDateSources() { // Same as base class, other than the things commented out. // We're not using CustomTrackedVCToolTask's File Tracker, we're using our own. Hence these changes. if (this.TrackerIntermediateDirectory != null) { string trackerIntermediateDirectory = this.TrackerIntermediateDirectory; } if (this.MinimalRebuildFromTracking || this.TrackFileAccess) { this.AssignDefaultTLogPaths(); } if (this.MinimalRebuildFromTracking && !this.ForcedRebuildRequired()) { CanonicalTrackedOutputFiles outputs = new CanonicalTrackedOutputFiles(this, this.TLogWriteFiles); this.SourceDependencies = new CanonicalTrackedInputFiles(this, this.TLogReadFiles, this.Sources /*TrackedInputFiles*/, this.ExcludedInputPaths, outputs, /*this.UseMinimalRebuildOptimization*/ true, /*this.MaintainCompositeRootingMarkers*/ false); ITaskItem[] sourcesOutOfDateThroughTracking = this.SourceDependencies.ComputeSourcesNeedingCompilation(/*false*/); List <ITaskItem> sourcesWithChangedCommandLines = this.GenerateSourcesOutOfDateDueToCommandLine(); this.SourcesCompiled = this.MergeOutOfDateSourceLists(sourcesOutOfDateThroughTracking, sourcesWithChangedCommandLines); 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(); outputs.RemoveEntriesForSource(this.SourcesCompiled); outputs.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); }
// private void BeginUnicodeOutput() // { // this.unicodePipeReadHandle = null; // this.unicodePipeWriteHandle = null; // this.unicodeOutputEnded = null; // if (this.UseUnicodeOutput) // { // NativeMethodsShared.SecurityAttributes lpPipeAttributes = new NativeMethodsShared.SecurityAttributes { // lpSecurityDescriptor = NativeMethodsShared.NullIntPtr, // bInheritHandle = true // }; // if (NativeMethodsShared.CreatePipe(out this.unicodePipeReadHandle, out this.unicodePipeWriteHandle, lpPipeAttributes, 0)) // { // List<string> list = new List<string>(); // if (base.EnvironmentVariables != null) // { // list.AddRange(base.EnvironmentVariables); // } // list.Add("VS_UNICODE_OUTPUT=" + this.unicodePipeWriteHandle.DangerousGetHandle()); // base.EnvironmentVariables = list.ToArray(); // this.unicodeOutputEnded = new AutoResetEvent(false); // ThreadPool.QueueUserWorkItem(new WaitCallback(this.ReadUnicodeOutput)); // } // else // { // base.Log.LogWarningWithCodeFromResources("TrackedVCToolTask.CreateUnicodeOutputPipeFailed", new object[] { this.ToolName }); // } // } // } protected /*internal*/ virtual bool ComputeOutOfDateSources() { if (this.TrackerIntermediateDirectory != null) { string trackerIntermediateDirectory = this.TrackerIntermediateDirectory; } if (this.MinimalRebuildFromTracking || this.TrackFileAccess) { this.AssignDefaultTLogPaths(); } if (this.MinimalRebuildFromTracking && !this.ForcedRebuildRequired()) { CanonicalTrackedOutputFiles outputs = new CanonicalTrackedOutputFiles(this, this.TLogWriteFiles); this.sourceDependencies = new CanonicalTrackedInputFiles(this, this.TLogReadFiles, this.TrackedInputFiles, this.ExcludedInputPaths, outputs, this.UseMinimalRebuildOptimization, this.MaintainCompositeRootingMarkers); ITaskItem[] sourcesOutOfDateThroughTracking = this.SourceDependencies.ComputeSourcesNeedingCompilation(false); List <ITaskItem> sourcesWithChangedCommandLines = this.GenerateSourcesOutOfDateDueToCommandLine(); this.SourcesCompiled = this.MergeOutOfDateSourceLists(sourcesOutOfDateThroughTracking, sourcesWithChangedCommandLines); 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(); outputs.RemoveEntriesForSource(this.SourcesCompiled); outputs.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); }
protected override CanonicalTrackedOutputFiles OutputWriteTLog(ITaskItem[] compiledSources) { string path = Path.Combine(TlogDirectory, WriteTLogFilename); TaskItem item = new TaskItem(path); CanonicalTrackedOutputFiles trackedFiles = new CanonicalTrackedOutputFiles(new TaskItem[] { item }); foreach (ITaskItem sourceItem in compiledSources) { //remove this entry associated with compiled source which is about to be recomputed trackedFiles.RemoveEntriesForSource(sourceItem); //add entry with updated information trackedFiles.AddComputedOutputForSourceRoot(Path.GetFullPath(sourceItem.ItemSpec).ToUpperInvariant(), Path.GetFullPath(GetObjectFile(sourceItem)).ToUpperInvariant()); } //output tlog trackedFiles.SaveTlog(); return(trackedFiles); }
private CanonicalTrackedOutputFiles ConstructWriteTLog(ITaskItem[] upToDateSources) { // Remove any files we're about to compile from the log TaskItem item = new TaskItem(Path.Combine(TrackerIntermediateDirectory, WriteTLogNames[0])); CanonicalTrackedOutputFiles files = new CanonicalTrackedOutputFiles(new TaskItem[] { item }); files.RemoveEntriesForSource(Sources); // Add in the files we're compiling right now. Essentially just updating their output object filenames. foreach (ITaskItem sourceItem in upToDateSources) { string sourcePath = Path.GetFullPath(sourceItem.ItemSpec).ToUpperInvariant(); string objectFile = Path.GetFullPath(sourceItem.GetMetadata("ObjectFileName")).ToUpperInvariant(); files.AddComputedOutputForSourceRoot(sourcePath, objectFile); } // Save it out files.SaveTlog(); // Pass onto the ReadTLog saving return(files); }
protected void CalcSourcesToBuild() { //check if full recompile is required otherwise perform incremental if (ForcedRebuildRequired() || MinimalRebuildFromTracking == false) { CompileSourceList = Sources; return; } //retrieve list of sources out of date due to command line changes List <ITaskItem> outOfDateSourcesFromCommandLine = GetOutOfDateSourcesFromCmdLineChanges(); //retrieve sources out of date due to tracking CanonicalTrackedOutputFiles outputs = new CanonicalTrackedOutputFiles(this, TLogWriteFiles); TrackedInputFiles = new CanonicalTrackedInputFiles(this, TLogReadFiles, Sources, ExcludedInputPaths, outputs, true, false); ITaskItem[] outOfDateSourcesFromTracking = TrackedInputFiles.ComputeSourcesNeedingCompilation(); //merge out of date lists CompileSourceList = MergeOutOfDateSources(outOfDateSourcesFromTracking, outOfDateSourcesFromCommandLine); if (CompileSourceList.Length == 0) { SkippedExecution = true; return; } //remove sources to compile from tracked file list TrackedInputFiles.RemoveEntriesForSource(CompileSourceList); outputs.RemoveEntriesForSource(CompileSourceList); TrackedInputFiles.SaveTlog(); outputs.SaveTlog(); }
private void FinishExecute(bool success) { if (!MinimalRebuildFromTracking && !TrackFileAccess) { return; } var outputs = new CanonicalTrackedOutputFiles(TLogWriteFiles); var compactInputs = new CanonicalTrackedInputFiles( TLogReadFiles, TrackedInputFiles, ExcludedInputPaths, outputs, false, MaintainCompositeRootingMarkers); IDictionary <string, string> sourcesToOptions = MapSourcesToOptions(); if (!success) { outputs.RemoveEntriesForSource(SourcesCompiled); outputs.SaveTlog(); compactInputs.RemoveEntriesForSource(SourcesCompiled); compactInputs.SaveTlog(); if (MaintainCompositeRootingMarkers) { sourcesToOptions.Remove( FileTracker.FormatRootingMarker(SourcesCompiled)); } else { foreach (ITaskItem item in SourcesCompiled) { sourcesToOptions.Remove( FileTracker.FormatRootingMarker(item)); } } WriteSourcesToOptionsTable(sourcesToOptions); } else { AddTaskSpecificOutputs(SourcesCompiled, outputs); RemoveTaskSpecificOutputs(outputs); outputs.RemoveDependenciesFromEntryIfMissing(SourcesCompiled); string[] roots = null; if (MaintainCompositeRootingMarkers) { roots = outputs.RemoveRootsWithSharedOutputs(SourcesCompiled); foreach (string marker in roots) { compactInputs.RemoveEntryForSourceRoot(marker); } } if (TrackedOutputFilesToIgnore != null && (TrackedOutputFilesToIgnore.Length > 0)) { var trackedOutputFilesToRemove = new Dictionary <string, ITaskItem>( StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item in TrackedOutputFilesToIgnore) { trackedOutputFilesToRemove.Add(item.GetMetadata("FullPath"), item); } outputs.SaveTlog( fullTrackedPath => !trackedOutputFilesToRemove.ContainsKey(fullTrackedPath)); } else { outputs.SaveTlog(); } FileUtilities.DeleteEmptyFile(TLogWriteFiles); RemoveTaskSpecificInputs(compactInputs); compactInputs.RemoveDependenciesFromEntryIfMissing(SourcesCompiled); if (TrackedInputFilesToIgnore != null && TrackedInputFilesToIgnore.Length > 0) { var trackedInputFilesToRemove = new Dictionary <string, ITaskItem>( StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item in TrackedInputFilesToIgnore) { trackedInputFilesToRemove.Add(item.GetMetadata("FullPath"), item); } compactInputs.SaveTlog( fullTrackedPath => !trackedInputFilesToRemove.ContainsKey(fullTrackedPath)); } else { compactInputs.SaveTlog(); } FileUtilities.DeleteEmptyFile(TLogReadFiles); if (MaintainCompositeRootingMarkers) { sourcesToOptions[FileTracker.FormatRootingMarker(SourcesCompiled)] = GenerateOptions(OptionFormat.ForTracking); if (roots != null) { foreach (string root in roots) { sourcesToOptions.Remove(root); } } } else { string options = GenerateOptionsExceptSources(OptionFormat.ForTracking); foreach (ITaskItem item in SourcesCompiled) { sourcesToOptions[FileTracker.FormatRootingMarker(item)] = options + " " + item.GetMetadata("FullPath").ToUpperInvariant(); } } WriteSourcesToOptionsTable(sourcesToOptions); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected virtual int PostExecuteTool(int exitCode, string responseFileCommands, string commandLineCommands) { TrackedOutputFiles = new CanonicalTrackedOutputFiles(this, TLogWriteFiles); TrackedInputFiles = new CanonicalTrackedInputFiles(this, TLogReadFiles, OutOfDateInputFiles, ExcludedInputPaths, TrackedOutputFiles, true, false); switch (exitCode) { case 0: { // // Successful build. Begin by collating known output files. (We have a manual workaround for instances where TrackedOutputFiles can't find rooted output.) // OutputFiles = TrackedOutputFiles.OutputsForSource(OutOfDateInputFiles); /*if (OutputFiles?.Length == 0) * { * var fileWrites = TrackerUtilities.ParseTrackerLogForCommandMapping(TrackedDependencies.ExpandWildcards(TLogWriteFiles)); * * var writtenFiles = new HashSet<ITaskItem>(); * * foreach (var keypair in fileWrites) * { * writtenFiles.UnionWith(keypair.Value); * } * * OutputFiles = writtenFiles.ToArray(); * }*/ if (OutputFiles != null) { foreach (var outfile in OutputFiles) { outfile.ItemSpec = PathUtils.GetExactPathName(outfile.ItemSpec.ToLowerInvariant()); } } // // Remove any instances where "input files" (sources which existed before this build) are shown as read/touched/written. // TrackedOutputFiles.RemoveDependenciesFromEntryIfMissing(OutOfDateInputFiles); TrackedInputFiles.RemoveDependenciesFromEntryIfMissing(OutOfDateInputFiles); // // Crunch the logs. This will erradicate un-rooted tracking data. // TrackedOutputFiles.SaveTlog(); TrackedInputFiles.SaveTlog(); break; } default: { // // Task failed. Remove any potentially processed file outputs to refresh clean state. // TrackedOutputFiles.RemoveEntriesForSource(OutOfDateInputFiles); TrackedInputFiles.RemoveEntriesForSource(OutOfDateInputFiles); TrackedOutputFiles.SaveTlog(); TrackedInputFiles.SaveTlog(); break; } } if (TLogCommandFiles != null) { OutputCommandTLog(TLogCommandFiles[0], responseFileCommands, commandLineCommands); } return(exitCode); }
protected virtual int PostExecuteTool(int exitCode) { if (!MinimalRebuildFromTracking && !TrackFileAccess) { return(exitCode); } SourceOutputs = new CanonicalTrackedOutputFiles(TLogWriteFiles); SourceDependencies = new CanonicalTrackedInputFiles( TLogReadFiles, TrackedInputFiles, ExcludedInputPaths, SourceOutputs, false, MaintainCompositeRootingMarkers); IDictionary <string, string> sourcesToCommandLines = MapSourcesToCommandLines(); if (exitCode != 0) { SourceOutputs.RemoveEntriesForSource(SourcesCompiled); SourceOutputs.SaveTlog(); SourceDependencies.RemoveEntriesForSource(SourcesCompiled); SourceDependencies.SaveTlog(); if (TrackCommandLines) { if (MaintainCompositeRootingMarkers) { sourcesToCommandLines.Remove( FileTracker.FormatRootingMarker(SourcesCompiled)); } else { foreach (ITaskItem item in SourcesCompiled) { sourcesToCommandLines.Remove( FileTracker.FormatRootingMarker(item)); } } WriteSourcesToCommandLinesTable(sourcesToCommandLines); } } else { AddTaskSpecificOutputs(SourcesCompiled, SourceOutputs); RemoveTaskSpecificOutputs(SourceOutputs); SourceOutputs.RemoveDependenciesFromEntryIfMissing(SourcesCompiled); string[] roots = null; if (MaintainCompositeRootingMarkers) { roots = SourceOutputs.RemoveRootsWithSharedOutputs(SourcesCompiled); foreach (string marker in roots) { SourceDependencies.RemoveEntryForSourceRoot(marker); } } if (TrackedOutputFilesToIgnore != null && (TrackedOutputFilesToIgnore.Length > 0)) { var trackedOutputFilesToRemove = new Dictionary <string, ITaskItem>( StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item in TrackedOutputFilesToIgnore) { trackedOutputFilesToRemove.Add(item.GetMetadata("FullPath"), item); } SourceOutputs.SaveTlog( fullTrackedPath => !trackedOutputFilesToRemove.ContainsKey(fullTrackedPath)); } else { SourceOutputs.SaveTlog(); } FileUtilities.DeleteEmptyFile(TLogWriteFiles); RemoveTaskSpecificInputs(SourceDependencies); SourceDependencies.RemoveDependenciesFromEntryIfMissing(SourcesCompiled); if (TrackedInputFilesToIgnore != null && TrackedInputFilesToIgnore.Length > 0) { var trackedInputFilesToRemove = new Dictionary <string, ITaskItem>( StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item in TrackedInputFilesToIgnore) { trackedInputFilesToRemove.Add(item.GetMetadata("FullPath"), item); } SourceDependencies.SaveTlog( fullTrackedPath => !trackedInputFilesToRemove.ContainsKey(fullTrackedPath)); } else { SourceDependencies.SaveTlog(); } FileUtilities.DeleteEmptyFile(TLogReadFiles); if (MaintainCompositeRootingMarkers) { sourcesToCommandLines[FileTracker.FormatRootingMarker(SourcesCompiled)] = GenerateCommandLine(CommandLineFormat.ForTracking); if (roots != null) { foreach (string root in roots) { sourcesToCommandLines.Remove(root); } } } else { string cmdLine = GenerateCommandLineExceptSources( CommandLineFormat.ForTracking); foreach (ITaskItem item in SourcesCompiled) { sourcesToCommandLines[FileTracker.FormatRootingMarker(item)] = cmdLine + " " + item.GetMetadata("FullPath").ToUpperInvariant(); } } WriteSourcesToCommandLinesTable(sourcesToCommandLines); } return(exitCode); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override bool SkipTaskExecution() { // // Check there are actually sources to build, otherwise we can skip execution. // bool shouldSkipTaskExecution = base.SkipTaskExecution(); if (MinimalRebuildFromTracking && !ForcedRebuildRequired()) { TrackedOutputFiles = new CanonicalTrackedOutputFiles(this, TLogWriteFiles); TrackedInputFiles = new CanonicalTrackedInputFiles(this, TLogReadFiles, InputFiles, ExcludedInputPaths, TrackedOutputFiles, true, false); var outOfDateSourcesFromTracking = TrackedInputFiles.ComputeSourcesNeedingCompilation(true); var outOfDateSourcesFromCommandLine = GetOutOfDateSourcesFromCmdLineChanges(GenerateUnionFileCommands(), InputFiles); #if DEBUG Log.LogMessageFromText($"[{GetType().Name}] Out of date sources (from tracking): {outOfDateSourcesFromTracking.Length}", MessageImportance.Low); Log.LogMessageFromText($"[{GetType().Name}] Out of date sources (command line differs): {outOfDateSourcesFromCommandLine.Length}", MessageImportance.Low); #endif // // Merge out-of-date lists from both sources and assign these for compilation. // var mergedOutOfDateSources = new HashSet <ITaskItem>(outOfDateSourcesFromTracking); mergedOutOfDateSources.UnionWith(outOfDateSourcesFromCommandLine); OutOfDateInputFiles = mergedOutOfDateSources.ToArray(); SkippedExecution = OutOfDateInputFiles == null || OutOfDateInputFiles.Length == 0; if (SkippedExecution) { return(SkippedExecution); } // // Remove out-of-date files from tracked file list. Thus they are missing and need re-processing. // TrackedInputFiles.RemoveEntriesForSource(OutOfDateInputFiles); TrackedInputFiles.SaveTlog(); TrackedOutputFiles.RemoveEntriesForSource(OutOfDateInputFiles); TrackedOutputFiles.SaveTlog(); SkippedExecution = false; return(SkippedExecution); } // // Consider nothing out of date. Process everything. // OutOfDateInputFiles = InputFiles; SkippedExecution = false; return(SkippedExecution); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override bool Setup() { bool result = base.Setup(); OutOfDateSources = Sources; if (result && !SkippedExecution) { // // Retrieve list of sources considered out-of-date due to either command line changes or tracker flagging. // TODO: Switch use of CanonicalTracked* helpers to TrackedFileManager. // CanonicalTrackedOutputFiles trackedOutputFiles = new CanonicalTrackedOutputFiles(this, TLogWriteFiles); TrackedInputFiles = new CanonicalTrackedInputFiles(this, TLogReadFiles, Sources, ExcludedInputPaths, trackedOutputFiles, true, false); //true); ITaskItem [] outOfDateSourcesFromTracking = TrackedInputFiles.ComputeSourcesNeedingCompilation(); // (true); ITaskItem [] outOfDateSourcesFromCommandLine = GetOutOfDateSourcesFromCmdLineChanges(Sources); #if DEBUG Log.LogMessageFromText(string.Format("[{0}] --> No. out-of-date sources (from tracking): {1}", ToolName, outOfDateSourcesFromTracking.Length), MessageImportance.Low); Log.LogMessageFromText(string.Format("[{0}] --> No. out-of-date sources (command line differs): {1}", ToolName, outOfDateSourcesFromCommandLine.Length), MessageImportance.Low); #endif // // Merge out-of-date lists from both sources and assign these for compilation. // HashSet <ITaskItem> mergedOutOfDateSources = new HashSet <ITaskItem> (outOfDateSourcesFromTracking); foreach (ITaskItem item in outOfDateSourcesFromCommandLine) { if (!mergedOutOfDateSources.Contains(item)) { mergedOutOfDateSources.Add(item); } } OutOfDateSources = new ITaskItem [mergedOutOfDateSources.Count]; mergedOutOfDateSources.CopyTo(OutOfDateSources); if ((OutOfDateSources == null) || (OutOfDateSources.Length == 0)) { SkippedExecution = true; } else { // // Remove sources to compile from tracked file list. // TrackedInputFiles.RemoveEntriesForSource(OutOfDateSources); trackedOutputFiles.RemoveEntriesForSource(OutOfDateSources); TrackedInputFiles.SaveTlog(); trackedOutputFiles.SaveTlog(); } } #if DEBUG Log.LogMessageFromText(string.Format("[{0}] --> Skipped execution: {1}", ToolName, SkippedExecution), MessageImportance.Low); for (int i = 0; i < OutOfDateSources.Length; ++i) { Log.LogMessageFromText(string.Format("[{0}] --> Out-of-date Sources: [{1}] {2}", ToolName, i, OutOfDateSources [i].ToString()), MessageImportance.Low); } #endif return(result); }
protected int ExecuteTool2(string pathToTool, string responseFileCommands, string commandLineCommands) { int num = 0; try { num = this.TrackerExecuteTool(pathToTool, responseFileCommands, commandLineCommands); } finally { if (this.MinimalRebuildFromTracking || this.TrackFileAccess) { CanonicalTrackedOutputFiles outputs = new CanonicalTrackedOutputFiles(this.TLogWriteFiles); CanonicalTrackedInputFiles compactInputs = new CanonicalTrackedInputFiles(this.TLogReadFiles, this.TrackedInputFiles, this.ExcludedInputPaths, outputs, false, this.MaintainCompositeRootingMarkers); string[] strArray = null; IDictionary <string, string> sourcesToCommandLines = this.MapSourcesToCommandLines(); if (num != 0) { outputs.RemoveEntriesForSource(this.SourcesCompiled); outputs.SaveTlog(); compactInputs.RemoveEntriesForSource(this.SourcesCompiled); compactInputs.SaveTlog(); if (this.MaintainCompositeRootingMarkers) { sourcesToCommandLines.Remove(FileTracker.FormatRootingMarker(this.SourcesCompiled)); } else { foreach (ITaskItem item in this.SourcesCompiled) { sourcesToCommandLines.Remove(FileTracker.FormatRootingMarker(item)); } } this.WriteSourcesToCommandLinesTable(sourcesToCommandLines); } else { this.AddTaskSpecificOutputs(this.SourcesCompiled, outputs); this.RemoveTaskSpecificOutputs(outputs); outputs.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled); if (this.MaintainCompositeRootingMarkers) { strArray = outputs.RemoveRootsWithSharedOutputs(this.SourcesCompiled); foreach (string str in strArray) { compactInputs.RemoveEntryForSourceRoot(str); } } if ((this.TrackedOutputFilesToIgnore != null) && (this.TrackedOutputFilesToIgnore.Length > 0)) { Dictionary <string, ITaskItem> trackedOutputFilesToRemove = new Dictionary <string, ITaskItem>(StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item2 in this.TrackedOutputFilesToIgnore) { trackedOutputFilesToRemove.Add(item2.GetMetadata("FullPath"), item2); } outputs.SaveTlog(delegate(string fullTrackedPath) { if (trackedOutputFilesToRemove.ContainsKey(fullTrackedPath)) { return(false); } return(true); }); } else { outputs.SaveTlog(); } this.RemoveTaskSpecificInputs(compactInputs); compactInputs.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled); if ((this.TrackedInputFilesToIgnore != null) && (this.TrackedInputFilesToIgnore.Length > 0)) { Dictionary <string, ITaskItem> trackedInputFilesToRemove = new Dictionary <string, ITaskItem>(StringComparer.OrdinalIgnoreCase); foreach (ITaskItem item3 in this.TrackedInputFilesToIgnore) { trackedInputFilesToRemove.Add(item3.GetMetadata("FullPath"), item3); } compactInputs.SaveTlog(delegate(string fullTrackedPath) { if (trackedInputFilesToRemove.ContainsKey(fullTrackedPath)) { return(false); } return(true); }); } else { compactInputs.SaveTlog(); } if (this.MaintainCompositeRootingMarkers) { string str2 = GenerateCommandLine(); sourcesToCommandLines[FileTracker.FormatRootingMarker(this.SourcesCompiled)] = str2; if (strArray != null) { foreach (string str3 in strArray) { sourcesToCommandLines.Remove(str3); } } } else { string str4 = this.SourcesPropertyName ?? "Sources"; string str5 = GenerateCommandLineExceptSwitches(new string[] { str4 }); foreach (ITaskItem item4 in this.SourcesCompiled) { sourcesToCommandLines[FileTracker.FormatRootingMarker(item4)] = str5 + " " + item4.GetMetadata("FullPath").ToUpperInvariant(); } } this.WriteSourcesToCommandLinesTable(sourcesToCommandLines); } } } return(num); }