Skip to content

Commit 8a02dcf

Browse files
committed
cosmetics
1 parent 50febee commit 8a02dcf

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/main/java/io/foojay/api/distribution/GraalVM.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private List<Pkg> getAllPkgs(final String query, final ReleaseStatus releaseStat
349349
}
350350
}
351351

352-
public List<Pkg> getAllPkgsFrom17AndAbove(final boolean onlyNewPkgs) {
352+
public List<Pkg> getAllPkgsFrom17AndAbove(final boolean includingEA, final boolean onlyNewPkgs) {
353353
final List<Pkg> pkgs = new ArrayList<>();
354354
final String baseUrl = "https://download.oracle.com/graalvm/";
355355
final List<OperatingSystem> operatingSystems = List.of(OperatingSystem.LINUX, OperatingSystem.MACOS, OperatingSystem.WINDOWS);
@@ -429,15 +429,20 @@ public List<Pkg> getAllPkgsFrom17AndAbove(final boolean onlyNewPkgs) {
429429
});
430430
});
431431
});
432+
433+
if (includingEA) {
434+
pkgs.addAll(getEaBuildsFromGithub());
435+
}
436+
432437
return pkgs;
433438
}
434439

435440
public List<Pkg> getEaBuildsFromGithub() {
441+
LOGGER.error("Fetching ea-pkgs from github");
436442
List<Pkg> pkgsFound = new ArrayList<>();
437443
CacheManager.INSTANCE.getMajorVersions().stream().filter(majorVersion -> majorVersion.getAsInt() > 21).forEach(majorVersion -> {
438444
String jsonFilename = majorVersion.getAsInt() + "-ea.json";
439445
String eaJsonUri = EA_BUILDS_URL + jsonFilename;
440-
System.out.println(eaJsonUri);
441446
try {
442447
HttpResponse<String> response = Helper.get(eaJsonUri);
443448
if (null != response) {
@@ -494,6 +499,7 @@ public List<Pkg> getEaBuildsFromGithub() {
494499
}
495500
}
496501
}
502+
LOGGER.error("Successfully fetched {} ea-pkgs from github", pkgsFound.size());
497503
} catch (Exception e) {
498504
LOGGER.error("Error reading {} file from github. {}", jsonFilename, e.getMessage());
499505
}

src/main/java/io/foojay/api/distribution/LibericaNative.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public class LibericaNative implements Distribution {
194194

195195
public List<Pkg> getAllPkgs(final boolean onlyNewPkgs) {
196196
final List<Pkg> pkgsFound = new ArrayList<>();
197-
final String apiUrl = "https://api.bell-sw.com/v1/nik/releases?bundle-type=standard&components=liberica&fields=bitness,components,os,downloadUrl,LTS,bundleType,packageType,version,filename,size,GA,architecture&components=nik";
197+
final String apiUrl = "https://api.bell-sw.com/v1/nik/releases?bundle-type=standard&bundle-type=full&components=liberica&fields=bitness,components,os,downloadUrl,LTS,bundleType,packageType,version,filename,size,GA,architecture&components=nik";
198198
final Map<String, String> headers = new HashMap<>();
199199
headers.put("accept", "application/json");
200200

@@ -217,9 +217,14 @@ public List<Pkg> getAllPkgs(final boolean onlyNewPkgs) {
217217
pkg.setFPU(FPU.UNKNOWN);
218218
pkg.setDirectlyDownloadable(true);
219219
pkg.setFreeUseInProduction(true);
220-
pkg.setJavaFXBundled(false);
221220
pkg.setPackageType(JDK);
222221

222+
boolean bundleTypeFull = false;
223+
if (pkgJsonObj.has(FIELD_BUNDLE_TYPE)) {
224+
bundleTypeFull = pkgJsonObj.get(FIELD_BUNDLE_TYPE).getAsString().toLowerCase().equals("full");
225+
}
226+
pkg.setJavaFXBundled(bundleTypeFull);
227+
223228
if (pkgJsonObj.has(FIELD_BITNESS)) {
224229
Bitness bitness = Bitness.fromInt(pkgJsonObj.get(FIELD_BITNESS).getAsInt());
225230
if (Bitness.NOT_FOUND == bitness) {
@@ -253,7 +258,7 @@ public List<Pkg> getAllPkgs(final boolean onlyNewPkgs) {
253258
}
254259

255260

256-
String filenameWithoutPreset = filename.replace("bellsoft-liberica-vm-openjdk", "");
261+
String filenameWithoutPreset = filename.replace(bundleTypeFull ? "bellsoft-liberica-vm-full-openjdk": "bellsoft-liberica-vm-openjdk", "");
257262
String[] withoutPresetParts = filenameWithoutPreset.split("-");
258263
if (withoutPresetParts.length == 4) {
259264
MajorVersion jv = new MajorVersion(VersionNumber.fromText(withoutPresetParts[0]).getFeature().getAsInt());

0 commit comments

Comments
 (0)