Esempio n. 1
0
 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];
 }
        public static IEnvLocalFeed GetFeed(this IEnvLocalFeedProvider @this, BuildResultType type)
        {
            switch (type)
            {
            case BuildResultType.Local: return(@this.Local);

            case BuildResultType.CI: return(@this.CI);

            case BuildResultType.Release: return(@this.Release);
            }
            return(null);
        }
Esempio n. 3
0
 public XNuGetClient(
     HttpClient sharedHttpClient,
     SecretKeyStore secretKeyStore,
     ArtifactCenter artifact,
     IEnvLocalFeedProvider localFeedProvider,
     FileSystem fs,
     Initializer initializer)
     : base(initializer)
 {
     _nuGetClient = new NuGetClient(sharedHttpClient, secretKeyStore);
     localFeedProvider.Register(new EnvLocalFeedProviderNuGetHandler());
     fs.ServiceContainer.Add(_nuGetClient);
     artifact.Register(_nuGetClient);
     initializer.Services.Add(this);
 }
Esempio n. 4
0
 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>();
 }
Esempio n. 5
0
 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];
 }
Esempio n. 6
0
 public NugetConfigFile(GitFolder f, SolutionDriver driver, IEnvLocalFeedProvider localFeedProvider, SecretKeyStore secretStore, SolutionSpec s, NormalizedPath branchPath)
     : base(f, branchPath, branchPath.AppendPart("NuGet.config"), null)
 {
     _localFeedProvider = localFeedProvider;
     _solutionSpec      = s;
     _solutionDriver    = driver;
     _secretStore       = secretStore;
     if (IsOnLocalBranch)
     {
         f.OnLocalBranchEntered += OnLocalBranchEntered;
         f.OnLocalBranchLeaving += OnLocalBranchLeaving;
     }
     _solutionDriver.OnStartBuild            += OnStartBuild;
     _solutionDriver.OnZeroBuildProject      += OnZeroBuildProject;
     _solutionDriver.OnSolutionConfiguration += OnSolutionConfiguration;
 }
Esempio n. 7
0
 public static string GetCKSetupStorePath(this IEnvLocalFeedProvider @this, IActivityMonitor m, BuildType buildType)
 {
     if ((buildType & BuildType.IsTargetLocal) != 0)
     {
         return(@this.Local.GetCKSetupStorePath());
     }
     if ((buildType & BuildType.IsTargetCI) != 0)
     {
         return(@this.CI.GetCKSetupStorePath());
     }
     if ((buildType & BuildType.IsTargetRelease) != 0)
     {
         return(@this.Release.GetCKSetupStorePath());
     }
     throw new ArgumentException(nameof(BuildType));
 }
Esempio n. 8
0
 /// <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);
     }
 }
 public static NormalizedPath GetZeroVersionCodeCakeBuilderExecutablePath(this IEnvLocalFeedProvider local, string solutionName)
 {
     return(local.ZeroBuild.PhysicalPath.AppendPart("Builders").AppendPart(solutionName).AppendPart("CodeCakeBuilder.dll"));
 }
Esempio n. 10
0
        /// <summary>
        /// Checks whether a package exists in the NuGet cache folder.
        /// </summary>
        /// <param name="m">The monitor to use.</param>
        /// <param name="packageId">The package identifier.</param>
        /// <param name="version">The package's version.</param>
        /// <returns>True if found, false otherwise.</returns>
        public static bool ExistsInNuGetCache(this IEnvLocalFeedProvider @this, IActivityMonitor m, string packageId, SVersion version)
        {
            var dirPath = _localNuGetCache.AppendPart(packageId).AppendPart(version.ToNormalizedString());

            return(System.IO.Directory.Exists(dirPath));
        }
Esempio n. 11
0
 /// <summary>
 /// Removes a specific version of a package from the local
 /// NuGet cache.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <param name="packageId">The package identifier.</param>
 /// <param name="version">The package's version.</param>
 public static void RemoveFromNuGetCache(this IEnvLocalFeedProvider @this, IActivityMonitor m, string packageId, SVersion version)
 {
     DoRemoveFromNuGetCache(m, packageId, version);
 }