Skip to content

Commit 2dac66a

Browse files
committed
examples: add py_wheel test
$ bazel build -c opt ... Computing main repo mapping: Loading: Loading: 0 packages loaded Analyzing: 7 targets (1 packages loaded, 0 targets configured) Analyzing: 7 targets (1 packages loaded, 0 targets configured) ERROR: //examples/basic/BUILD.bazel:11:9: in deps attribute of py_wheel rule //:basic_wheel: alias '//:basic' referring to generated file '//:basic.pyd' is misplaced here (expected no files). Since this rule was created by the macro 'py_wheel', the error might have been caused by the macro implementation ERROR: //examples/basic/BUILD.bazel:11:9: Analysis of target '//:basic_wheel' (config: 307b5b1) failed Use --verbose_failures to see the command lines of failed build steps. ERROR: Analysis of target '//:basic_wheel' failed; build aborted INFO: Elapsed time: 0.334s, Critical Path: 0.02s INFO: 1 process: 1 internal. ERROR: Build did NOT complete successfully
1 parent 5075337 commit 2dac66a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

examples/basic/BUILD.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
22
load("@rules_python//python:py_library.bzl", "py_library")
33
load("@rules_python//python:py_test.bzl", "py_test")
4+
load("@rules_python//python:packaging.bzl", "py_wheel")
45

56
pybind_extension(
67
name = "basic",
78
srcs = ["basic.cpp"],
89
)
910

11+
py_wheel(
12+
name = "basic_wheel",
13+
testonly = True,
14+
distribution = "basic",
15+
version = "1.0.0",
16+
deps = [":basic"],
17+
)
18+
1019
py_library(
1120
name = "basic_lib",
1221
data = [":basic"],
1322
imports = ["."],
1423
)
1524

25+
py_wheel(
26+
name = "basic_lib_wheel",
27+
testonly = True,
28+
distribution = "basic_lib",
29+
version = "1.0.0",
30+
deps = [":basic_lib"],
31+
)
32+
1633
py_test(
1734
name = "basic_test",
1835
srcs = ["basic_test.py"],

0 commit comments

Comments
 (0)