Search in sources :

Example 1 with PigContext

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

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

the class ResolveOnlyRepositoryTest method mockPigContextAndMethods.

private void mockPigContextAndMethods() {
    PigContext pigContext = Mockito.mock(PigContext.class);
    doReturn(false).when(pigContext).isTempBuild();
    MockedStatic<PigContext> pigContextMockedStatic = Mockito.mockStatic(PigContext.class);
    pigContextMockedStatic.when(PigContext::get).thenReturn(pigContext);
}
Also used : PigContext(org.jboss.pnc.bacon.pig.impl.PigContext)

Example 3 with PigContext

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

the class PigFacade method generateJavadoc.

public static void generateJavadoc() {
    abortIfContextDataAbsent();
    PigContext context = context();
    context.getDeliverables().setJavadocZipName(context.getPrefix() + "-javadoc.zip");
    PigConfiguration pigConfiguration = context.getPigConfiguration();
    Map<String, PncBuild> builds = context.getBuilds();
    new JavadocManager(pigConfiguration, context.getReleasePath(), context.getDeliverables(), builds).prepare();
}
Also used : JavadocManager(org.jboss.pnc.bacon.pig.impl.javadoc.JavadocManager) 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)

Example 4 with PigContext

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

the class PigFacade method generateNvrList.

/**
 * Generate the nvr list from the information gathered during repository generation. If the latter was ignored, then
 * nothing happens
 */
private static void generateNvrList() {
    PigContext context = PigContext.get();
    Map<String, Collection<String>> checksums = context.getChecksums();
    if (checksums == null) {
        // checksums populated only when repository generation is switched on
        log.warn("No nvr list generated since repository generation may have been ignored");
    } else {
        Path targetPath = Paths.get(context.getReleasePath()).resolve(context.getDeliverables().getNvrListName()).toAbsolutePath();
        NvrListGenerator.generateNvrList(checksums, targetPath);
    }
}
Also used : Path(java.nio.file.Path) Collection(java.util.Collection) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext)

Example 5 with PigContext

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

the class PigFacade method release.

public static PigReleaseOutput release() {
    abortIfBuildDataAbsentFromContext();
    pushToBrew(false);
    // if repository data not present, skip generation of nvr list and upload script
    if (context().getRepositoryData() == null) {
        log.info("Skipping generation of nvr list and upload script since repository has not been generated");
        return new PigReleaseOutput("", "", "");
    }
    generateNvrList();
    // generate upload to candidates script
    ScriptGenerator scriptGenerator = new ScriptGenerator(context().getPigConfiguration());
    scriptGenerator.generateReleaseScripts(Paths.get(context().getTargetPath()));
    PigContext context = PigContext.get();
    return new PigReleaseOutput(context.getReleaseDirName(), context.getReleasePath(), context.getDeliverables().getNvrListName());
}
Also used : ScriptGenerator(org.jboss.pnc.bacon.pig.impl.script.ScriptGenerator) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) PigReleaseOutput(org.jboss.pnc.bacon.pig.impl.out.PigReleaseOutput)

Aggregations

PigContext (org.jboss.pnc.bacon.pig.impl.PigContext)9 RepositoryData (org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)5 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)4 File (java.io.File)3 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)3 Path (java.nio.file.Path)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Config (org.jboss.pnc.bacon.config.Config)1 ConfigProfile (org.jboss.pnc.bacon.config.ConfigProfile)1 DaConfig (org.jboss.pnc.bacon.config.DaConfig)1 PigConfig (org.jboss.pnc.bacon.config.PigConfig)1 Flow (org.jboss.pnc.bacon.pig.impl.config.Flow)1 GroupBuildInfo (org.jboss.pnc.bacon.pig.impl.config.GroupBuildInfo)1 RepoGenerationData (org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)1 Deliverables (org.jboss.pnc.bacon.pig.impl.documents.Deliverables)1 JavadocManager (org.jboss.pnc.bacon.pig.impl.javadoc.JavadocManager)1 LicenseManager (org.jboss.pnc.bacon.pig.impl.license.LicenseManager)1 PigReleaseOutput (org.jboss.pnc.bacon.pig.impl.out.PigReleaseOutput)1