@@ -94,8 +94,7 @@ let
9494 # however it contains prebuilt java binaries, with wrong interpreter
9595 # and libraries path.
9696 # We prefetch it, patch it, and override it in a global bazelrc.
97− system = if stdenv.hostPlatform.isDarwin
98− then "darwin" else "linux";
97+ system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
9998
10099 remote_java_tools = stdenv.mkDerivation {
101100 name = "remote_java_tools_${system}";
@@ -149,11 +148,16 @@ stdenv.mkDerivation rec {
149148 # in the nixpkgs checkout root to exercise them locally.
150149 passthru.tests =
151150 let
152− runLocal = name: attrs: script: runCommandCC name ({
151+ runLocal = name: attrs: script:
152+ let
153+ attrs' = removeAttrs attrs [ "buildInputs" ];
154+ buildInputs = [ python3 ] ++ (attrs.buildInputs or []);
155+ in
156+ runCommandCC name ({
157+ inherit buildInputs;
153158 preferLocalBuild = true;
154159 meta.platforms = platforms;
155− buildInputs = [ python3 ];
156− } // attrs) script;
160+ } // attrs') script;
157161
158162 # bazel wants to extract itself into $install_dir/install every time it runs,
159163 # so let’s do that only once.
@@ -173,10 +177,10 @@ stdenv.mkDerivation rec {
173177 cp -R ${install_dir} $out
174178 '';
175179
176− bazelTest = { name, bazelScript, workspaceDir, bazelPkg }:
180+ bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }:
177181 let
178182 be = extracted bazelPkg;
179− in runLocal name {} (
183+ in runLocal name { inherit buildInputs; } (
180184 # skip extraction caching on Darwin, because nobody knows how Darwin works
181185 (lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
182186 # set up home with pre-unpacked bazel
@@ -214,11 +218,13 @@ stdenv.mkDerivation rec {
214218 in {
215219 bashTools = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; };
216220 cpp = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; };
221+ java = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; };
217222 protobuf = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; };
218223 pythonBinPath = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; };
219224
220225 bashToolsWithNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
221226 cppWithNixHacks = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
227+ javaWithNixHacks = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
222228 protobufWithNixHacks = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
223229 pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
224230 };
@@ -237,7 +243,6 @@ stdenv.mkDerivation rec {
237243 __darwinAllowLocalNetworking = true;
238244
239245 # Bazel expects several utils to be available in Bash even without PATH. Hence this hack.
240−
241246 customBash = writeCBin "bash" ''
242247 #include <stdio.h>
243248 #include <stdlib.h>