1{
2 bazel
3, bazelTest
4, bazel-examples
5, gccStdenv
6, lib
7, runLocal
8, runtimeShell
9, writeScript
10, writeText
11, distDir
12}:
13
14let
15
16 toolsBazel = writeScript "bazel" ''
17 #! ${runtimeShell}
18
19 export CXX='${gccStdenv.cc}/bin/g++'
20 export LD='${gccStdenv.cc}/bin/ld'
21 export CC='${gccStdenv.cc}/bin/gcc'
22
23 # XXX: hack for macosX, this flags disable bazel usage of xcode
24 # See: https://github.com/bazelbuild/bazel/issues/4231
25 export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
26
27 exec "$BAZEL_REAL" "$@"
28 '';
29
30 workspaceDir = runLocal "our_workspace" {} (''
31 cp -r ${bazel-examples}/cpp-tutorial/stage3 $out
32 find $out -type d -exec chmod 755 {} \;
33 ''
34 + (lib.optionalString gccStdenv.isDarwin ''
35 mkdir $out/tools
36 cp ${toolsBazel} $out/tools/bazel
37 ''));
38
39 testBazel = bazelTest {
40 name = "bazel-test-cpp";
41 inherit workspaceDir;
42 bazelPkg = bazel;
43 bazelScript = ''
44 ${bazel}/bin/bazel \
45 build --verbose_failures \
46 --distdir=${distDir} \
47 //...
48 '';
49 };
50
51in testBazel