Search in sources :

Example 11 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class JavadocManager method init.

private void init() {
    this.temporaryDestination = FileUtils.mkTempDir("javadoc");
    this.settingsXml = Indy.getConfiguredIndySettingsXmlPath(this.tempBuild);
    this.localRepo = new File(temporaryDestination + File.separator + "localRepo");
    this.localRepo.mkdir();
    this.topLevelDirectory = new File(temporaryDestination, getTargetTopLevelDirectoryName());
    this.archiveFile = getTargetZipPath().toFile();
    this.generationProject = generationData.getGenerationProject();
    this.sourceBuilds = generationData.getSourceBuilds();
    if (this.sourceBuilds == null || this.sourceBuilds.isEmpty()) {
        this.sourceBuilds = builds.values().stream().map(PncBuild::getName).collect(Collectors.toList());
    }
    this.scmRevision = generationData.getScmRevision();
}
Also used : File(java.io.File) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)

Example 12 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class BomVerifierAddon method getDependencyGavs.

protected Stream<GAV> getDependencyGavs() {
    PncBuild build = builds.get(pigConfiguration.getFlow().getRepositoryGeneration().getSourceBuild());
    File bom = new File("bom");
    build.findArtifactByFileName(pigConfiguration.getFlow().getRepositoryGeneration().getSourceArtifact()).downloadTo(bom);
    List<Node> nodeList = listNodes(bom, "//dependencies/dependency");
    Map<String, String> properties = XmlUtils.getProperties(bom);
    return nodeList.stream().map(node -> GAV.fromXml((Element) node, properties));
}
Also used : Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) File(java.io.File)

Example 13 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class NotYetAlignedFromDependencyTree method trigger.

@Override
public void trigger() {
    String filename = extrasPath + "DependencyTreeMissingAlignment.txt";
    log.info("Running NotYetAlignedFromDependencyTree - report is {}", filename);
    try (PrintWriter file = new PrintWriter(filename, StandardCharsets.UTF_8.name())) {
        for (PncBuild build : builds.values()) {
            // Make a unique list so we don't get multiples from
            // sub-module's dependency tree list
            List<String> bcLog = build.getBuildLog().stream().distinct().collect(Collectors.toList());
            file.print("-------- [" + build.getId() + "] " + build.getName() + " --------\n");
            for (String bcLine : bcLog) {
                if (bcLine.startsWith("[INFO] +") && (bcLine.endsWith(":runtime") || bcLine.endsWith(":compile")) && !bcLine.contains("redhat-")) {
                    file.print(bcLine + "\n");
                }
            }
            file.print("\n");
        }
    } catch (FileNotFoundException | UnsupportedEncodingException e) {
        log.error("Error while creating NotYetAlignedFromDependencyTree report", e);
    }
}
Also used : FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) PrintWriter(java.io.PrintWriter)

Example 14 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class DeliverableManager method downloadAndRepackage.

protected ResultType downloadAndRepackage() {
    PncBuild build = getBuild(getGenerationData().getSourceBuild());
    File downloadedZip = new File(workDir, "downloaded.zip");
    build.downloadArtifact(getGenerationData().getSourceArtifact(), downloadedZip);
    File extractedZip = unzip(downloadedZip);
    File downloadedTopLevelDirectory = getTopLevelDirectory(extractedZip);
    File targetTopLevelDirectory = new File(workDir, getTargetTopLevelDirectoryName());
    targetTopLevelDirectory.mkdirs();
    repackage(downloadedTopLevelDirectory, targetTopLevelDirectory);
    zip(targetTopLevelDirectory, getTargetZipPath());
    return null;
}
Also used : PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) File(java.io.File)

Example 15 with PncBuild

use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.

the class EmptyProjectBuildTest method shouldReturnPreviousBuildsOnRebuild.

@Test
void shouldReturnPreviousBuildsOnRebuild(@TempDir Path targetDir) {
    String suffix = init(Paths.get("src", "test", "resources", "empty"), true, Optional.empty(), targetDir);
    PigFacade.configure(true, false);
    GroupBuildInfo build = PigFacade.build(false, false, RebuildMode.EXPLICIT_DEPENDENCY_CHECK, true, false);
    Map<String, PncBuild> builds = build.getBuilds();
    assertThat(builds).isNotEmpty();
    assertThat(builds.keySet()).contains(format(emptyNameBase1, suffix), format(emptyNameBase2, suffix));
    assertThat(builds.values().stream()).allMatch(b -> b.getBuildStatus() == BuildStatus.SUCCESS);
    List<String> successfulBuilds = buildIds(build);
    GroupBuildInfo rebuild = PigFacade.build(false, false, RebuildMode.EXPLICIT_DEPENDENCY_CHECK, true, false);
    assertThat(buildIds(rebuild)).containsAll(successfulBuilds);
}
Also used : GroupBuildInfo(org.jboss.pnc.bacon.pig.impl.config.GroupBuildInfo) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) Test(org.junit.jupiter.api.Test)

Aggregations

PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)29 File (java.io.File)10 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)8 ArtifactWrapper (org.jboss.pnc.bacon.pig.impl.pnc.ArtifactWrapper)8 GAV (org.jboss.pnc.bacon.pig.impl.utils.GAV)8 Map (java.util.Map)7 Path (java.nio.file.Path)5 ArrayList (java.util.ArrayList)5 Collectors (java.util.stream.Collectors)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 FileNotFoundException (java.io.FileNotFoundException)4 PrintWriter (java.io.PrintWriter)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 FatalException (org.jboss.pnc.bacon.common.exception.FatalException)4 RepoGenerationData (org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)4 BuildInfoCollector (org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector)4