예제 #1
0
        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");
                    string pchOutputH   = Path.GetFullPath(sourceItem.GetMetadata("PrecompiledHeaderOutputFile"));
                    string pchOutputGCH = pchOutputH + ".gch";
                    string pchSetting   = sourceItem.GetMetadata("PrecompiledHeader").ToLowerInvariant();

                    try
                    {
                        List <string> dependencies = new List <string>();

                        dependencies.Add("^" + sourcePath);

                        // don't add an entry if the object file wasn't built
                        if (!File.Exists(objectFile))
                        {
                            continue;
                        }

                        if (!File.Exists(dotDFile))
                        {
                            throw new Exception("File " + sourcePath + " is missing it's .d file: " + dotDFile);
                        }

                        DepFileParse depFileParse = new DepFileParse(dotDFile);

                        foreach (string dependentFile in depFileParse.DependentFiles)
                        {
                            if (dependentFile != sourcePath)
                            {
                                if (File.Exists(dependentFile) == false)
                                {
                                    throw new Exception("File " + sourcePath + " is missing dependent file: " + dependentFile);
                                }

                                dependencies.Add(dependentFile);
                            }
                        }

                        if (pchSetting == "use")
                        {
                            dependencies.Add(pchOutputH.ToUpperInvariant());
                            dependencies.Add(pchOutputGCH.ToUpperInvariant());
                        }

                        // Done with this .d file. So delete it
                        try
                        {
                            File.Delete(dotDFile);
                        }
                        finally
                        {
                        }

                        // Finally write out the file and its dependencies, must ensure success before doing this
                        foreach (var dep in dependencies)
                        {
                            writer.WriteLine(dep);
                        }
                    }
                    catch (Exception)
                    {
                        Log.LogError("Failed processing dependencies in: " + dotDFile);
                    }
                }
            }
        }
예제 #2
0
		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" );
					string pchOutputH = Path.GetFullPath( sourceItem.GetMetadata( "PrecompiledHeaderOutputFile" ) );
					string pchOutputGCH = pchOutputH + ".gch";
					string pchSetting = sourceItem.GetMetadata( "PrecompiledHeader" ).ToLowerInvariant();

					try
					{
						List<string> dependencies = new List<string>();

						dependencies.Add( "^" + sourcePath );

						// don't add an entry if the object file wasn't built
						if (!File.Exists(objectFile))
							continue;

						if (!File.Exists(dotDFile))
						{
							throw new Exception( "File " + sourcePath + " is missing it's .d file: " + dotDFile );
						}

						DepFileParse depFileParse = new DepFileParse(dotDFile);

						foreach (string dependentFile in depFileParse.DependentFiles)
						{
							if (dependentFile != sourcePath)
							{
								if (File.Exists(dependentFile) == false)
								{
									throw new Exception( "File " + sourcePath + " is missing dependent file: " + dependentFile );
								}

								dependencies.Add( dependentFile );
							}
						}

						if ( pchSetting == "use" )
						{
							dependencies.Add( pchOutputH.ToUpperInvariant() );
							dependencies.Add( pchOutputGCH.ToUpperInvariant() );
						}

						// Done with this .d file. So delete it
						try
						{
							File.Delete(dotDFile);
						}
						finally
						{

						}

						// Finally write out the file and its dependencies, must ensure success before doing this
						foreach( var dep in dependencies )
						{
							writer.WriteLine( dep );
						}
					}
					catch ( Exception )
					{
						Log.LogError( "Failed processing dependencies in: " + dotDFile );
					}
				}
			}
		}
예제 #3
0
        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 );
                    }
                }
            }
        }
예제 #4
0
        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);
                    }
                }
            }
        }