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

Add input to override Java version #34

Closed
sormuras opened this issue Aug 3, 2022 · 2 comments
Closed

Add input to override Java version #34

sormuras opened this issue Aug 3, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sormuras
Copy link
Member

sormuras commented Aug 3, 2022

Add an input named install-as-version to this action enabling an override of the Java version passed to the underlying actions/setup-java action.

Motivation

The underlying actions/setup-java action does NOT allow arbitrary values for its java-version input. It uses it to determine the target directory of to where a jdkFile is extracted to. It also seems to apply a merging logic when it comes to different releases of the same feature release version number: for example, 19, 19.0.0, 19.99.99 and others (including 19.99.99+99-jextract) are treated as 19 was given.

This prevents installations of multiple releases of JDK N.

Proposal:

  install-as-version:
    description: 'Controls which value is passed as `java-version` to `actions/setup-java`'
    default: PARSE_URI
    required: true

Supported values of install-as-version:

This will control/change the output named version of this action.

@sormuras
Copy link
Member Author

sormuras commented Aug 4, 2022

Usage example with relying on defaults:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:

    - name: 'Set up jextract'
      uses: oracle-actions/setup-java@issues/34/add-install-as-version-input
      with:
        website: jdk.java.net
        release: jextract
    
    - name: 'Set up Java 19'
      uses: oracle-actions/setup-java@issues/34/add-install-as-version-input
      with:
        website: jdk.java.net
        release: 19

    - name: 'Print JAVA_HOME and its version information'
      run: |
        echo "JAVA_HOME=$JAVA_HOME"
        java --version
    - name: 'Print help message of jextract'
      run: jextract --help
  • If release input does NOT starts with a digit, install-as-version defaults to HASH_URI
  • If release input starts with a digit, install-as-version defaults to PARSE_URI

sormuras added a commit that referenced this issue Aug 5, 2022
@jackromo888
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants