From 497463f14fb162493700625b74c997d7db6859c4 Mon Sep 17 00:00:00 2001 From: David Walluck Date: Tue, 17 Dec 2024 13:07:11 -0500 Subject: [PATCH] Add support for Windows artifacts from Brew --- pom.xml | 22 ++++++++++--- .../model/FinderResultCreator.java | 33 ++++++++++++++----- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index dcf77b15..5d726254 100644 --- a/pom.xml +++ b/pom.xml @@ -98,9 +98,10 @@ 3.2.1 2.18.0 0.1.0 - 3.1.2 - 2.6.0 + 2.6.1-SNAPSHOT 1.0.6 + 3.0.4 + 3.0.6-SNAPSHOT 2.3.0 1.7.0 3.10.0 @@ -130,19 +131,30 @@ org.jboss.pnc dto - ${version.org.jboss.pnc} + ${version.org.jboss.pnc.pnc} jakarta org.jboss.pnc dto - ${version.org.jboss.pnc} + ${version.org.jboss.pnc.pnc} patch-builders-jakarta + + org.jboss.pnc + pnc-api + ${version.org.jboss.pnc.pnc-api} + + + org.jboss.pnc + pnc-api + ${version.org.jboss.pnc.pnc-api} + jakarta + org.jboss.pnc rest-client-jakarta - ${version.org.jboss.pnc} + ${version.org.jboss.pnc.pnc} org.jboss.pnc.build.finder diff --git a/src/main/java/org/jboss/pnc/deliverablesanalyzer/model/FinderResultCreator.java b/src/main/java/org/jboss/pnc/deliverablesanalyzer/model/FinderResultCreator.java index cbd2a88d..2b55ac11 100644 --- a/src/main/java/org/jboss/pnc/deliverablesanalyzer/model/FinderResultCreator.java +++ b/src/main/java/org/jboss/pnc/deliverablesanalyzer/model/FinderResultCreator.java @@ -17,10 +17,6 @@ import static org.jboss.pnc.api.deliverablesanalyzer.dto.Artifact.ArtifactBuilder; import static org.jboss.pnc.build.finder.core.BuildFinderUtils.isBuildIdZero; -import static org.jboss.pnc.build.finder.pnc.client.PncUtils.GRADLE; -import static org.jboss.pnc.build.finder.pnc.client.PncUtils.MAVEN; -import static org.jboss.pnc.build.finder.pnc.client.PncUtils.NPM; -import static org.jboss.pnc.build.finder.pnc.client.PncUtils.SBT; import java.net.URL; import java.util.ArrayList; @@ -44,6 +40,8 @@ import org.jboss.pnc.api.deliverablesanalyzer.dto.MavenArtifact.MavenArtifactBuilder; import org.jboss.pnc.api.deliverablesanalyzer.dto.NPMArtifact; import org.jboss.pnc.api.deliverablesanalyzer.dto.NPMArtifact.NPMArtifactBuilder; +import org.jboss.pnc.api.deliverablesanalyzer.dto.WindowsArtifact; +import org.jboss.pnc.api.deliverablesanalyzer.dto.WindowsArtifact.WindowsArtifactBuilder; import org.jboss.pnc.api.enums.LicenseSource; import org.jboss.pnc.build.finder.core.BuildSystem; import org.jboss.pnc.build.finder.core.BuildSystemInteger; @@ -54,6 +52,7 @@ import org.slf4j.LoggerFactory; import com.redhat.red.build.koji.model.xmlrpc.KojiArchiveInfo; +import com.redhat.red.build.koji.model.xmlrpc.KojiBtype; import jakarta.ws.rs.BadRequestException; @@ -154,6 +153,14 @@ private static void setCommonArtifactFields(ArtifactBuilder builder, KojiL return NPMArtifact.builder().name(archiveInfo.getArtifactId()).version(archiveInfo.getVersion()); } + private static WindowsArtifactBuilder createWindowsArtifact(KojiArchiveInfo archiveInfo) { + return WindowsArtifact.builder() + .name(archiveInfo.getArtifactId()) + .version(archiveInfo.getVersion()) + .platforms(archiveInfo.getPlatforms()) + .flags(archiveInfo.getFlags()); + } + private static Collection createNotFoundArtifacts(KojiLocalArchive localArchive) { Collection artifacts = new ArrayList<>(); @@ -233,14 +240,22 @@ private static Build createBuild( private static Artifact createArtifact(KojiLocalArchive localArchive, BuildSystem buildSystem, boolean imported) { KojiArchiveInfo archiveInfo = localArchive.getArchive(); - String buildType = archiveInfo.getBuildType(); + KojiBtype buildType = archiveInfo.getBuildType(); ArtifactBuilder builder; switch (buildType) { - case GRADLE, MAVEN, SBT -> builder = createMavenArtifact(archiveInfo); - case NPM -> builder = createNpmArtifact(archiveInfo); - default -> throw new BadRequestException( - "Archive " + archiveInfo.getArtifactId() + " had unhandled artifact type: " + buildType); + case maven: + builder = createMavenArtifact(archiveInfo); + break; + case npm: + builder = createNpmArtifact(archiveInfo); + break; + case win: + builder = createWindowsArtifact(archiveInfo); + break; + default: + throw new BadRequestException( + "Unhandled build type " + buildType + " for local archive " + localArchive); } switch (buildSystem) {