ScoopInstaller / Java

📦 A bucket for Scoop, for Oracle Java, OpenJDK, Eclipse Temurin, IBM Semeru, Zulu, ojdkbuild, Amazon Corretto, BellSoft Liberica, SapMachine and Microsoft JDK.
https://scoop.sh
The Unlicense
257 stars 88 forks source link

Migrate from Zulu OpenJDK Discovery API to Azul Metadata API #514

Closed ryansuhartanto closed 3 months ago

ryansuhartanto commented 4 months ago

Bug Report

Package Name: zulu*

Current Behaviour

Currently, Azul Zulu packages are using the discovery API (https://api.azul.com/zulu/download/).

Expected Behaviour

Azul Zulu packages should utilize the new metadata API (https://api.azul.com/metadata/v1/)

Additional context/output

In accordance with https://docs.azul.com/core/metadata-api-migration.

Azul now support CRaC on their JDKs beginning on version 17 by default, currently zulu17-jdk and zulu-jdk packages cannot update correctly due to the incorrect regex trying to match the default CRaC (*-ca-crac-*) support.

It's also worth mentioning that the LTS version of 21 is missing from the bucket (#509). Zulu packages beginning from 21 should drop support for 32-bit architecture in accordance with JEP 449.

Possible Solution

We should discuss about making a separate package for the CRaC support.

ryansuhartanto commented 4 months ago

For example, here's the discovery API for the JDK version 17 (added newlines for clarity):

https://api.azul.com/zulu/download/community/v1.0/bundles/latest/\
?jdk_version=17\
&bundle_type=jdk\
&features=\
&javafx=false\
&ext=zip\
&os=windows\
&arch=x86\
&hw_bitness=64

Here's the migrated metadata API after being refactored to have the same order in the swagger docs:

https://api.azul.com/metadata/v1/zulu/packages/\
?java_version=17\
&os=windows\
&arch=x86\
&archive_type=zip\
&java_package_type=jdk\
&javafx_bundled=false\
&crac_supported=false\
&release_type=PSU\
&latest=true\
&page_size=2

Here's the diff after the refactor:

- https://api.azul.com/zulu/download/community/v1.0/bundles/latest/\
+ https://api.azul.com/metadata/v1/zulu/packages/\
- ?jdk_version=17\
+ ?java_version=17\
  &os=windows\
  &arch=x86\
- &ext=zip\
+ &archive_type=zip\
- &javafx=false\
+ &javafx_bundled=false\
+ &crac_supported=false\
+ &release_type=PSU\
+ &latest=true\
+ &page_size=2
- &features=

Note that we added CRaC, release type, and latest parameters.

I removed the feature parameter (java_package_features; being used in zulu*-jre) due to Windows build of JRE is always headfull.

CRaC support has their own docs here https://docs.azul.com/core/crac/crac-introduction,

Release type parameter is, quote from the API:

Filters the result by release type, Critical Patch Update CPU, Patch Set Update PSU, or Limited Update LU.

We use PSU to match latest available versions on the download screen at https://www.azul.com/downloads.

I added latest and page size parameter to only list the first x86 and x64, regardless of CRS support. Page size parameter value should be 1 starting from Java version 21 per JEP 449.

ryansuhartanto commented 4 months ago

~Note that now, the hash for the downloaded file has been separated to a different API request (/zulu/packages/). We need to store the product UUID of both the 32-bit architecture and 64-bit architecture to substitute it on autoupdate.~

Can be included using include_fields parameter.

ryansuhartanto commented 4 months ago

I have researched the documentation about CRaC and CRS support.

CRS (Connected Runtime Service) is not available to 32-bit architecture after October 2023. We can just ignore this since it's just a drop support on the architecture, the official download site lists the latest 32-bit version without the support.

CRaC (Coordinated Restore at Checkpoint) is only available on 64-bit architecture beginning from Zulu version 17.46 and 21.30. I suggests making a separate package for this since it's mutually exclusive with JavaFX to match how they are displayed on their download site.

ryansuhartanto commented 4 months ago

I made a regex to match and substitute the urls here https://regex101.com/r/5ZwIZG/5. Note that the page size parameter is set to 2.