about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/bazel/default.nix
diff options
context:
space:
mode:
authorGuillaume Bouchard <guillaume.bouchard@tweag.io>2019-07-11 17:10:55 +0200
committerGuillaume Bouchard <guillaume.bouchard@tweag.io>2019-07-12 22:32:01 +0200
commitd363da72cc8e102d46af74c2eb9aa7bb839b5174 (patch)
tree19d6db93935e1e3ce7f41533b6fbb708df42e57f /pkgs/development/tools/build-managers/bazel/default.nix
parent95395fbf549908e8fe59922653e9dadd4da4792e (diff)
bazel: Use --distdir for prefetched repositories
--distdir is now used in the installCheckPhase for prefetched
  repositories. That's simpler, more robust and easier to extend in
  the future.

Note that `name` argument of fetchurl was removed because it changed
the basename of the generated file and bazel uses this basename for
its cache behavior.
Diffstat (limited to 'pkgs/development/tools/build-managers/bazel/default.nix')
-rw-r--r--pkgs/development/tools/build-managers/bazel/default.nix23
1 files changed, 3 insertions, 20 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix
index bad0023eef325..8d7a8199240de 100644
--- a/pkgs/development/tools/build-managers/bazel/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/default.nix
@@ -33,7 +33,6 @@ let
     let
       srcs = (builtins.fromJSON (builtins.readFile ./src-deps.json));
       toFetchurl = d: lib.attrsets.nameValuePair d.name (fetchurl {
-        name = d.name;
         urls = d.urls;
         sha256 = d.sha256;
         });
@@ -339,8 +338,8 @@ stdenv.mkDerivation rec {
 
       # add nix environment vars to .bazelrc
       cat >> .bazelrc <<EOF
-      build --experimental_distdir=${distDir}
-      fetch --experimental_distdir=${distDir}
+      build --distdir=${distDir}
+      fetch --distdir=${distDir}
       build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
       build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
       build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
@@ -456,24 +455,8 @@ stdenv.mkDerivation rec {
   installCheckPhase = ''
     export TEST_TMPDIR=$(pwd)
 
-    tar xf ${srcDepsSet.io_bazel_skydoc} -C $TEST_TMPDIR
-    mv $(ls | grep skydoc-) io_bazel_skydoc
-
-    tar xf ${srcDepsSet.bazel_skylib} -C $TEST_TMPDIR
-    mv $(ls | grep bazel-skylib-) bazel_skylib
-
-    tar xf ${srcDepsSet.io_bazel_rules_sass} -C $TEST_TMPDIR
-    mv $(ls | grep rules_sass-) rules_sass
-
-    unzip ${srcDepsSet.build_bazel_rules_nodejs} -d $TEST_TMPDIR
-    mv rules_nodejs-0.16.2 build_bazel_rules_nodejs
-
     hello_test () {
-      $out/bin/bazel test \
-        --override_repository=io_bazel_skydoc=$TEST_TMPDIR/io_bazel_skydoc \
-        --override_repository=bazel_skylib=$TEST_TMPDIR/bazel_skylib \
-        --override_repository=io_bazel_rules_sass=$TEST_TMPDIR/rules_sass \
-        --override_repository=build_bazel_rules_nodejs=$TEST_TMPDIR/build_bazel_rules_nodejs \
+      $out/bin/bazel test --distdir=${distDir} \
         --test_output=errors \
         --java_toolchain='${javaToolchain}' \
         examples/cpp:hello-success_test \