예제 #1
0
        public bool NeedsRebuild(PipelineManager manager, PipelineBuildEvent cachedEvent)
        {
            // If we have no previously cached build event then we cannot
            // be sure that the state hasn't changed... force a rebuild.
            if (cachedEvent == null)
            {
                return(true);
            }

            // Verify that the last write time of the source file matches
            // what we recorded when it was built.  If it is different
            // that means someone modified it and we need to rebuild.
            var sourceWriteTime = File.GetLastWriteTime(SourceFile);

            if (cachedEvent.SourceTime != sourceWriteTime)
            {
                return(true);
            }

            // Do the same test for the dest file.
            var destWriteTime = File.GetLastWriteTime(DestFile);

            if (cachedEvent.DestTime != destWriteTime)
            {
                return(true);
            }

            // If the source file is newer than the dest file
            // then it must have been updated and needs a rebuild.
            if (sourceWriteTime >= destWriteTime)
            {
                return(true);
            }

            // Are any of the dependancy files newer than the dest file?
            foreach (var depFile in cachedEvent.Dependencies)
            {
                if (File.GetLastWriteTime(depFile) >= destWriteTime)
                {
                    return(true);
                }
            }

            // This shouldn't happen...  but if the source or dest files changed
            // then force a rebuild.
            if (cachedEvent.SourceFile != SourceFile ||
                cachedEvent.DestFile != DestFile)
            {
                return(true);
            }

            // Did the importer assembly change?
            if (manager.GetImporterAssemblyTimestamp(cachedEvent.Importer) > cachedEvent.ImporterTime)
            {
                return(true);
            }

            // Did the importer change?
            if (cachedEvent.Importer != Importer)
            {
                return(true);
            }

            // Did the processor assembly change?
            if (manager.GetProcessorAssemblyTimestamp(cachedEvent.Processor) > cachedEvent.ProcessorTime)
            {
                return(true);
            }

            // Did the processor change?
            if (cachedEvent.Processor != Processor)
            {
                return(true);
            }

            // Did the parameters change?
            var defaultValues = manager.GetProcessorDefaultValues(Processor);

            if (!AreParametersEqual(cachedEvent.Parameters, Parameters, defaultValues))
            {
                return(true);
            }

            return(false);
        }
 public PipelineProcessorContext(PipelineManager manager, PipelineBuildEvent pipelineEvent)
 {
     _manager       = manager;
     _pipelineEvent = pipelineEvent;
 }