mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
c49b7f64d1
On Darwin, the last argument to GCC is coming up as an empty string. This is breaking the build of proto_library targets. However, I was not able to reproduce with the example cpp project[0]. This commit patches the cc_wrapper of Bazel that gets installed on Darwin to remove the last argument if it's an empty string. This is not a probem on Linux. [0]: https://github.com/bazelbuild/examples/tree/master/cpp-tutorial/stage3
53 lines
980 B
Nix
53 lines
980 B
Nix
{ writeText, bazel, bazelTest, runLocal }:
|
|
|
|
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 \
|
|
//python:bin
|
|
'';
|
|
};
|
|
|
|
in testBazel
|