Search in sources :

Example 1 with RepoGenerationData

use of org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData 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 RepoGenerationData

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

the class ResolveOnlyRepositoryTest method mockRepoGenerationDataAndMethods.

private RepoGenerationData mockRepoGenerationDataAndMethods() {
    RepoGenerationData generationData = new RepoGenerationData();
    RepoGenerationData generationDataSpy = Mockito.spy(generationData);
    generationDataSpy.setStrategy(RepoGenerationStrategy.RESOLVE_ONLY);
    return generationDataSpy;
}
Also used : RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)

Example 3 with RepoGenerationData

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

the class LicenseManager method generate.

private void generate() {
    log.info("Generating licenses");
    RepoGenerationData repoGen = pigConfiguration.getFlow().getRepositoryGeneration();
    if (repoGen.isIncludeLicenses()) {
        LicenseGenerator.extractLicenses(repositoryData.getRepositoryPath().toFile(), getTargetZipPath().toFile(), getTargetTopLevelDirectoryName());
    } else {
        LicenseGenerator.generateLicenses(repositoryData.getGavs(), getTargetZipPath().toFile(), getTargetTopLevelDirectoryName(), strict);
    }
}
Also used : RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)

Example 4 with RepoGenerationData

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

the class GenerationDataCheckTest method testGenerationDataValidationOnDownload.

/**
 * Test that for when the Generation strategy is DOWNLOAD, that the sourceArtifact and the sourceBuild are also
 * specified
 */
@Test
void testGenerationDataValidationOnDownload() {
    LicenseGenerationData licenseGenerationData = new LicenseGenerationData();
    licenseGenerationData.setStrategy(LicenseGenerationStrategy.DOWNLOAD);
    this.<LicenseGenerationData>testGenerationDataValidationOnDownloadHelper(licenseGenerationData);
    RepoGenerationData repoGenerationData = new RepoGenerationData();
    repoGenerationData.setStrategy(RepoGenerationStrategy.DOWNLOAD);
    this.<RepoGenerationData>testGenerationDataValidationOnDownloadHelper(repoGenerationData);
    JavadocGenerationData javadocGenerationData = new JavadocGenerationData();
    javadocGenerationData.setStrategy(JavadocGenerationStrategy.DOWNLOAD);
    this.<JavadocGenerationData>testGenerationDataValidationOnDownloadHelper(javadocGenerationData);
}
Also used : LicenseGenerationData(org.jboss.pnc.bacon.pig.impl.config.LicenseGenerationData) JavadocGenerationData(org.jboss.pnc.bacon.pig.impl.config.JavadocGenerationData) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) Test(org.junit.jupiter.api.Test)

Example 5 with RepoGenerationData

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

the class OfflineManifestGenerator method sourceBuilds.

private Collection<PncBuild> sourceBuilds() {
    RepoGenerationData generationData = pigConfiguration.getFlow().getRepositoryGeneration();
    RepoGenerationStrategy strategy = generationData.getStrategy();
    if (!Arrays.asList(IGNORE, BUILD_GROUP).contains(strategy)) {
        return builds.values();
    }
    List<String> excludeSourceBuilds = generationData.getExcludeSourceBuilds();
    return builds.values().stream().filter(build -> !excludeSourceBuilds.contains(build.getName())).collect(Collectors.toList());
}
Also used : AddOn(org.jboss.pnc.bacon.pig.impl.addons.AddOn) GAV(org.jboss.pnc.bacon.pig.impl.utils.GAV) Arrays(java.util.Arrays) RepoGenerationStrategy(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy) BuildInfoCollector(org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector) LoggerFactory(org.slf4j.LoggerFactory) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) HashSet(java.util.HashSet) RepositoryType(org.jboss.pnc.enums.RepositoryType) Map(java.util.Map) IGNORE(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy.IGNORE) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) PrintWriter(java.io.PrintWriter) Logger(org.slf4j.Logger) FatalException(org.jboss.pnc.bacon.common.exception.FatalException) Collection(java.util.Collection) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) List(java.util.List) BUILD_GROUP(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy.BUILD_GROUP) Pattern(java.util.regex.Pattern) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ArtifactWrapper(org.jboss.pnc.bacon.pig.impl.pnc.ArtifactWrapper) RepoGenerationStrategy(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationStrategy) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)

Aggregations

RepoGenerationData (org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)6 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)3 Test (org.junit.jupiter.api.Test)3 Map (java.util.Map)2 Deliverables (org.jboss.pnc.bacon.pig.impl.documents.Deliverables)2 BuildInfoCollector (org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector)2 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintWriter (java.io.PrintWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Path (java.nio.file.Path)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1