about summary refs log tree commit diff
path: root/nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh')
-rw-r--r--nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh b/nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh
new file mode 100644
index 000000000000..f7f7e3afe5bf
--- /dev/null
+++ b/nix/buildBazelPackageNG/bazelRulesJavaHook/setup-hook.sh
@@ -0,0 +1,17 @@
+prePatchHooks+=(_setupLocalJavaRepo)
+
+javaVersions=(11 17 21)
+javaPlatforms=(
+  "linux" "linux_aarch64" "linux_ppc64le" "linux_s390x"
+  "macos" "macos_aarch64"
+  "win" "win_arm64")
+
+_setupLocalJavaRepo() {
+	for javaVersion in ${javaVersions[@]}; do
+		for javaPlatform in ${javaPlatforms[@]}; do
+			bazelFlagsArray+=(
+				"--override_repository=remotejdk${javaVersion}_${javaPlatform}=@local_java@"
+			)
+		done
+	done
+}