Search in sources :

Example 1 with ImportResult

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

the class EmptyProjectBuildTest method shouldConfigureEmptyProject.

@Test
void shouldConfigureEmptyProject(@TempDir Path targetDir) {
    String suffix = init(Paths.get("src", "test", "resources", "empty"), true, Optional.empty(), targetDir);
    ImportResult importResult = PigFacade.configure(true, false);
    assertThat(importResult.getBuildGroup().getId()).isNotNull();
    assertThat(importResult.getBuildConfigs()).hasSize(2);
    assertThat(importResult.getBuildConfigs().stream().map(BuildConfigData::getName)).contains(format(emptyNameBase1, suffix), format(emptyNameBase2, suffix));
}
Also used : ImportResult(org.jboss.pnc.bacon.pig.impl.pnc.ImportResult) BuildConfigData(org.jboss.pnc.bacon.pig.impl.pnc.BuildConfigData) Test(org.junit.jupiter.api.Test)

Example 2 with ImportResult

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

the class PigFacade method cancel.

public static String cancel() {
    ImportResult importResult = context().getPncImportResult();
    if (importResult == null) {
        importResult = readPncEntities();
    }
    PncBuilder builder = new PncBuilder();
    return builder.cancelRunningGroupBuild(importResult.getBuildGroup().getId());
}
Also used : ImportResult(org.jboss.pnc.bacon.pig.impl.pnc.ImportResult) PncBuilder(org.jboss.pnc.bacon.pig.impl.pnc.PncBuilder)

Example 3 with ImportResult

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

the class PigFacade method build.

public static GroupBuildInfo build(boolean tempBuild, boolean tempBuildTS, RebuildMode rebuildMode, boolean wait, boolean dryRun) {
    ImportResult importResult = context().getPncImportResult();
    if (importResult == null) {
        importResult = readPncEntities();
    }
    if (tempBuild) {
        log.info("Temporary build");
    }
    try (PncBuilder pncBuilder = new PncBuilder()) {
        GroupBuild groupBuild = pncBuilder.build(importResult.getBuildGroup(), tempBuild, tempBuildTS, rebuildMode, wait, dryRun);
        if (wait) {
            try (BuildInfoCollector buildInfoCollector = new BuildInfoCollector()) {
                return buildInfoCollector.getBuildsFromGroupBuild(groupBuild);
            }
        }
        log.info("Not waiting for build to finish.");
        return null;
    }
}
Also used : ImportResult(org.jboss.pnc.bacon.pig.impl.pnc.ImportResult) BuildInfoCollector(org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector) GroupBuild(org.jboss.pnc.dto.GroupBuild) PncBuilder(org.jboss.pnc.bacon.pig.impl.pnc.PncBuilder)

Example 4 with ImportResult

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

the class PigFacade method run.

public static GroupBuildInfo run(boolean skipPncUpdate, boolean skipBuilds, boolean skipSources, boolean skipJavadoc, boolean skipLicenses, boolean skipSharedContent, boolean removeGeneratedM2Dups, String repoZipPath, boolean tempBuild, boolean dryRun, boolean tempBuildTS, RebuildMode rebuildMode, boolean skipBranchCheck, boolean strictLicenseCheck, boolean strictDownloadSource, Path configurationDirectory) {
    PigContext context = context();
    ImportResult importResult;
    if (skipPncUpdate) {
        importResult = readPncEntities();
    } else {
        importResult = configure(skipBranchCheck, tempBuild);
    }
    context.setPncImportResult(importResult);
    context.storeContext();
    GroupBuildInfo groupBuildInfo;
    if (skipBuilds) {
        log.info("Skipping builds");
        groupBuildInfo = getBuilds(importResult, tempBuild);
    } else {
        groupBuildInfo = build(tempBuild, tempBuildTS, rebuildMode, true, dryRun);
    }
    context.setBuilds(groupBuildInfo.getBuilds());
    context.storeContext();
    // TODO: there seems to be a gap between the build configs assigned to the product version
    // TODO: and build group
    // TODO: It is possible that someone adds a build config to the product version but not to the build group
    // TODO: should we bother with this case?
    RepositoryData repo = null;
    if (repoZipPath != null || context.getPigConfiguration().getFlow().getRepositoryGeneration().getStrategy() != RepoGenerationStrategy.IGNORE) {
        if (repoZipPath != null) {
            repo = parseRepository(new File(repoZipPath));
        } else {
            repo = generateRepo(removeGeneratedM2Dups, configurationDirectory, strictLicenseCheck, strictDownloadSource);
        }
        context.setRepositoryData(repo);
        context.storeContext();
    } else {
        log.info("Skipping Repo Generation");
    }
    if (!(skipSources || context().getPigConfiguration().getFlow().getSourcesGeneration().getStrategy() == SourcesGenerationStrategy.IGNORE)) {
        generateSources();
    } else {
        log.info("Skipping Source Generation");
        context.getDeliverables().setSourceZipName(null);
    }
    if (!(skipJavadoc || context.getPigConfiguration().getFlow().getJavadocGeneration().getStrategy() == JavadocGenerationStrategy.IGNORE)) {
        generateJavadoc();
    } else {
        log.info("Skipping Javadoc Generation");
        context.getDeliverables().setJavadocZipName(null);
    }
    if (!(skipLicenses || context.getPigConfiguration().getFlow().getLicensesGeneration().getStrategy() == LicenseGenerationStrategy.IGNORE)) {
        generateLicenses(strictLicenseCheck);
    } else {
        log.info("Skipping License Generation");
        context.getDeliverables().setLicenseZipName(null);
    }
    if (!skipSharedContent && repo != null) {
        prepareSharedContentAnalysis();
    }
    triggerAddOns();
    if (repo != null) {
        generateDocuments();
    } else {
        log.info("Skipping Document Generation");
    }
    log.info("PiG run completed, the results are in: {}", Paths.get(context().getTargetPath()).toAbsolutePath());
    return groupBuildInfo;
}
Also used : ImportResult(org.jboss.pnc.bacon.pig.impl.pnc.ImportResult) GroupBuildInfo(org.jboss.pnc.bacon.pig.impl.config.GroupBuildInfo) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) File(java.io.File) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)

Aggregations

ImportResult (org.jboss.pnc.bacon.pig.impl.pnc.ImportResult)4 PncBuilder (org.jboss.pnc.bacon.pig.impl.pnc.PncBuilder)2 File (java.io.File)1 PigContext (org.jboss.pnc.bacon.pig.impl.PigContext)1 GroupBuildInfo (org.jboss.pnc.bacon.pig.impl.config.GroupBuildInfo)1 BuildConfigData (org.jboss.pnc.bacon.pig.impl.pnc.BuildConfigData)1 BuildInfoCollector (org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector)1 RepositoryData (org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)1 GroupBuild (org.jboss.pnc.dto.GroupBuild)1 Test (org.junit.jupiter.api.Test)1