private void ConstructReadTLog( ITaskItem[] upToDateSources, CanonicalTrackedOutputFiles outputs ) { string readTrackerPath = Path.GetFullPath( TrackerIntermediateDirectory + "\\" + ReadTLogNames[0] ); // Rewrite out read log, with the sources we're *not* compiling right now. TaskItem readTrackerItem = new TaskItem( readTrackerPath ); CanonicalTrackedInputFiles files = new CanonicalTrackedInputFiles(new TaskItem[] { readTrackerItem }, Sources, outputs, false, false); files.RemoveEntriesForSource(Sources); files.SaveTlog(); // Now append onto the read log the sources we're compiling. It'll parse the .d files for each compiled file, so we know the // dependency header files associated with it, these will be recorded in the logfile. using ( StreamWriter writer = new StreamWriter( readTrackerPath, true, Encoding.Unicode ) ) { foreach ( ITaskItem sourceItem in upToDateSources ) { string itemSpec = sourceItem.ItemSpec; string sourcePath = Path.GetFullPath( sourceItem.ItemSpec ).ToUpperInvariant(); string objectFile = Path.GetFullPath( sourceItem.GetMetadata( "ObjectFileName" ) ); string dotDFile = Path.GetFullPath( Path.GetDirectoryName( objectFile ) + "\\" + Path.GetFileNameWithoutExtension( objectFile ) + ".d" ); try { writer.WriteLine("^" + sourcePath); if (File.Exists(dotDFile)) { DepFileParse depFileParse = new DepFileParse(dotDFile); foreach (string dependentFile in depFileParse.DependentFiles) { if (dependentFile != sourcePath) { if (File.Exists(dependentFile) == false) { Log.LogMessage(MessageImportance.High, "File " + sourcePath + " is missing dependent file: " + dependentFile); } writer.WriteLine(dependentFile); } } // Done with this .d file. So delete it try { File.Delete(dotDFile); } finally { } } else if (File.Exists(objectFile)) { Log.LogMessage(MessageImportance.High, "File " + sourcePath + " is missing it's .d file: " + dotDFile); } } catch ( Exception ) { Log.LogError( "Failed processing dependencies in: " + dotDFile ); } } } }
private void ConstructReadTLog(ITaskItem[] upToDateSources, CanonicalTrackedOutputFiles outputs) { string readTrackerPath = Path.GetFullPath(TrackerIntermediateDirectory + "\\" + ReadTLogNames[0]); // Rewrite out read log, with the sources we're *not* compiling right now. TaskItem readTrackerItem = new TaskItem(readTrackerPath); CanonicalTrackedInputFiles files = new CanonicalTrackedInputFiles(new TaskItem[] { readTrackerItem }, Sources, outputs, false, false); files.RemoveEntriesForSource(Sources); files.SaveTlog(); // Now append onto the read log the sources we're compiling. It'll parse the .d files for each compiled file, so we know the // dependency header files associated with it, these will be recorded in the logfile. using (StreamWriter writer = new StreamWriter(readTrackerPath, true, Encoding.Unicode)) { foreach (ITaskItem sourceItem in upToDateSources) { string itemSpec = sourceItem.ItemSpec; string sourcePath = Path.GetFullPath(sourceItem.ItemSpec).ToUpperInvariant(); string objectFile = Path.GetFullPath(sourceItem.GetMetadata("ObjectFileName")); string dotDFile = Path.GetFullPath(Path.GetDirectoryName(objectFile) + "\\" + Path.GetFileNameWithoutExtension(objectFile) + ".d"); try { writer.WriteLine("^" + sourcePath); if (File.Exists(dotDFile)) { DepFileParse depFileParse = new DepFileParse(dotDFile); foreach (string dependentFile in depFileParse.DependentFiles) { if (dependentFile != sourcePath) { if (File.Exists(dependentFile) == false) { Log.LogMessage(MessageImportance.High, "File " + sourcePath + " is missing dependent file: " + dependentFile); } writer.WriteLine(dependentFile); } } // Done with this .d file. So delete it try { File.Delete(dotDFile); } finally { } } else if (File.Exists(objectFile)) { Log.LogMessage(MessageImportance.High, "File " + sourcePath + " is missing it's .d file: " + dotDFile); } } catch (Exception) { Log.LogError("Failed processing dependencies in: " + dotDFile); } } } }