mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 14:47:06 +00:00
67904dccbb
- Upgraded dependencies - dependencies script upgraded to take into account new WORKSPACE rules - Tests now depends on the `distdir` Runtime bazel now also depends on the `distdir` setting which appears in the global configuration file. This increases the bazel closure size by 85 MO for stuffs which can normally be downloaded at runtime by bazel. However, any invocation of `buildBazelPackage` (such as in `bazel-watcher`) may fail in nix sandbox if theses files are not available at runtime. If this overhead is too important, we may later evolve to a finer grained solution, where buildBazelPackage declares the list of necessary dependencies.
59 lines
1.2 KiB
Nix
59 lines
1.2 KiB
Nix
{
|
|
bazel
|
|
, bazelTest
|
|
, bazel-examples
|
|
, gccStdenv
|
|
, lib
|
|
, openjdk8
|
|
, runLocal
|
|
, runtimeShell
|
|
, writeScript
|
|
, writeText
|
|
, distDir
|
|
}:
|
|
|
|
let
|
|
|
|
toolsBazel = writeScript "bazel" ''
|
|
#! ${runtimeShell}
|
|
|
|
export CXX='${gccStdenv.cc}/bin/g++'
|
|
export LD='${gccStdenv.cc}/bin/ld'
|
|
export CC='${gccStdenv.cc}/bin/gcc'
|
|
|
|
# XXX: hack for macosX, this flags disable bazel usage of xcode
|
|
# See: https://github.com/bazelbuild/bazel/issues/4231
|
|
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
|
|
|
|
exec "$BAZEL_REAL" "$@"
|
|
'';
|
|
|
|
workspaceDir = runLocal "our_workspace" {} (''
|
|
cp -r ${bazel-examples}/java-tutorial $out
|
|
find $out -type d -exec chmod 755 {} \;
|
|
''
|
|
+ (lib.optionalString gccStdenv.isDarwin ''
|
|
mkdir $out/tools
|
|
cp ${toolsBazel} $out/tools/bazel
|
|
''));
|
|
|
|
testBazel = bazelTest {
|
|
name = "bazel-test-cpp";
|
|
inherit workspaceDir;
|
|
bazelPkg = bazel;
|
|
buildInputs = [ openjdk8 ];
|
|
bazelScript = ''
|
|
${bazel}/bin/bazel \
|
|
run \
|
|
--distdir=${distDir} \
|
|
--host_javabase='@local_jdk//:jdk' \
|
|
--java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \
|
|
--javabase='@local_jdk//:jdk' \
|
|
--verbose_failures \
|
|
//:ProjectRunner
|
|
'';
|
|
};
|
|
|
|
in testBazel
|
|
|