示例#1
0
        public static bool IsUpToDate(Task hostTask, UpToDateCheckType upToDateCheckType, ITaskItem[] readTLogNames, ITaskItem[] writeTLogNames)
        {
            bool isUpToDate;
            // Read the input graph (missing inputs are infinitely new - i.e. outputs are out of date)
            FlatTrackingData inputs = new FlatTrackingData(hostTask, readTLogNames, DateTime.MaxValue);

            // Read the output graph (missing outputs are infinitely old - i.e. outputs are out of date)
            FlatTrackingData outputs = new FlatTrackingData(hostTask, writeTLogNames, DateTime.MinValue);

            // Find out if we are up to date
            isUpToDate = IsUpToDate(hostTask.Log, upToDateCheckType, inputs, outputs);

            // We're going to execute, so clear out the tlogs so
            // the new execution will correctly populate the tlogs a-new
            if (!isUpToDate)
            {
                // Remove all from inputs tlog
                inputs.DependencyTable.Clear();
                inputs.SaveTlog();

                // Remove all from outputs tlog
                outputs.DependencyTable.Clear();
                outputs.SaveTlog();
            }
            return(isUpToDate);
        }
        public static bool IsUpToDate(Task hostTask, UpToDateCheckType upToDateCheckType, ITaskItem[] readTLogNames, ITaskItem[] writeTLogNames)
        {
            FlatTrackingData inputs  = new FlatTrackingData(hostTask, readTLogNames, DateTime.MaxValue);
            FlatTrackingData outputs = new FlatTrackingData(hostTask, writeTLogNames, DateTime.MinValue);
            bool             flag    = IsUpToDate(hostTask.Log, upToDateCheckType, inputs, outputs);

            if (!flag)
            {
                inputs.DependencyTable.Clear();
                inputs.SaveTlog();
                outputs.DependencyTable.Clear();
                outputs.SaveTlog();
            }
            return(flag);
        }
 public static bool IsUpToDate(TaskLoggingHelper Log, UpToDateCheckType upToDateCheckType, FlatTrackingData inputs, FlatTrackingData outputs)
 {
     bool flag = false;
     ResourceManager taskResources = Log.TaskResources;
     Log.TaskResources = AssemblyResources.PrimaryResources;
     inputs.UpdateFileEntryDetails();
     outputs.UpdateFileEntryDetails();
     if ((!inputs.TlogsAvailable || !outputs.TlogsAvailable) || (inputs.DependencyTable.Count == 0))
     {
         Log.LogMessageFromResources(MessageImportance.Low, "Tracking_LogFilesNotAvailable", new object[0]);
     }
     else if ((inputs.MissingFiles.Count > 0) || (outputs.MissingFiles.Count > 0))
     {
         if (inputs.MissingFiles.Count > 0)
         {
             Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingInputs", new object[0]);
         }
         if (inputs.MissingFiles.Count > 100)
         {
             FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_InputsNotShown", new object[] { inputs.MissingFiles.Count });
         }
         else
         {
             foreach (string str in inputs.MissingFiles)
             {
                 FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + str, new object[0]);
             }
         }
         if (outputs.MissingFiles.Count > 0)
         {
             Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingOutputs", new object[0]);
         }
         if (outputs.MissingFiles.Count > 100)
         {
             FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_OutputsNotShown", new object[] { outputs.MissingFiles.Count });
         }
         else
         {
             foreach (string str2 in outputs.MissingFiles)
             {
                 FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + str2, new object[0]);
             }
         }
     }
     else if ((upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking) && (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
     {
         Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
     }
     else if ((upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking) && (outputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
     {
         Log.LogMessage(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { outputs.NewestFileName, outputs.NewestFileTimeUtc });
     }
     else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanOutput) && (inputs.NewestFileTimeUtc > outputs.NewestFileTimeUtc))
     {
         Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
     }
     else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanTracking) && (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
     {
         Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
     }
     else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanTracking) && (inputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
     {
         Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
     }
     else
     {
         flag = true;
         Log.LogMessageFromResources(MessageImportance.Normal, "Tracking_UpToDate", new object[0]);
     }
     Log.TaskResources = taskResources;
     return flag;
 }
 public static bool IsUpToDate(Task hostTask, UpToDateCheckType upToDateCheckType, ITaskItem[] readTLogNames, ITaskItem[] writeTLogNames)
 {
     FlatTrackingData inputs = new FlatTrackingData(hostTask, readTLogNames, DateTime.MaxValue);
     FlatTrackingData outputs = new FlatTrackingData(hostTask, writeTLogNames, DateTime.MinValue);
     bool flag = IsUpToDate(hostTask.Log, upToDateCheckType, inputs, outputs);
     if (!flag)
     {
         inputs.DependencyTable.Clear();
         inputs.SaveTlog();
         outputs.DependencyTable.Clear();
         outputs.SaveTlog();
     }
     return flag;
 }
示例#5
0
        public static bool IsUpToDate(TaskLoggingHelper Log, UpToDateCheckType upToDateCheckType, FlatTrackingData inputs, FlatTrackingData outputs)
        {
            bool isUpToDate = false;
            // Keep a record of the task resources that was in use before
            ResourceManager taskResources = Log.TaskResources;

            Log.TaskResources = AssemblyResources.PrimaryResources;

            inputs.UpdateFileEntryDetails();
            outputs.UpdateFileEntryDetails();

            if (!inputs.TlogsAvailable || !outputs.TlogsAvailable || inputs.DependencyTable.Count == 0)
            {
                // 1) The TLogs are somehow missing, which means we need to build
                // 2) Because we are flat tracking, there are no roots which means that all the input file information 
                //    comes from the input Tlogs, if they are empty then we must build.
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_LogFilesNotAvailable");
            }
            else if (inputs.MissingFiles.Count > 0 || outputs.MissingFiles.Count > 0)
            {
                // Files are missing from either inputs or outputs, that means we need to build

                // Files are missing from inputs, that means we need to build
                if (inputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingInputs");
                }
                // Too much logging leads to poor performance
                if (inputs.MissingFiles.Count > MaxLogCount)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_InputsNotShown", inputs.MissingFiles.Count);
                }
                else
                {
                    // We have our set of inputs, log the details
                    foreach (string input in inputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + input);
                    }
                }

                // Files are missing from outputs, that means we need to build
                if (outputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingOutputs");
                }
                // Too much logging leads to poor performance
                if (outputs.MissingFiles.Count > MaxLogCount)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_OutputsNotShown", outputs.MissingFiles.Count);
                }
                else
                {
                    // We have our set of inputs, log the details
                    foreach (string output in outputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + output);
                    }
                }
            }
            else if (upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking &&
                    (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the input tlog
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, inputs.NewestTLogFileName, inputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking &&
                    (outputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                // one of the outputs is newer than the output tlog
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", outputs.NewestFileName, outputs.NewestFileTimeUtc, outputs.NewestTLogFileName, outputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanOutput &&
                    (inputs.NewestFileTimeUtc > outputs.NewestFileTimeUtc))
            {
                // One of the inputs is newer than the outputs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, outputs.NewestFileName, outputs.NewestFileTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanTracking &&
                    (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the one of the TLogs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, inputs.NewestTLogFileName, inputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanTracking &&
                    (inputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the one of the TLogs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, outputs.NewestTLogFileName, outputs.NewestTLogTimeUtc);
            }
            else
            {
                // Nothing appears to have changed..
                isUpToDate = true;
                Log.LogMessageFromResources(MessageImportance.Normal, "Tracking_UpToDate");
            }

            // Set the task resources back now that we're done with it
            Log.TaskResources = taskResources;

            return isUpToDate;
        }
示例#6
0
        public static bool IsUpToDate(Task hostTask, UpToDateCheckType upToDateCheckType, ITaskItem[] readTLogNames, ITaskItem[] writeTLogNames)
        {
            bool isUpToDate;
            // Read the input graph (missing inputs are infinitely new - i.e. outputs are out of date)
            FlatTrackingData inputs = new FlatTrackingData(hostTask, readTLogNames, DateTime.MaxValue);

            // Read the output graph (missing outputs are infinitely old - i.e. outputs are out of date)
            FlatTrackingData outputs = new FlatTrackingData(hostTask, writeTLogNames, DateTime.MinValue);

            // Find out if we are up to date
            isUpToDate = IsUpToDate(hostTask.Log, upToDateCheckType, inputs, outputs);

            // We're going to execute, so clear out the tlogs so
            // the new execution will correctly populate the tlogs a-new
            if (!isUpToDate)
            {
                // Remove all from inputs tlog
                inputs.DependencyTable.Clear();
                inputs.SaveTlog();

                // Remove all from outputs tlog
                outputs.DependencyTable.Clear();
                outputs.SaveTlog();
            }
            return isUpToDate;
        }
        public static bool IsUpToDate(TaskLoggingHelper Log, UpToDateCheckType upToDateCheckType, FlatTrackingData inputs, FlatTrackingData outputs)
        {
            bool            flag          = false;
            ResourceManager taskResources = Log.TaskResources;

            Log.TaskResources = AssemblyResources.PrimaryResources;
            inputs.UpdateFileEntryDetails();
            outputs.UpdateFileEntryDetails();
            if ((!inputs.TlogsAvailable || !outputs.TlogsAvailable) || (inputs.DependencyTable.Count == 0))
            {
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_LogFilesNotAvailable", new object[0]);
            }
            else if ((inputs.MissingFiles.Count > 0) || (outputs.MissingFiles.Count > 0))
            {
                if (inputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingInputs", new object[0]);
                }
                if (inputs.MissingFiles.Count > 100)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_InputsNotShown", new object[] { inputs.MissingFiles.Count });
                }
                else
                {
                    foreach (string str in inputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + str, new object[0]);
                    }
                }
                if (outputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingOutputs", new object[0]);
                }
                if (outputs.MissingFiles.Count > 100)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_OutputsNotShown", new object[] { outputs.MissingFiles.Count });
                }
                else
                {
                    foreach (string str2 in outputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + str2, new object[0]);
                    }
                }
            }
            else if ((upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking) && (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
            }
            else if ((upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking) && (outputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                Log.LogMessage(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { outputs.NewestFileName, outputs.NewestFileTimeUtc });
            }
            else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanOutput) && (inputs.NewestFileTimeUtc > outputs.NewestFileTimeUtc))
            {
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
            }
            else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanTracking) && (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
            }
            else if ((upToDateCheckType == UpToDateCheckType.InputNewerThanTracking) && (inputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", new object[] { inputs.NewestFileName, inputs.NewestFileTimeUtc });
            }
            else
            {
                flag = true;
                Log.LogMessageFromResources(MessageImportance.Normal, "Tracking_UpToDate", new object[0]);
            }
            Log.TaskResources = taskResources;
            return(flag);
        }
示例#8
0
        public static bool IsUpToDate(TaskLoggingHelper Log, UpToDateCheckType upToDateCheckType, FlatTrackingData inputs, FlatTrackingData outputs)
        {
            bool isUpToDate = false;
            // Keep a record of the task resources that was in use before
            ResourceManager taskResources = Log.TaskResources;

            Log.TaskResources = AssemblyResources.PrimaryResources;

            inputs.UpdateFileEntryDetails();
            outputs.UpdateFileEntryDetails();

            if (!inputs.TlogsAvailable || !outputs.TlogsAvailable || inputs.DependencyTable.Count == 0)
            {
                // 1) The TLogs are somehow missing, which means we need to build
                // 2) Because we are flat tracking, there are no roots which means that all the input file information
                //    comes from the input Tlogs, if they are empty then we must build.
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_LogFilesNotAvailable");
            }
            else if (inputs.MissingFiles.Count > 0 || outputs.MissingFiles.Count > 0)
            {
                // Files are missing from either inputs or outputs, that means we need to build

                // Files are missing from inputs, that means we need to build
                if (inputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingInputs");
                }
                // Too much logging leads to poor performance
                if (inputs.MissingFiles.Count > MaxLogCount)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_InputsNotShown", inputs.MissingFiles.Count);
                }
                else
                {
                    // We have our set of inputs, log the details
                    foreach (string input in inputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + input);
                    }
                }

                // Files are missing from outputs, that means we need to build
                if (outputs.MissingFiles.Count > 0)
                {
                    Log.LogMessageFromResources(MessageImportance.Low, "Tracking_MissingOutputs");
                }
                // Too much logging leads to poor performance
                if (outputs.MissingFiles.Count > MaxLogCount)
                {
                    FileTracker.LogMessageFromResources(Log, MessageImportance.Low, "Tracking_OutputsNotShown", outputs.MissingFiles.Count);
                }
                else
                {
                    // We have our set of inputs, log the details
                    foreach (string output in outputs.MissingFiles)
                    {
                        FileTracker.LogMessage(Log, MessageImportance.Low, "\t" + output);
                    }
                }
            }
            else if (upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking &&
                     (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the input tlog
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, inputs.NewestTLogFileName, inputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputOrOutputNewerThanTracking &&
                     (outputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                // one of the outputs is newer than the output tlog
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", outputs.NewestFileName, outputs.NewestFileTimeUtc, outputs.NewestTLogFileName, outputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanOutput &&
                     (inputs.NewestFileTimeUtc > outputs.NewestFileTimeUtc))
            {
                // One of the inputs is newer than the outputs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, outputs.NewestFileName, outputs.NewestFileTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanTracking &&
                     (inputs.NewestFileTimeUtc > inputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the one of the TLogs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, inputs.NewestTLogFileName, inputs.NewestTLogTimeUtc);
            }
            else if (upToDateCheckType == UpToDateCheckType.InputNewerThanTracking &&
                     (inputs.NewestFileTimeUtc > outputs.NewestTLogTimeUtc))
            {
                // One of the inputs is newer than the one of the TLogs
                Log.LogMessageFromResources(MessageImportance.Low, "Tracking_DependencyWasModifiedAt", inputs.NewestFileName, inputs.NewestFileTimeUtc, outputs.NewestTLogFileName, outputs.NewestTLogTimeUtc);
            }
            else
            {
                // Nothing appears to have changed..
                isUpToDate = true;
                Log.LogMessageFromResources(MessageImportance.Normal, "Tracking_UpToDate");
            }

            // Set the task resources back now that we're done with it
            Log.TaskResources = taskResources;

            return(isUpToDate);
        }