diff options
author | Wael Nasreddine <wael.nasreddine@gmail.com> | 2019-07-01 21:18:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 21:18:02 -0700 |
commit | 7f69cab8a606f318efc21edde9da7b5389b2cb13 (patch) | |
tree | b80e1bdd38bbd42ba0b7ceff070778d8c3916e21 /pkgs/development/tools/build-managers/bazel/default.nix | |
parent | 4c86deee99bd1d61b6a9de6d3dcabcc55051e15d (diff) |
bazel: add a test asserting java and java proto (#63927)
Diffstat (limited to 'pkgs/development/tools/build-managers/bazel/default.nix')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/default.nix | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index 8aac432d3bb61..bad0023eef325 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -94,8 +94,7 @@ let # however it contains prebuilt java binaries, with wrong interpreter # and libraries path. # We prefetch it, patch it, and override it in a global bazelrc. - system = if stdenv.hostPlatform.isDarwin - then "darwin" else "linux"; + system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux"; remote_java_tools = stdenv.mkDerivation { name = "remote_java_tools_${system}"; @@ -149,11 +148,16 @@ stdenv.mkDerivation rec { # in the nixpkgs checkout root to exercise them locally. passthru.tests = let - runLocal = name: attrs: script: runCommandCC name ({ + runLocal = name: attrs: script: + let + attrs' = removeAttrs attrs [ "buildInputs" ]; + buildInputs = [ python3 ] ++ (attrs.buildInputs or []); + in + runCommandCC name ({ + inherit buildInputs; preferLocalBuild = true; meta.platforms = platforms; - buildInputs = [ python3 ]; - } // attrs) script; + } // attrs') script; # bazel wants to extract itself into $install_dir/install every time it runs, # so let’s do that only once. @@ -173,10 +177,10 @@ stdenv.mkDerivation rec { cp -R ${install_dir} $out ''; - bazelTest = { name, bazelScript, workspaceDir, bazelPkg }: + bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }: let be = extracted bazelPkg; - in runLocal name {} ( + in runLocal name { inherit buildInputs; } ( # skip extraction caching on Darwin, because nobody knows how Darwin works (lib.optionalString (!stdenv.hostPlatform.isDarwin) '' # set up home with pre-unpacked bazel @@ -214,11 +218,13 @@ stdenv.mkDerivation rec { in { bashTools = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; }; cpp = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; }; + java = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; }; protobuf = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; }; pythonBinPath = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; }; bashToolsWithNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; }; cppWithNixHacks = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; }; + javaWithNixHacks = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; }; protobufWithNixHacks = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; }; pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; bazel = bazelWithNixHacks; }; }; @@ -237,7 +243,6 @@ stdenv.mkDerivation rec { __darwinAllowLocalNetworking = true; # Bazel expects several utils to be available in Bash even without PATH. Hence this hack. - customBash = writeCBin "bash" '' #include <stdio.h> #include <stdlib.h> |