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

v0.11.2 has not been released to Bazel registry #401

Open
marekkrk opened this issue Jun 4, 2024 · 7 comments
Open

v0.11.2 has not been released to Bazel registry #401

marekkrk opened this issue Jun 4, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@marekkrk
Copy link

marekkrk commented Jun 4, 2024

v0.11.2 tag exists in repository, but not in Bzlmod registry: https://registry.bazel.build/search?q=graal

@sgammon
Copy link
Owner

sgammon commented Jun 9, 2024

Thanks for flagging @marekkrk. The release flow is a little buggy and it failed at 0.11.2. I haven't had time to fix it yet. I'll see if I can get it out, and fix the pipeline in the next release so that releases are no longer delayed.

@sgammon sgammon added the bug Something isn't working label Sep 19, 2024
@vorburger
Copy link
Contributor

@sgammon same for 0.12.0 as well... the README mentions it - but it's not on https://registry.bazel.build/modules/rules_graalvm.

I guess that neccessarily means using WORKSPACE.bazel instead of MODULE.bazel, for now? Or is there another way / workaround? @fmeum

@vorburger
Copy link
Contributor

bazelisk build //tools/hello:hello-native
WARNING: Target pattern parsing failed.
ERROR: Skipping '//tools/hello:hello-native': error loading package 'tools/hello': Unable to find package for @@[unknown repo 'rules_graalvm' requested from @@]//graalvm:defs.bzl: The repository '@@[unknown repo 'rules_graalvm' requested from @@]' could not be resolved: No repository visible as '@rules_graalvm' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration.
ERROR: error loading package 'tools/hello': Unable to find package for @@[unknown repo 'rules_graalvm' requested from @@]//graalvm:defs.bzl: The repository '@@[unknown repo 'rules_graalvm' requested from @@]' could not be resolved: No repository visible as '@rules_graalvm' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration.
INFO: Elapsed time: 0.156s
INFO: 0 processes.
ERROR: Build did NOT complete successfully

How does one actually use rules from Git repos which have not been releases to https://registry.bazel.build? (Both for this, but also generally speaking; I'm curious.) According to https://bazel.build/external/migration something like this in MODULE.bazel might work:

http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

http_file(
    name = "rules_graalvm",
    sha256 = "",
    url = "https://github.com/sgammon/rules_graalvm/archive/2071b847ac7c6206c48df400f6e6a10c28e64400.zip",
)

non_module_dependencies = use_extension("//:extensions.bzl", "non_module_dependencies")
use_repo(non_module_dependencies, "rules_graalvm")

gvm = use_extension("@rules_graalvm//:extensions.bzl", "graalvm")
gvm.graalvm(
    name = "graalvm",
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "23",  # `17`, `20`, `22`, `23`, etc.
    version = "23.0.0",  # pass graalvm or specific jdk version supported by gvm
)
use_repo(gvm, "graalvm")

register_toolchains("@graalvm//:jvm")

register_toolchains("@graalvm//:sdk")

but that's giving me:

ERROR: /home/vorburger/git/github.com/enola-dev/enola/MODULE.bazel:188:9: Traceback (most recent call last):
        File "/home/vorburger/git/github.com/enola-dev/enola/MODULE.bazel", line 188, column 9, in <toplevel>
                use_repo(non_module_dependencies, "rules_graalvm")
Error in use_repo: The repo name 'rules_graalvm' is already being used by a repo rule at /home/vorburger/git/github.com/enola-dev/enola/MODULE.bazel:181:10
ERROR: Error computing the main repository mapping: error executing MODULE.bazel file for <root>

With that I'm giving up on this, and just sticking to bazel_dep(name = "rules_graalvm", version = "0.11.1").

@marekkrk
Copy link
Author

marekkrk commented Mar 2, 2025

That's strange, 0.12.0 is mentioned in README, but the corresponding tag does not exist in repository.

@marekkrk
Copy link
Author

marekkrk commented Mar 2, 2025

@vorburger The following works:

WORKSPACE.build
http_archive(
    name = "rules_graalvm",
    sha256 = "3ef2f1583a4849d03209a43b0b507f172299c3045e585b6ffa7144a2bc12ae18",
    strip_prefix = "rules_graalvm-0.11.2",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.11.2/rules_graalvm-0.11.2.zip",
    ],
)

load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")

graalvm_repository(
    name = "graalvm",
    distribution = "oracle",
    java_version = "21",
    version = "21.0.2",
)

load(
    "@rules_graalvm//graalvm:workspace.bzl",
    "register_graalvm_toolchains",
    "rules_graalvm_repositories",
)

rules_graalvm_repositories()

register_graalvm_toolchains()
BUILD.bazel
load(
    "@rules_graalvm//graalvm:defs.bzl",
    "native_image",
)

@sgammon
Copy link
Owner

sgammon commented Mar 2, 2025

@marekkrk Thanks for helping here and for noticing that missing tag. Releases have fallen a bit behind since the infra to deploy to BCR is currently broken. I'll try to get that fixed in the next few days.

@sgammon
Copy link
Owner

sgammon commented Mar 2, 2025

@vorburger As mentioned in this thread, you should be able to use these rules with a repository override in MODULE.bazel, even if they are not published to BCR. If you have trouble with this, please ping the thread (make sure to mention me) and I would be happy to help diagnose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants