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

How to use remote_java_repository with a JDK release where Java home is nested? #102

Open
josephglanville opened this issue Apr 13, 2023 · 6 comments
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee) question Further information is requested

Comments

@josephglanville
Copy link

josephglanville commented Apr 13, 2023

I'm trying to use remote_java_repository with GraalVM releases on MacOS.

When extracting the package the layout is of the form:

└── Contents
    ├── Home
    │   ├── bin
    │   │   ├── java
    │   │   ├── javac

There are no top level symlinks into the nested bin directory as can be seen in the Zulu JDK releases that remote_java_repository is normally used with.

Would it be possible to make this rule configurable so that the path to the Java home inside the extracted distribution can be customized?

@josephglanville
Copy link
Author

On closer inspection I'm not sure if there is something that is causing the files not to be unpacked at all, I can find the tar file in the cache and the path where it was meant to be unpacked but the directory is empty. (hence I run into errors with bin/javac not being found etc)

Any tips on debugging what is going wrong here?

@sgammon
Copy link

sgammon commented Aug 12, 2023

@josephglanville have you tried strip_prefix?

## Setup: Java

load("@rules_java//toolchains:remote_java_repository.bzl", "remote_java_repository")

GRAALVM_SDK_VERSION = "23.1.0-dev-20230803_2234"

JAVA_VERSION = "21"

JAVA_TOOLCHAIN = "@graalvm//:all"

GRAALVM_DOWNLOAD_PREFIX = "https://github.com/graalvm/graalvm-ce-dev-builds/releases/download"

GRAALVM_PATH_PREFIX = "graalvm-community-openjdk-21+30.1"

remote_java_repository(
    name = "graalvm",
    sha256 = "01e1934581a84467a882be2ca64a735e296e3b7e6f470effff076730fb516e3b",
    strip_prefix = "%s/Contents/Home" % GRAALVM_PATH_PREFIX,
    target_compatible_with = [
        "@platforms//cpu:aarch64",
        "@platforms//os:macos",
    ],
    urls = [
        "%s/%s/graalvm-community-java%s-darwin-aarch64-dev.tar.gz" % (
            GRAALVM_DOWNLOAD_PREFIX,
            GRAALVM_SDK_VERSION,
            JAVA_VERSION,
        ),
    ],
    version = JAVA_VERSION,
)

register_toolchains(
    JAVA_TOOLCHAIN,
)

@sgammon
Copy link

sgammon commented Aug 14, 2023

@josephglanville i encountered some trouble with this too, so i released rules_graalvm over the weekend, which supports use of GraalVM as a Java toolchain.

@hvadehra
Copy link
Member

@josephglanville did #102 (comment) fix this for you?

@hvadehra hvadehra added the question Further information is requested label Sep 15, 2023
@josephglanville
Copy link
Author

@hvadehra I haven't been back to this project to try out the fix unfortunately.

@hvadehra
Copy link
Member

Alright, feel free to ping here if this comes up again.

@hvadehra hvadehra added the P3 We're not considering to work on this, but happy to review a PR. (No assignee) label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering to work on this, but happy to review a PR. (No assignee) question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants