Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "22" in outputs.version for EA java versions rather than a hashcode #65

Open
vlsi opened this issue Nov 27, 2023 · 1 comment
Open

Comments

@vlsi
Copy link

vlsi commented Nov 27, 2023

Currently, outputs.version is somewhat useless since it results in hashcode of the URI:

Run oracle-actions/setup-java@7a0114d66dbd02646abd345c3395b34c148e6126
  with:
    website: jdk.java.net
    release: EA
    version: latest
    install: true
  env:
    ACTIONS_STEP_DEBUG: true
    ACTIONS_RUNNER_DEBUG: true
    TZ: America/New_York
    JAVA_HOME: /home/pgjdbc/actions-runner/_work/_tool/Java_Oracle_jdk/17/aarch6[4](https://github.com/pgjdbc/pgjdbc/actions/runs/7004394931/job/19052049332#step:5:4)
    JAVA_HOME_17_AARCH[6](https://github.com/pgjdbc/pgjdbc/actions/runs/7004394931/job/19052049332#step:5:6)4: /home/pgjdbc/actions-runner/_work/_tool/Java_Oracle_jdk/1[7](https://github.com/pgjdbc/pgjdbc/actions/runs/7004394931/job/19052049332#step:5:7)/aarch64
    JAVA_HOME_17_X64: /home/pgjdbc/actions-runner/_work/_tool/Java_Oracle_jdk/17/aarch64

=>

  Java configuration:
    Distribution: jdkfile
    Version: 1604803799
    Path: /home/pgjdbc/actions-runner/_work/_tool/Java_jdkfile_jdk/1604803799/arm64

I guess the culprit is

case "HASH_URI" -> Integer.toString(Math.abs(uri.hashCode()));

Note that Math.abs(Integer.MIN_VALUE) yeilds Integer.MIN_VALUE, so you probably do not want using Math.abs for hash codes.

I suggest using a release version instead, so the users could configure release: ea and then use the actual release (e.g. 22, 23, ...) in their build system configurations.

I can't understand how could I use release: ga with the current action.

@vlsi vlsi changed the title Add output variable with "release" of the downloaded Java Use "22" in outputs.version for EA java versions rather than a hashcode Nov 27, 2023
@vlsi
Copy link
Author

vlsi commented Nov 27, 2023

It might probably make sense to have two output variables:

  • release -- high level release
  • version -- detailed version

It probably makes sense to separate ea => 22; ga => 21 from the list of jdk.java.net-uri.properties. In other words, the current implementation does not provide a way to tell which release stands for ea.

For instance:

releases.ga=21
releases.ea=22
releases.jextract=21
releases.valhalla=21

An alternative option would be parsing filenames. For instance, openjdk-20-valhalla+20-75_windows-x64_bin.zip apparently belongs to Java 20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant