void OnSolutionConfiguration(object sender, SolutionConfigurationEventArgs e) { // These values are not build secrets. They are required by ApplySettings to configure // the NuGet.config file: once done, restore can be made and having these keys available // as environement variables will not help. var creds = e.Solution.ArtifactSources.OfType <INuGetFeed>() .Where(s => s.Credentials != null && s.Credentials.IsSecretKeyName) .Select(s => s.Credentials.PasswordOrSecretKeyName); foreach (var c in creds) { _secretStore.DeclareSecretKey(c, current => current?.Description ?? "Needed to configure NuGet.config file."); } }
void OnSolutionConfiguration(object sender, SolutionConfigurationEventArgs e) { bool targetCKSetup = e.Solution.GeneratedArtifacts.Any(a => a.Artifact.Type == CKSetupClient.CKSetupType); var stores = e.Solution.ArtifactTargets.OfType <CKSetupStore>().ToList(); if (!targetCKSetup && stores.Any()) { e.Monitor.Info($"Removing {stores.Select( s => s.UniqueRepositoryName ).Concatenate()} since no CKSetup artifacts are produced."); foreach (var t in stores) { e.Solution.RemoveArtifactTarget(t); } } }
void OnSolutionConfiguration(object sender, SolutionConfigurationEventArgs e) { if (!ReadNPMProjects(e.Monitor)) { e.PreventSolutionUse("NPM project error."); return; } if (!ReadAngularWorkspace(e.Monitor)) { e.PreventSolutionUse("NPM project error inside an Angular Workspace."); } bool somePublished = false; //Dependency model stuff: ensuring project, adding generated artifacts and synchronize the package references. foreach (var p in AllNpmProjects) { var(project, isNew) = e.Solution.AddOrFindProject(p.Specification.Folder, "js", p.PackageJson.SafeName); p.Associate(project); if (isNew) { if (p.PackageJson.IsPublished) //add generated artifact if needed. { project.AddGeneratedArtifacts(new Artifact(NPMClient.NPMType, p.PackageJson.Name)); somePublished = true; } } p.SynchronizePackageReferences(e.Monitor); } foreach (var p in AllNpmProjects) { if (!p.SynchronizeProjectReferences(e.Monitor)) //Project reference { e.PreventSolutionUse("NPM project path relative error."); } } if (!AllNpmProjects.Any()) { var sources = e.Solution.ArtifactSources.Where(s => s.ArtifactType == NPMClient.NPMType).ToList(); if (sources.Count > 0) { e.Monitor.Info($"Removing sources: {sources.Select( t => t.TypedName ).Concatenate()} since there is no NPM projetcs."); foreach (var s in sources) { e.Solution.RemoveArtifactSource(s); } } } if (!somePublished) { var targets = e.Solution.ArtifactTargets.Where(t => t.HandleArtifactType(NPMClient.NPMType)).ToList(); if (targets.Count > 0) { e.Monitor.Info($"Removing targets: {targets.Select( t => t.UniqueRepositoryName ).Concatenate()} since no published NPM projetcs exist."); foreach (var t in targets) { e.Solution.RemoveArtifactTarget(t); } } } }