/// <summary> /// Creates a ZeroBuilder. /// </summary> /// <param name="m">The monitor to use.</param> /// <param name="feeds">The local feeds.</param> /// <param name="depContext">The dependency context to consider.</param> /// <param name="driverFinder">The driver finder by solution name.</param> /// <param name="solutionReloader">Optional solutions reloader.</param> /// <returns>The ZeroBuilder on success, null on error.</returns> static ZeroBuilder Create( IActivityMonitor m, IEnvLocalFeedProvider feeds, IWorldSolutionContext context) { if (context.DependencyContext.BuildProjectsInfo.HasError) { using (m.OpenError("Build Projects dependencies failed to be computed.")) { context.DependencyContext.BuildProjectsInfo.RawBuildProjectsInfoSorterResult.LogError(m); } return(null); } var zeroProjects = context.DependencyContext.BuildProjectsInfo.ZeroBuildProjects; if (zeroProjects.Count == 0) { m.Error(context.DependencyContext.HasError ? "Invalid dependency analysis." : "No Build Project exist."); return(null); } var mustBuild = new HashSet <string>(zeroProjects.Select(p => p.Project.FullFolderPath.Path)); var memPath = feeds.ZeroBuild.PhysicalPath.AppendPart("CacheZeroVersion.txt"); var sha1Cache = System.IO.File.Exists(memPath) ? System.IO.File.ReadAllLines(memPath) .Select(l => l.Split()) .Where(l => mustBuild.Contains(l[0])) .ToDictionary(l => l[0], l => new HashSet <string>(l[1].Split('|'))) : new Dictionary <string, HashSet <string> >(); m.Info($"File '{memPath}' contains {sha1Cache.Count} entries."); var currentShas = new string[zeroProjects.Count]; return(new ZeroBuilder(feeds, memPath, sha1Cache, mustBuild, context)); }
/// <summary> /// Creates a new <see cref="ReleaseRoadmap"/> for a <see cref="IWorldSolutionContext"/>. /// </summary> /// <param name="m">The monitor to use.</param> /// <param name="ctx">The context.</param> /// <returns>Null on error.</returns> public static ReleaseRoadmap Create( IActivityMonitor m, IWorldSolutionContext ctx, XElement previous = null, bool restorePreviousState = true) { if (ctx == null) { throw new ArgumentNullException(nameof(ctx)); } ReleaseSolutionInfo[] infos = new ReleaseSolutionInfo[ctx.Solutions.Count]; foreach (var(s, d) in ctx.Solutions) { var v = d.GitRepository.GetCommitVersionInfo(m); if (v == null) { m.Error($"Unable to get Commit version information for solution {s.Solution}."); return(null); } infos[s.Index] = new ReleaseSolutionInfo(d.GitRepository, s, v, previous? .Elements() .FirstOrDefault(e => (string)e.Attribute("Name") == s.Solution.Name)); } return(new ReleaseRoadmap(ctx, infos)); }
ReleaseRoadmap(IWorldSolutionContext ctx, ReleaseSolutionInfo[] infos) { SolutionContext = ctx; _infos = infos; foreach (var i in infos) { i.Initialize(this); } }
public DevelopBuilder( ZeroBuilder zeroBuilder, ArtifactCenter artifacts, IEnvLocalFeedProvider localFeedProvider, IWorldSolutionContext ctx, bool withUnitTest) : base(zeroBuilder, BuildResultType.CI, artifacts, localFeedProvider, ctx) { _commits = new string[ctx.Solutions.Count]; _withUnitTest = withUnitTest; }
public LocalBuilder( ZeroBuilder zeroBuilder, ArtifactCenter artifacts, IEnvLocalFeedProvider localFeedProvider, IWorldSolutionContext ctx, bool withUnitTest) : base(zeroBuilder, BuildResultType.Local, artifacts, localFeedProvider, ctx) { _withUnitTest = withUnitTest; _commitTimes = new DateTimeOffset[ctx.Solutions.Count]; }
ZeroBuilder( IEnvLocalFeedProvider localFeedProvider, NormalizedPath memPath, Dictionary <string, HashSet <string> > sha1Cache, HashSet <string> initialMustBuild, IWorldSolutionContext ctx) { _localFeedProvider = localFeedProvider; _memPath = memPath; _sha1Cache = sha1Cache; _mustBuild = initialMustBuild; _context = ctx; _currentShas = new string[ctx.DependencyContext.BuildProjectsInfo.ZeroBuildProjects.Count]; _allShas = new HashSet <string>(); }
protected Builder( ZeroBuilder zeroBuilder, BuildResultType type, ArtifactCenter artifacts, IEnvLocalFeedProvider localFeedProvider, IWorldSolutionContext ctx) { ZeroBuilder = zeroBuilder ?? throw new ArgumentNullException(nameof(zeroBuilder)); _type = type; _artifacts = artifacts ?? throw new ArgumentNullException(nameof(artifacts)); _localFeedProvider = localFeedProvider ?? throw new ArgumentNullException(nameof(localFeedProvider)); DependentSolutionContext = ctx ?? throw new ArgumentNullException(nameof(ctx)); _packagesVersion = new Dictionary <Artifact, SVersion>(); _upgrades = new List <UpdatePackageInfo> [ctx.Solutions.Count]; _targetVersions = new SVersion[ctx.Solutions.Count]; }
/// <summary> /// Encapsulates creation, initalization and run of the builds. /// Solutions are soon as version updates have been made. /// </summary> /// <param name="m">The monitor to use.</param> /// <param name="feeds">The local feeds.</param> /// <param name="ctx">The world solution context to consider.</param> /// <returns>The ZeroBuilder on success, null on error.</returns> public static ZeroBuilder EnsureZeroBuildProjects( IActivityMonitor m, IEnvLocalFeedProvider feeds, IWorldSolutionContext ctx, IBasicApplicationLifetime appLife) { using (m.OpenInfo($"Building ZeroVersion projects.")) { var builder = Create(m, feeds, ctx); if (builder == null) { return(null); } bool success = builder.Run(m, appLife, out bool mustReloadSolutions); if (mustReloadSolutions) { ctx.Refresh(m, true); } return(success ? builder : null); } }