|
1 | 1 | # The BUILD file for p4testgen, inspired by the tool's cmake build rules.
|
2 | 2 |
|
3 |
| -exports_files(["p4tools.def"]) |
| 3 | +load("@bazel_skylib//rules:build_test.bzl", "build_test") |
4 | 4 |
|
5 | 5 | package(
|
| 6 | + default_applicable_licenses = ["//:license"], |
6 | 7 | licenses = ["notice"],
|
7 | 8 | )
|
8 | 9 |
|
9 | 10 | # Extend the list with the name of the desired targets (in "modules/testgen/targets/).
|
10 |
| -TESTGEN_TARGETS = [ |
11 |
| - "bmv2", |
12 |
| -] |
| 11 | +TESTGEN_TARGETS = ["bmv2"] |
| 12 | + |
| 13 | +filegroup( |
| 14 | + name = "ir_extension", |
| 15 | + srcs = ["p4tools.def"], |
| 16 | + visibility = ["//visibility:public"], # So p4c can compile these. |
| 17 | +) |
13 | 18 |
|
14 | 19 | genrule(
|
15 | 20 | name = "version",
|
@@ -72,10 +77,14 @@ genrule(
|
72 | 77 | filegroup(
|
73 | 78 | name = "testgen_targets_src",
|
74 | 79 | srcs =
|
75 |
| - glob(["modules/testgen/targets/%s/**/*.h" % target for target in TESTGEN_TARGETS], |
76 |
| - exclude = ["modules/testgen/targets/%s/test/**" % target for target in TESTGEN_TARGETS]) + |
77 |
| - glob(["modules/testgen/targets/%s/**/*.cpp" % target for target in TESTGEN_TARGETS], |
78 |
| - exclude = ["modules/testgen/targets/%s/test/**" % target for target in TESTGEN_TARGETS]), |
| 80 | + glob( |
| 81 | + ["modules/testgen/targets/%s/**/*.h" % target for target in TESTGEN_TARGETS], |
| 82 | + exclude = ["modules/testgen/targets/%s/test/**" % target for target in TESTGEN_TARGETS], |
| 83 | + ) + |
| 84 | + glob( |
| 85 | + ["modules/testgen/targets/%s/**/*.cpp" % target for target in TESTGEN_TARGETS], |
| 86 | + exclude = ["modules/testgen/targets/%s/test/**" % target for target in TESTGEN_TARGETS], |
| 87 | + ), |
79 | 88 | )
|
80 | 89 |
|
81 | 90 | cc_library(
|
@@ -133,3 +142,10 @@ cc_binary(
|
133 | 142 | "//:lib",
|
134 | 143 | ],
|
135 | 144 | )
|
| 145 | + |
| 146 | +build_test( |
| 147 | + name = "p4testgen_build_test", |
| 148 | + targets = [ |
| 149 | + ":p4testgen", |
| 150 | + ], |
| 151 | +) |
0 commit comments