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 non-prebuild Java toolchain configuration #451

Merged
merged 5 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
in
{
devShells.default = with pkgs; mkShell {
# do not use Xcode on macOS
BAZEL_USE_CPP_ONLY_TOOLCHAIN = "1";
# for nixpkgs cc wrappers, select C++ explicitly (see https://github.com/NixOS/nixpkgs/issues/150655)
BAZEL_CXXOPTS = "-x:c++";

name = "rules_nixpkgs_shell";
buildInputs = lib.optional pkgs.stdenv.isDarwin darwin.cctools;
packages = [ bazel_6 bazel-buildtools cacert gcc nix git openssh ];
};
});
Expand Down
2 changes: 1 addition & 1 deletion testing/cc/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bazel_dep(name = "rules_cc", version = "0.0.4")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion testing/go-bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bazel_dep(name = "rules_cc", version = "0.0.4")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion testing/java/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bazel_dep(name = "bazel_skylib", version = "1.0.3")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion testing/nodejs/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bazel_dep(name = "rules_nodejs", version = "5.5.3")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion testing/posix/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bazel_dep(name = "rules_sh", version = "0.3.0")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion testing/python/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bazel_dep(name = "rules_cc", version = "0.0.4")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")
java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")

Expand Down
2 changes: 1 addition & 1 deletion testing/rust/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bazel_dep(name = "rules_rust", version = "0.22.0")
# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
# become a module extension in rules_nixpkgs_java.
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(java_toolchains, "remote_java_tools")
Expand Down
2 changes: 1 addition & 1 deletion toolchains/java/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module(
)

bazel_dep(name = "rules_nixpkgs_core", version = "0.10.0")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_java", version = "6.5.2")
bazel_dep(name = "bazel_skylib", version = "1.0.3")
4 changes: 2 additions & 2 deletions toolchains/java/local_java_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

"""Rules for importing and registering a local JDK."""

load(":default_java_toolchain.bzl", "default_java_toolchain")
load(":default_java_toolchain.bzl", "NONPREBUILT_TOOLCHAIN_CONFIGURATION", "default_java_toolchain")

def _detect_java_version(repository_ctx, java_bin):
properties_out = repository_ctx.execute([java_bin, "-XshowSettings:properties"]).stderr
Expand Down Expand Up @@ -99,10 +99,10 @@ def local_java_runtime(name, java_home, version, runtime_name = None, visibility
for version in range(8, int(version) + 1):
default_java_toolchain(
name = name + "_toolchain_java" + str(version),
configuration = NONPREBUILT_TOOLCHAIN_CONFIGURATION,
source_version = str(version),
target_version = str(version),
java_runtime = runtime_name,

exec_compatible_with = exec_compatible_with,
target_compatible_with = target_compatible_with,
)
Expand Down