Search in sources :

Example 1 with RepositoryData

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

the class QuarkusCommunityDepAnalyzerTest method test.

@Test
@Disabled
void test() {
    File tempFolder = Files.newTemporaryFolder();
    System.out.println(tempFolder.getAbsolutePath());
    File extras = new File(tempFolder, "extras");
    extras.mkdir();
    RepositoryData repositoryData = new RepositoryData();
    repositoryData.setRepositoryPath(Paths.get(REPO_ZIP_PATH));
    PigContext context = new PigContext();
    PigConfiguration pigConfig = new PigConfiguration();
    Flow flow = new Flow();
    RepoGenerationData repositoryGeneration = new RepoGenerationData();
    repositoryGeneration.setBomArtifactId("quarkus-bom");
    flow.setRepositoryGeneration(repositoryGeneration);
    pigConfig.setFlow(flow);
    Map<String, Map<String, ?>> addons = new HashMap<>();
    Map<String, Object> depAnalyzerConfig = new HashMap<>();
    depAnalyzerConfig.put("skippedExtensions", asList("quarkus-resteasy-reactive-kotlin", "quarkus-mongodb-client"));
    addons.put(QuarkusCommunityDepAnalyzer.NAME, depAnalyzerConfig);
    pigConfig.setAddons(addons);
    context.setPigConfiguration(pigConfig);
    context.setRepositoryData(repositoryData);
    PigContext.setInstance(context);
    Config instance = new Config();
    ConfigProfile configProfile = new ConfigProfile();
    PigConfig pig = new PigConfig();
    pig.setIndyUrl(INDY_URL);
    configProfile.setPig(pig);
    DaConfig da = new DaConfig();
    da.setUrl(DA_URL);
    configProfile.setDa(da);
    instance.setActiveProfile(configProfile);
    Config.setInstance(instance);
    QuarkusCommunityDepAnalyzer analyzer = new QuarkusCommunityDepAnalyzer(pigConfig, Collections.emptyMap(), tempFolder.getAbsolutePath(), extras.getAbsolutePath(), new Deliverables());
    analyzer.trigger();
}
Also used : HashMap(java.util.HashMap) PigConfig(org.jboss.pnc.bacon.config.PigConfig) DaConfig(org.jboss.pnc.bacon.config.DaConfig) Config(org.jboss.pnc.bacon.config.Config) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) ConfigProfile(org.jboss.pnc.bacon.config.ConfigProfile) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData) Flow(org.jboss.pnc.bacon.pig.impl.config.Flow) DaConfig(org.jboss.pnc.bacon.config.DaConfig) Deliverables(org.jboss.pnc.bacon.pig.impl.documents.Deliverables) PigConfig(org.jboss.pnc.bacon.config.PigConfig) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) File(java.io.File) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with RepositoryData

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

the class PigFacade method generateLicenses.

public static void generateLicenses(boolean strict) {
    abortIfContextDataAbsent();
    PigContext context = context();
    context.getDeliverables().setLicenseZipName(context.getPrefix() + "-license.zip");
    PigConfiguration pigConfiguration = context.getPigConfiguration();
    RepositoryData repo = context.getRepositoryData();
    Map<String, PncBuild> builds = context.getBuilds();
    new LicenseManager(pigConfiguration, context.getReleasePath(), strict, context.getDeliverables(), builds, repo).prepare();
}
Also used : PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) LicenseManager(org.jboss.pnc.bacon.pig.impl.license.LicenseManager) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)

Example 3 with RepositoryData

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

the class PigFacade method parseRepository.

private static RepositoryData parseRepository(File repositoryZipPath) {
    File extracted = FileUtils.mkTempDir("extractedRepo");
    FileUtils.unzip(repositoryZipPath, extracted);
    RepositoryData result = new RepositoryData();
    result.setFiles(RepoDescriptor.listFiles(extracted));
    result.setGavs(RepoDescriptor.listGavs(extracted));
    result.setRepositoryPath(repositoryZipPath.toPath());
    return result;
}
Also used : File(java.io.File) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)

Example 4 with RepositoryData

use of org.jboss.pnc.bacon.pig.impl.repo.RepositoryData 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)

Example 5 with RepositoryData

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

the class PigFacade method generateSources.

public static void generateSources() {
    abortIfContextDataAbsent();
    PigContext context = context();
    context.getDeliverables().setSourceZipName(context.getPrefix() + "-src.zip");
    PigConfiguration pigConfiguration = context.getPigConfiguration();
    Map<String, PncBuild> builds = context.getBuilds();
    RepositoryData repo = context.getRepositoryData();
    SourcesGenerator sourcesGenerator = new SourcesGenerator(pigConfiguration.getFlow().getSourcesGeneration(), pigConfiguration.getTopLevelDirectoryPrefix() + "src", context.getReleasePath() + context.getDeliverables().getSourceZipName());
    sourcesGenerator.generateSources(builds, repo);
}
Also used : SourcesGenerator(org.jboss.pnc.bacon.pig.impl.sources.SourcesGenerator) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)

Aggregations

RepositoryData (org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)8 File (java.io.File)6 PigContext (org.jboss.pnc.bacon.pig.impl.PigContext)5 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)4 Map (java.util.Map)3 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)3 Maps (com.google.common.collect.Maps)2 KojiArchiveInfo (com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo)2 KojiBuildInfo (com.redhat.red.build.koji.model.xmlrpc.KojiBuildInfo)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 URI (java.net.URI)2 Files (java.nio.file.Files)2 Collection (java.util.Collection)2 List (java.util.List)2 Optional (java.util.Optional)2 Predicate (java.util.function.Predicate)2 Collectors (java.util.stream.Collectors)2 Stream (java.util.stream.Stream)2 Response (javax.ws.rs.core.Response)2