private void SaveContextInfo(List <HostService> hostServices) { foreach (var h in hostServices) { IncrementalContext.SaveContextInfo(h); } }
private void PreHandle(List <HostService> hostServices) { foreach (var hostService in hostServices) { hostService.DependencyGraph = CurrentBuildVersionInfo.Dependency; using (new LoggerPhaseScope("RegisterDependencyTypeFromProcessor", LogLevel.Verbose)) { hostService.RegisterDependencyType(); } if (hostService.ShouldTraceIncrementalInfo) { hostService.IncrementalInfos = IncrementalContext.GetModelIncrementalInfo(hostService, Phase); } } var nonIncreSet = new HashSet <string>(from h in hostServices where !h.CanIncrementalBuild from f in h.Models select IncrementalUtility.GetDependencyKey(f.OriginalFileAndType), FilePathComparer.OSPlatformSensitiveStringComparer); ReportDependency(nonIncreSet); LoadContextInfo(hostServices); RegisterUnloadedTocRestructions(nonIncreSet); Logger.RegisterListener(CurrentBuildMessageInfo.GetListener()); }
private void ReloadModels(IEnumerable <HostService> hostServices) { foreach (var hostService in hostServices.Where(h => h.CanIncrementalBuild)) { hostService.ReloadUnloadedModels(IncrementalContext, Phase); hostService.IncrementalInfos = IncrementalContext.GetModelIncrementalInfo(hostService, Phase); } }
private void ReloadModelsPerChanges(IEnumerable <HostService> hostServices) { var newChanges = IncrementalContext.ExpandDependency(d => CurrentBuildVersionInfo.Dependency.DependencyTypes[d.Type].Phase == Phase); foreach (var hostService in hostServices.Where(h => h.CanIncrementalBuild)) { hostService.ReloadModelsPerIncrementalChanges(IncrementalContext, newChanges, Phase); } }
private void SaveOutputs(IEnumerable <HostService> hostServices) { var outputDir = Context.BuildOutputFolder; var lo = LastBuildVersionInfo?.BuildOutputs; var outputItems = (from m in Context.ManifestItems from output in m.OutputFiles.Values select new { Path = output.RelativePath, SourcePath = m.SourceRelativePath, } into items group items by items.SourcePath).ToDictionary(g => g.Key, g => g.Select(p => p.Path).ToList(), FilePathComparer.OSPlatformSensitiveStringComparer); foreach (var h in hostServices.Where(h => h.ShouldTraceIncrementalInfo)) { foreach (var pair in IncrementalContext.GetModelLoadInfo(h)) { List <string> items; if (!outputItems.TryGetValue(pair.Key, out items)) { continue; } foreach (var path in items) { // path might be duplicate. for example, files with same name in different input folders are mapped to same output folder. if (CurrentBuildVersionInfo.BuildOutputs.ContainsKey(path)) { continue; } string fileName = IncrementalUtility.GetRandomEntry(IncrementalContext.BaseDir); string fullPath = Path.Combine(outputDir, path); IncrementalUtility.RetryIO(() => { if (pair.Value == null) { if (lo == null) { throw new BuildCacheException($"Full build hasn't loaded build outputs."); } string lfn; if (!lo.TryGetValue(path, out lfn)) { throw new BuildCacheException($"Last build hasn't loaded output: {path}."); } Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); File.Copy(Path.Combine(IncrementalContext.LastBaseDir, lfn), fullPath, true); } File.Copy(fullPath, Path.Combine(IncrementalContext.BaseDir, fileName)); CurrentBuildVersionInfo.BuildOutputs[path] = fileName; }); } } } }
private void LoadContextInfo(List <HostService> hostServices) { using (new LoggerPhaseScope("LoadPluginContextInfo", LogLevel.Verbose)) { foreach (var h in hostServices) { IncrementalContext.LoadContextInfo(h); } } }
private void ReloadModelsPerChanges(IEnumerable <HostService> hostServices) { var newChanges = new HashSet <string>( IncrementalContext.ExpandDependency(LastBuildVersionInfo?.Dependency, d => CurrentBuildVersionInfo.Dependency.DependencyTypes[d.Type].Phase == Phase) .Concat( IncrementalContext.ExpandDependency(CurrentBuildVersionInfo.Dependency, d => CurrentBuildVersionInfo.Dependency.DependencyTypes[d.Type].Phase == Phase))); foreach (var hostService in hostServices.Where(h => h.CanIncrementalBuild)) { hostService.ReloadModelsPerIncrementalChanges(IncrementalContext, newChanges, Phase); hostService.IncrementalInfos = IncrementalContext.GetModelIncrementalInfo(hostService, Phase); } }
private void PostHandle(List <HostService> hostServices) { ReportReference(hostServices); ReportDependency(hostServices); UpdateTocRestructions(hostServices); CurrentBuildVersionInfo.Dependency.ResolveReference(); foreach (var h in hostServices.Where(h => h.ShouldTraceIncrementalInfo)) { h.SaveIntermediateModel(IncrementalContext); } IncrementalContext.UpdateBuildVersionInfoPerDependencyGraph(); BuildPhaseUtility.RelayBuildMessage(IncrementalContext, hostServices, Phase); Logger.UnregisterListener(CurrentBuildMessageInfo.GetListener()); }
private void PostHandle(List <HostService> hostServices) { foreach (var h in hostServices.Where(h => h.CanIncrementalBuild)) { foreach (var file in GetFilesToRelayMessages(h)) { LastBuildMessageInfo.Replay(file); } } foreach (var h in hostServices.Where(h => h.ShouldTraceIncrementalInfo)) { h.SaveIntermediateModel(IncrementalContext); } ReportDependency(hostServices); IncrementalContext.UpdateBuildVersionInfoPerDependencyGraph(); Logger.UnregisterListener(CurrentBuildMessageInfo.GetListener()); }
private void PostHandle(List <HostService> hostServices) { foreach (var h in hostServices.Where(h => h.CanIncrementalBuild)) { foreach (var file in from pair in IncrementalContext.GetModelLoadInfo(h) where pair.Value == null select pair.Key) { LastBuildMessageInfo.Replay(file); } } foreach (var h in hostServices.Where(h => h.ShouldTraceIncrementalInfo)) { h.SaveIntermediateModel(IncrementalContext); } ReportDependency(hostServices); IncrementalContext.UpdateBuildVersionInfoPerDependencyGraph(); Logger.UnregisterListener(CurrentBuildMessageInfo.GetListener()); }