mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +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.
54 lines
1018 B
Nix
54 lines
1018 B
Nix
{ writeText, bazel, bazelTest, runLocal, distDir }:
|
|
|
|
let
|
|
WORKSPACE = writeText "WORKSPACE" ''
|
|
workspace(name = "our_workspace")
|
|
'';
|
|
|
|
pythonLib = writeText "lib.py" ''
|
|
def foo():
|
|
return 43
|
|
'';
|
|
|
|
pythonBin = writeText "bin.py" ''
|
|
from lib import foo
|
|
|
|
assert foo() == 43
|
|
'';
|
|
|
|
pythonBUILD = writeText "BUILD" ''
|
|
py_library(
|
|
name = "lib",
|
|
srcs = [ "lib.py" ],
|
|
)
|
|
|
|
py_binary(
|
|
name = "bin",
|
|
srcs = [ "bin.py" ],
|
|
deps = [ ":lib" ],
|
|
)
|
|
'';
|
|
|
|
workspaceDir = runLocal "our_workspace" {} ''
|
|
mkdir $out
|
|
cp ${WORKSPACE} $out/WORKSPACE
|
|
mkdir $out/python
|
|
cp ${pythonLib} $out/python/lib.py
|
|
cp ${pythonBin} $out/python/bin.py
|
|
cp ${pythonBUILD} $out/python/BUILD.bazel
|
|
'';
|
|
|
|
testBazel = bazelTest {
|
|
name = "bazel-test-builtin-rules";
|
|
inherit workspaceDir;
|
|
bazelPkg = bazel;
|
|
bazelScript = ''
|
|
${bazel}/bin/bazel \
|
|
run \
|
|
--distdir=${distDir} \
|
|
//python:bin
|
|
'';
|
|
};
|
|
|
|
in testBazel
|