예제 #1
0
 internal void Load(string baseDir)
 {
     if (IntermediateModelManifestFile != null)
     {
         IntermediateModelManifest = IncrementalUtility.LoadIntermediateFile <ModelManifest>(Path.Combine(baseDir, IntermediateModelManifestFile));
     }
 }
예제 #2
0
 private void OnSerializingMethod(StreamingContext context)
 {
     IncrementalUtility.SaveDependency(DependencyFile, Dependency);
     IncrementalUtility.SaveIntermediateFile(AttributesFile, Attributes);
     IncrementalUtility.SaveIntermediateFile(ManifestFile, Manifest);
     IncrementalUtility.SaveIntermediateFile(XRefSpecMapFile, XRefSpecMap);
 }
예제 #3
0
 private void OnDeserializedMethod(StreamingContext context)
 {
     Dependency  = IncrementalUtility.LoadDependency(DependencyFile);
     Attributes  = IncrementalUtility.LoadIntermediateFile <IDictionary <string, FileAttributeItem> >(AttributesFile);
     Manifest    = IncrementalUtility.LoadIntermediateFile <IEnumerable <ManifestItem> >(ManifestFile);
     XRefSpecMap = IncrementalUtility.LoadIntermediateFile <IDictionary <string, XRefSpec> >(XRefSpecMapFile);
 }
예제 #4
0
 internal void Save(string baseDir)
 {
     if (IntermediateModelManifestFile == null)
     {
         IntermediateModelManifestFile = IncrementalUtility.CreateRandomFileName(baseDir);
     }
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, IntermediateModelManifestFile), IntermediateModelManifest);
 }
예제 #5
0
 public void SaveManifest(string baseDir)
 {
     if (ManifestItemsFile == null)
     {
         ManifestItemsFile = IncrementalUtility.CreateRandomFileName(baseDir);
     }
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, ManifestItemsFile), ManifestItems);
 }
예제 #6
0
 internal void Save(string baseDir)
 {
     IncrementalUtility.SaveDependency(Path.Combine(baseDir, DependencyFile), Dependency);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, AttributesFile), Attributes);
     //IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, ManifestFile), Manifest);
     //IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, XRefSpecMapFile), XRefSpecMap);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, BuildModelManifestFile), BuildModelManifest);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, PostBuildModelManifestFile), PostBuildModelManifest);
 }
예제 #7
0
 internal void Load(string baseDir)
 {
     Dependency = IncrementalUtility.LoadDependency(Path.Combine(baseDir, DependencyFile));
     Attributes = IncrementalUtility.LoadIntermediateFile <IDictionary <string, FileAttributeItem> >(Path.Combine(baseDir, AttributesFile));
     //Manifest = IncrementalUtility.LoadIntermediateFile<IEnumerable<ManifestItem>>(Path.Combine(baseDir, ManifestFile));
     //XRefSpecMap = IncrementalUtility.LoadIntermediateFile<IDictionary<string, XRefSpec>>(Path.Combine(baseDir, XRefSpecMapFile));
     BuildModelManifest     = IncrementalUtility.LoadIntermediateFile <ModelManifest>(Path.Combine(baseDir, BuildModelManifestFile));
     PostBuildModelManifest = IncrementalUtility.LoadIntermediateFile <ModelManifest>(Path.Combine(baseDir, PostBuildModelManifestFile));
 }
        public static IncrementalBuildContext Create(DocumentBuildParameters parameters, BuildInfo cb, BuildInfo lb, string intermediateFolder, string markdownServiceContextHash)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (cb == null)
            {
                throw new ArgumentNullException(nameof(cb));
            }
            if (intermediateFolder == null)
            {
                throw new ArgumentNullException(nameof(intermediateFolder));
            }
            var baseDir     = Path.Combine(intermediateFolder, cb.DirectoryName);
            var lastBaseDir = lb != null?Path.Combine(intermediateFolder, lb.DirectoryName) : null;

            var lastBuildStartTime         = lb?.BuildStartTime;
            var buildInfoIncrementalStatus = GetBuildInfoIncrementalStatus(cb, lb, parameters.ForceRebuild);
            var lbv = lb?.Versions?.SingleOrDefault(v => v.VersionName == parameters.VersionName);
            var cbv = new BuildVersionInfo()
            {
                BaseDir             = Path.GetFullPath(Environment.ExpandEnvironmentVariables(baseDir)),
                VersionName         = parameters.VersionName,
                ConfigHash          = ComputeConfigHash(parameters, markdownServiceContextHash),
                FileMetadataHash    = ComputeFileMetadataHash(parameters.FileMetadata),
                FileMetadata        = parameters.FileMetadata,
                AttributesFile      = IncrementalUtility.CreateRandomFileName(baseDir),
                DependencyFile      = IncrementalUtility.CreateRandomFileName(baseDir),
                ManifestFile        = IncrementalUtility.CreateRandomFileName(baseDir),
                OutputFile          = IncrementalUtility.CreateRandomFileName(baseDir),
                XRefSpecMapFile     = IncrementalUtility.CreateRandomFileName(baseDir),
                FileMapFile         = IncrementalUtility.CreateRandomFileName(baseDir),
                BuildMessageFile    = IncrementalUtility.CreateRandomFileName(baseDir),
                TocRestructionsFile = IncrementalUtility.CreateRandomFileName(baseDir),
            };

            if (parameters.FileMetadata != null)
            {
                cbv.FileMetadataFile = IncrementalUtility.CreateRandomFileName(baseDir);
            }
            cb.Versions.Add(cbv);
            var context = new IncrementalBuildContext(baseDir, lastBaseDir, lastBuildStartTime, buildInfoIncrementalStatus, parameters, cbv, lbv)
            {
                IsTemplateUpdated = cb.TemplateHash != lb?.TemplateHash
            };

            if (context.IsTemplateUpdated)
            {
                Logger.LogVerbose($"Cannot build incrementally in link phase because template changed (new: {cb.TemplateHash} vs. old: {lb?.TemplateHash ?? "null"}). Will apply templates and post process all files", code: InfoCodes.IncrementalBuildReason.TemplateChanged);
            }
            context.InitDependency();
            context.InitFileAttributes();
            context.InitChanges();
            return(context);
        }
예제 #9
0
        public void SaveManifest(string baseDir)
        {
            var expanded = Path.GetFullPath(Environment.ExpandEnvironmentVariables(baseDir));

            if (ManifestItemsFile == null)
            {
                ManifestItemsFile = IncrementalUtility.CreateRandomFileName(expanded);
            }
            IncrementalUtility.SaveIntermediateFile(Path.Combine(expanded, ManifestItemsFile), ManifestItems);
        }
예제 #10
0
 internal void Save(string baseDir)
 {
     IncrementalUtility.SaveDependency(Path.Combine(baseDir, DependencyFile), Dependency);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, AttributesFile), Attributes);
     BuildMessage.Save(Path.Combine(baseDir, BuildMessageFile));
     foreach (var processor in Processors)
     {
         processor.Save(baseDir);
     }
 }
예제 #11
0
 internal void Load(string baseDir)
 {
     Dependency   = IncrementalUtility.LoadDependency(Path.Combine(baseDir, DependencyFile));
     Attributes   = IncrementalUtility.LoadIntermediateFile <IDictionary <string, FileAttributeItem> >(Path.Combine(baseDir, AttributesFile));
     BuildMessage = BuildMessageInfo.Load(Path.Combine(baseDir, BuildMessageFile));
     foreach (var processor in Processors)
     {
         processor.Load(baseDir);
     }
 }
예제 #12
0
 internal void Save(string baseDir)
 {
     IncrementalUtility.SaveDependency(Path.Combine(baseDir, DependencyFile), Dependency);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, AttributesFile), Attributes);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, OutputFile), BuildOutputs);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, XRefSpecMapFile), XRefSpecMap);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, FileMapFile), FileMap);
     IncrementalUtility.SaveBuildMessage(Path.Combine(baseDir, BuildMessageFile), BuildMessage);
     foreach (var processor in Processors)
     {
         processor.Save(baseDir);
     }
 }
예제 #13
0
 internal void Load(string baseDir)
 {
     Dependency   = IncrementalUtility.LoadDependency(Path.Combine(baseDir, DependencyFile));
     Attributes   = IncrementalUtility.LoadIntermediateFile <IDictionary <string, FileAttributeItem> >(Path.Combine(baseDir, AttributesFile));
     BuildOutputs = IncrementalUtility.LoadIntermediateFile <BuildOutputs>(Path.Combine(baseDir, OutputFile));
     Manifest     = IncrementalUtility.LoadIntermediateFile <IEnumerable <ManifestItem> >(Path.Combine(baseDir, ManifestFile));
     XRefSpecMap  = IncrementalUtility.LoadIntermediateFile <IDictionary <string, IEnumerable <XRefSpec> > >(Path.Combine(baseDir, XRefSpecMapFile));
     FileMap      = IncrementalUtility.LoadIntermediateFile <IDictionary <string, string> >(Path.Combine(baseDir, FileMapFile));
     BuildMessage = IncrementalUtility.LoadBuildMessage(Path.Combine(baseDir, BuildMessageFile));
     foreach (var processor in Processors)
     {
         processor.Load(baseDir);
     }
 }
예제 #14
0
 internal void Save(string baseDir)
 {
     if (PostProcessOutputsFile == null)
     {
         PostProcessOutputsFile = IncrementalUtility.CreateRandomFileName(baseDir);
     }
     if (MessageInfoFile == null)
     {
         MessageInfoFile = IncrementalUtility.CreateRandomFileName(baseDir);
     }
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, PostProcessOutputsFile), PostProcessOutputs);
     using var sw = new StreamWriter(Path.Combine(baseDir, MessageInfoFile), false, UTF8);
     MessageInfo.Save(sw);
 }
예제 #15
0
 internal void Load(string baseDir)
 {
     ActionWhenNotNull(baseDir, DependencyFile, f => { Dependency = IncrementalUtility.LoadDependency(f); });
     ActionWhenNotNull(baseDir, AttributesFile, f => { Attributes = IncrementalUtility.LoadIntermediateFile <OSPlatformSensitiveDictionary <FileAttributeItem> >(f); });
     ActionWhenNotNull(baseDir, OutputFile, f => { BuildOutputs = IncrementalUtility.LoadIntermediateFile <BuildOutputs>(f); });
     ActionWhenNotNull(baseDir, ManifestFile, f => { Manifest = IncrementalUtility.LoadIntermediateFile <IEnumerable <ManifestItem> >(f); });
     ActionWhenNotNull(baseDir, XRefSpecMapFile, f => { XRefSpecMap = IncrementalUtility.LoadIntermediateFile <OSPlatformSensitiveDictionary <List <XRefSpec> > >(f); });
     ActionWhenNotNull(baseDir, FileMapFile, f => { FileMap = IncrementalUtility.LoadIntermediateFile <OSPlatformSensitiveDictionary <FileMapItem> >(f); });
     ActionWhenNotNull(baseDir, BuildMessageFile, f => { BuildMessage = IncrementalUtility.LoadBuildMessage(f); });
     ActionWhenNotNull(baseDir, TocRestructionsFile, f => { TocRestructions = IncrementalUtility.LoadIntermediateFile <OSPlatformSensitiveDictionary <List <TreeItemRestructure> > >(f); });
     foreach (var processor in Processors)
     {
         processor.Load(baseDir);
     }
 }
예제 #16
0
 internal void Load(string baseDir)
 {
     if (PostProcessOutputsFile != null)
     {
         PostProcessOutputs = IncrementalUtility.LoadIntermediateFile <PostProcessOutputs>(Path.Combine(baseDir, PostProcessOutputsFile));
     }
     if (MessageInfoFile != null)
     {
         using var sr = new StreamReader(Path.Combine(baseDir, MessageInfoFile), UTF8);
         MessageInfo  = BuildMessageInfo.Load(sr);
     }
     if (ManifestItemsFile != null)
     {
         ManifestItems = IncrementalUtility.LoadIntermediateFile <List <ManifestItem> >(Path.Combine(baseDir, ManifestItemsFile));
     }
 }
예제 #17
0
        public static IncrementalBuildContext Create(DocumentBuildParameters parameters, BuildInfo cb, BuildInfo lb, string intermediateFolder, string markdownServiceContextHash)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (cb == null)
            {
                throw new ArgumentNullException(nameof(cb));
            }
            if (intermediateFolder == null)
            {
                throw new ArgumentNullException(nameof(intermediateFolder));
            }
            var baseDir     = Path.Combine(intermediateFolder, cb.DirectoryName);
            var lastBaseDir = lb != null?Path.Combine(intermediateFolder, lb.DirectoryName) : null;

            var lastBuildStartTime         = lb?.BuildStartTime;
            var buildInfoIncrementalStatus = GetBuildInfoIncrementalStatus(cb, lb);
            var lbv = lb?.Versions?.SingleOrDefault(v => v.VersionName == parameters.VersionName);
            var cbv = new BuildVersionInfo()
            {
                BaseDir             = Path.GetFullPath(Environment.ExpandEnvironmentVariables(baseDir)),
                VersionName         = parameters.VersionName,
                ConfigHash          = ComputeConfigHash(parameters, markdownServiceContextHash),
                AttributesFile      = IncrementalUtility.CreateRandomFileName(baseDir),
                DependencyFile      = IncrementalUtility.CreateRandomFileName(baseDir),
                ManifestFile        = IncrementalUtility.CreateRandomFileName(baseDir),
                OutputFile          = IncrementalUtility.CreateRandomFileName(baseDir),
                XRefSpecMapFile     = IncrementalUtility.CreateRandomFileName(baseDir),
                FileMapFile         = IncrementalUtility.CreateRandomFileName(baseDir),
                BuildMessageFile    = IncrementalUtility.CreateRandomFileName(baseDir),
                TocRestructionsFile = IncrementalUtility.CreateRandomFileName(baseDir),
            };

            cb.Versions.Add(cbv);
            var context = new IncrementalBuildContext(baseDir, lastBaseDir, lastBuildStartTime, buildInfoIncrementalStatus, parameters, cbv, lbv)
            {
                IsTemplateUpdated = (cb.TemplateHash != lb?.TemplateHash)
            };

            context.InitDependency();
            context.InitFileAttributes();
            context.InitChanges();
            return(context);
        }
예제 #18
0
        public static IncrementalBuildContext Create(DocumentBuildParameters parameters, BuildInfo cb, BuildInfo lb, string intermediateFolder, string markdownServiceContextHash)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (cb == null)
            {
                throw new ArgumentNullException(nameof(cb));
            }
            if (intermediateFolder == null)
            {
                throw new ArgumentNullException(nameof(intermediateFolder));
            }
            var baseDir     = Path.Combine(intermediateFolder, cb.DirectoryName);
            var lastBaseDir = lb != null?Path.Combine(intermediateFolder, lb.DirectoryName) : null;

            var lastBuildStartTime      = lb?.BuildStartTime;
            var canBuildInfoIncremental = CanBuildInfoIncremental(cb, lb);
            var lbv = lb?.Versions?.SingleOrDefault(v => v.VersionName == parameters.VersionName);
            var cbv = new BuildVersionInfo
            {
                VersionName      = parameters.VersionName,
                ConfigHash       = ComputeConfigHash(parameters, markdownServiceContextHash),
                AttributesFile   = IncrementalUtility.CreateRandomFileName(baseDir),
                DependencyFile   = IncrementalUtility.CreateRandomFileName(baseDir),
                ManifestFile     = IncrementalUtility.CreateRandomFileName(baseDir),
                OutputFile       = IncrementalUtility.CreateRandomFileName(baseDir),
                XRefSpecMapFile  = IncrementalUtility.CreateRandomFileName(baseDir),
                FileMapFile      = IncrementalUtility.CreateRandomFileName(baseDir),
                BuildMessageFile = IncrementalUtility.CreateRandomFileName(baseDir),
                Attributes       = ComputeFileAttributes(parameters, lbv?.Dependency),
                Dependency       = ConstructDependencyGraphFromLast(lbv?.Dependency),
            };

            cb.Versions.Add(cbv);
            var context = new IncrementalBuildContext(baseDir, lastBaseDir, lastBuildStartTime, canBuildInfoIncremental, parameters, cbv, lbv);

            context.InitChanges();
            return(context);
        }
예제 #19
0
 internal void Save(string baseDir)
 {
     IncrementalUtility.SaveDependency(Path.Combine(baseDir, DependencyFile), Dependency);
     if (FileMetadataFile != null)
     {
         IncrementalUtility.SaveIntermediateFile(
             Path.Combine(baseDir, FileMetadataFile),
             FileMetadata,
             IncrementalUtility.FileMetadataJsonSerializationSettings);
     }
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, AttributesFile), Attributes);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, OutputFile), BuildOutputs);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, XRefSpecMapFile), XRefSpecMap);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, FileMapFile), FileMap);
     IncrementalUtility.SaveBuildMessage(Path.Combine(baseDir, BuildMessageFile), BuildMessage);
     IncrementalUtility.SaveIntermediateFile(Path.Combine(baseDir, TocRestructionsFile), TocRestructions);
     foreach (var processor in Processors)
     {
         processor.Save(baseDir);
     }
 }
예제 #20
0
        public ProcessorInfo CreateProcessorInfo(IDocumentProcessor processor)
        {
            var cpi = new ProcessorInfo
            {
                Name = processor.Name,
                IncrementalContextHash = ((ISupportIncrementalDocumentProcessor)processor).GetIncrementalContextHash(),
            };

            foreach (var step in processor.BuildSteps)
            {
                cpi.Steps.Add(new ProcessorStepInfo
                {
                    Name = step.Name,
                    IncrementalContextHash = ((ISupportIncrementalBuildStep)step).GetIncrementalContextHash(),
                    ContextInfoFile        = (step is ICanTraceContextInfoBuildStep) ? IncrementalUtility.CreateRandomFileName(BaseDir) : null,
                });
            }
            lock (_sync)
            {
                CurrentBuildVersionInfo.Processors.Add(cpi);
            }
            return(cpi);
        }
예제 #21
0
        public void SaveManifest(string baseDir)
        {
            var expanded = Path.GetFullPath(Environment.ExpandEnvironmentVariables(baseDir));

            IncrementalUtility.SaveIntermediateFile(Path.Combine(expanded, ManifestFile), Manifest);
        }
예제 #22
0
 public void Save(string file)
 {
     IncrementalUtility.SaveIntermediateFile <IDictionary <string, List <LogItem> > >(file, _logs);
 }
예제 #23
0
        public static BuildMessageInfo Load(string file)
        {
            var logs = IncrementalUtility.LoadIntermediateFile <IDictionary <string, List <LogItem> > >(file);

            return(new BuildMessageInfo(logs));
        }
예제 #24
0
 public void SaveManifest()
 {
     IncrementalUtility.SaveIntermediateFile(Path.Combine(BaseDir, ManifestFile), Manifest);
 }