Skip to content

Document how to use these toolchains #30

@aiuto

Description

@aiuto

This snippet was suggested for the bazel 3.5 release notes. It should be really be with the 14.0 release description.

# Java tools javac14 for Darwin
http_archive(
    name = "remote_java_tools_darwin",
    sha256 = "e20f002ceb3f3353d64c022e1f3400d8539ee56ffcfd4a6680d73d6a2cac938b",
    urls = [
        "https://mirror.bazel.build/bazel_java_tools/releases/javac14/v1.0/java_tools_javac14_darwin-v1.0.zip",
        "https://github.com/bazelbuild/java_tools/releases/download/javac14-v1.0/java_tools_javac14_darwin-v1.0.zip",
    ],
)

# Zulu OpenJDK for Darwin
http_archive(
    name = "openjdk14_darwin_archive",
    build_file_content = "java_runtime(name = 'runtime', srcs =  glob(['**']), visibility = ['//visibility:public'])",
    sha256 = "088bd4d0890acc9f032b738283bf0f26b2a55c50b02d1c8a12c451d8ddf080dd",
    strip_prefix = "zulu14.28.21-ca-jdk14.0.1-macosx_x64",
    urls = ["https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz"],
)

And invoke the build with these parameters:

$ bazel build \
     --java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_14 \
     --host_java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_14 \
     --javabase=@openjdk14_darwin_archive//:runtime \
     --host_javabase=@openjdk14_darwin_archive//:runtime \
   :foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions