use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.
the class RepoManager method download.
private File download() {
PncBuild build = getBuild(generationData.getSourceBuild());
File downloadedZip = new File(workDir, "downloaded.zip");
build.downloadArtifact(generationData.getSourceArtifact(), downloadedZip);
File extractedZip = unzip(downloadedZip);
return getTopLevelDirectory(extractedZip);
}
use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.
the class RepoManager method addAdditionalArtifacts.
private void addAdditionalArtifacts() {
List<AdditionalArtifactsFromBuild> artifactList = generationData.getAdditionalArtifacts();
artifactList.forEach(artifacts -> {
PncBuild build = getBuild(artifacts.getFrom());
artifacts.getDownload().forEach(regex -> downloadArtifact(build.findArtifact(regex)));
});
generationData.getExternalAdditionalArtifacts().stream().map(GAV::fromColonSeparatedGAPV).forEach(this::downloadExternalArtifact);
}
use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.
the class RepoManager method collectRedhatVersions.
public Map<Artifact, String> collectRedhatVersions(List<Artifact> extensionArtifacts) {
Map<Artifact, String> result = new HashMap<>();
builds.forEach((key, pncBuild) -> {
if (pncBuild.getBuiltArtifacts() != null) {
pncBuild.getBuiltArtifacts().forEach((artifactWrapper -> {
extensionArtifacts.forEach((extensionArtifact -> {
GAV gav = artifactWrapper.toGAV();
if (extensionArtifact.getGroupId().equals(gav.getGroupId()) && extensionArtifact.getArtifactId().equals(gav.getArtifactId())) {
result.put(extensionArtifact, gav.getVersion());
}
}));
}));
}
if (pncBuild.getDependencyArtifacts() != null) {
pncBuild.getDependencyArtifacts().forEach((artifactWrapper -> {
extensionArtifacts.forEach((extensionArtifact -> {
GAV gav = artifactWrapper.toGAV();
if (extensionArtifact.getGroupId().equals(gav.getGroupId()) && extensionArtifact.getArtifactId().equals(gav.getArtifactId())) {
result.put(extensionArtifact, gav.getVersion());
}
}));
}));
}
});
return result;
}
use of org.jboss.pnc.bacon.pig.impl.pnc.PncBuild in project bacon by project-ncl.
the class RepoManager method generate.
public RepositoryData generate() {
log.info("Generating maven repository");
PncBuild build = getBuild(generationData.getSourceBuild());
File bomDirectory = FileUtils.mkTempDir("repo-from-bom-generation");
RepoBuilder repoBuilder = new RepoBuilder(pigConfiguration, generationData.getAdditionalRepo(), configurationDirectory, builds, removeGeneratedM2Dups);
File bomFile = new File(bomDirectory, "bom.pom");
build.downloadArtifact(generationData.getSourceArtifact(), bomFile);
String topLevelDirectoryName = pigConfiguration.getTopLevelDirectoryPrefix() + "maven-repository";
File repoWorkDir = FileUtils.mkTempDir("repository");
File repoParentDir = new File(repoWorkDir, topLevelDirectoryName);
List<Map<String, String>> stages = generationData.getStages();
if (stages != null) {
stages.forEach(stage -> repoBuilder.build(bomFile, repoParentDir, predicate(stage)));
} else {
repoBuilder.build(bomFile, repoParentDir, gav -> true);
}
return repackage(new File(repoParentDir, "maven-repository"));
}
Aggregations