Skip to content

Commit

Permalink
Merge pull request #451 from tweag/use-nonprebuilt-java-tools
Browse files Browse the repository at this point in the history
Use non-prebuild Java toolchain configuration
  • Loading branch information
mergify[bot] authored Nov 24, 2023
2 parents c638024 + de6e2b8 commit ae279df
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 10 deletions.
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

0 comments on commit ae279df

Please sign in to comment.