Skip to content

Commit e2f59f3

Browse files
committed
chore: add build_test targets to examples
1 parent 70a8c93 commit e2f59f3

File tree

7 files changed

+80
-14
lines changed

7 files changed

+80
-14
lines changed

examples/avl/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1516

1617
alias(
1718
name = "avl",
1819
actual = "@avl",
1920
)
21+
22+
build_test(
23+
name = "avl_build_test",
24+
targets = [":avl"],
25+
)

examples/hello_world_c/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1819

20+
build_test(
21+
name = "hello_world_c_build_test",
22+
targets = [
23+
":hello_world_c",
24+
":hello_world_c_linux_aarch64_tar",
25+
":hello_world_c_linux_armv7_tar",
26+
],
27+
)
28+
1929
cc_binary(
2030
name = "hello_world_c",
2131
srcs = ["main.c"],
@@ -24,8 +34,8 @@ cc_binary(
2434

2535
platform_transition_filegroup(
2636
name = "hello_world_c_linux_aarch64",
27-
target_platform = "//platforms:aarch64_linux",
2837
srcs = [":hello_world_c"],
38+
target_platform = "//platforms:aarch64_linux",
2939
)
3040

3141
pkg_tar(
@@ -37,8 +47,8 @@ pkg_tar(
3747

3848
platform_transition_filegroup(
3949
name = "hello_world_c_linux_armv7",
40-
target_platform = "//platforms:armv7_linux",
4150
srcs = [":hello_world_c"],
51+
target_platform = "//platforms:armv7_linux",
4252
)
4353

4454
pkg_tar(

examples/hello_world_cpp/BUILD.bazel

+14-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1819

20+
build_test(
21+
name = "hello_world_cpp_build_test",
22+
targets = [
23+
":hello_world_cpp",
24+
":hello_world_cpp_linux_aarch64_tar",
25+
":hello_world_cpp_linux_armv7_tar",
26+
],
27+
)
28+
1929
cc_binary(
2030
name = "hello_world_cpp",
2131
srcs = ["main.cpp"],
@@ -24,8 +34,8 @@ cc_binary(
2434

2535
platform_transition_filegroup(
2636
name = "hello_world_cpp_linux_aarch64",
27-
target_platform = "//platforms:aarch64_linux",
2837
srcs = [":hello_world_cpp"],
38+
target_platform = "//platforms:aarch64_linux",
2939
)
3040

3141
pkg_tar(
@@ -37,8 +47,8 @@ pkg_tar(
3747

3848
platform_transition_filegroup(
3949
name = "hello_world_cpp_linux_armv7",
40-
target_platform = "//platforms:armv7_linux",
4150
srcs = [":hello_world_cpp"],
51+
target_platform = "//platforms:armv7_linux",
4252
)
4353

4454
pkg_tar(
@@ -57,8 +67,8 @@ cc_binary(
5767

5868
platform_transition_filegroup(
5969
name = "hello_world_cpp_static_linux_aarch64",
60-
target_platform = "//platforms:aarch64_linux",
6170
srcs = [":hello_world_cpp_static"],
71+
target_platform = "//platforms:aarch64_linux",
6272
)
6373

6474
pkg_tar(
@@ -70,8 +80,8 @@ pkg_tar(
7080

7181
platform_transition_filegroup(
7282
name = "hello_world_cpp_static_linux_armv7",
73-
target_platform = "//platforms:armv7_linux",
7483
srcs = [":hello_world_cpp_static"],
84+
target_platform = "//platforms:armv7_linux",
7585
)
7686

7787
pkg_tar(

examples/hello_world_fortran/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,28 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1819
load("//rules_fortran:defs.bzl", "fortran_binary")
1920

21+
build_test(
22+
name = "hello_world_fortran_build_test",
23+
targets = [
24+
":hello_world_fortran",
25+
":hello_world_fortran_aarch64_tar",
26+
":hello_world_fortran_armv7_tar",
27+
],
28+
)
29+
2030
fortran_binary(
2131
name = "hello_world_fortran",
2232
srcs = ["main.f90"],
2333
)
2434

2535
platform_transition_filegroup(
2636
name = "hello_world_fortran_aarch64",
27-
target_platform = "//platforms:aarch64_linux",
2837
srcs = [":hello_world_fortran"],
38+
target_platform = "//platforms:aarch64_linux",
2939
)
3040

3141
pkg_tar(
@@ -37,8 +47,8 @@ pkg_tar(
3747

3848
platform_transition_filegroup(
3949
name = "hello_world_fortran_armv7",
40-
target_platform = "//platforms:armv7_linux",
4150
srcs = [":hello_world_fortran"],
51+
target_platform = "//platforms:armv7_linux",
4252
)
4353

4454
pkg_tar(

examples/openssl/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
1819
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1920

21+
build_test(
22+
name = "openssl_build_test",
23+
targets = [
24+
":openssl",
25+
":openssl_linux_aarch64_tar",
26+
":openssl_linux_armv7_tar",
27+
],
28+
)
29+
2030
configure_make(
2131
name = "openssl",
2232
configure_command = "Configure",
@@ -46,8 +56,8 @@ configure_make(
4656

4757
platform_transition_filegroup(
4858
name = "openssl_linux_aarch64",
49-
target_platform = "//platforms:aarch64_linux",
5059
srcs = [":openssl"],
60+
target_platform = "//platforms:aarch64_linux",
5161
)
5262

5363
pkg_tar(
@@ -59,8 +69,8 @@ pkg_tar(
5969

6070
platform_transition_filegroup(
6171
name = "openssl_linux_armv7",
62-
target_platform = "//platforms:armv7_linux",
6372
srcs = [":openssl"],
73+
target_platform = "//platforms:armv7_linux",
6474
)
6575

6676
pkg_tar(

examples/protobuf/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
1819
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1920
load("@rules_proto//proto:defs.bzl", "proto_library")
2021

22+
build_test(
23+
name = "hello_world_cc_proto_build_test",
24+
targets = [
25+
":hello_world_cc_proto",
26+
":hello_world_cc_proto_linux_aarch64_tar",
27+
":hello_world_cc_proto_linux_armv7_tar",
28+
],
29+
)
30+
2131
proto_library(
2232
name = "hello_world_proto",
2333
srcs = ["hello_world.proto"],
@@ -30,8 +40,8 @@ cc_proto_library(
3040

3141
platform_transition_filegroup(
3242
name = "hello_world_cc_proto_linux_aarch64",
33-
target_platform = "//platforms:aarch64_linux",
3443
srcs = [":hello_world_cc_proto"],
44+
target_platform = "//platforms:aarch64_linux",
3545
)
3646

3747
pkg_tar(
@@ -43,8 +53,8 @@ pkg_tar(
4353

4454
platform_transition_filegroup(
4555
name = "hello_world_cc_proto_linux_armv7",
46-
target_platform = "//platforms:armv7_linux",
4756
srcs = [":hello_world_cc_proto"],
57+
target_platform = "//platforms:armv7_linux",
4858
)
4959

5060
pkg_tar(

examples/tabulate_fortran/BUILD.bazel

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@
1414
# limitations under the License.
1515

1616
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
17+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
1718
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1819
load("//rules_fortran:defs.bzl", "fortran_binary")
1920

21+
build_test(
22+
name = "tabulate_fortran_build_test",
23+
targets = [
24+
":tabulate_fortran",
25+
":tabulate_fortran_aarch64_tar",
26+
":tabulate_fortran_armv7_tar",
27+
],
28+
)
29+
2030
fortran_binary(
2131
name = "tabulate_fortran",
2232
srcs = [
@@ -27,8 +37,8 @@ fortran_binary(
2737

2838
platform_transition_filegroup(
2939
name = "tabulate_fortran_aarch64",
30-
target_platform = "//platforms:aarch64_linux",
3140
srcs = [":tabulate_fortran"],
41+
target_platform = "//platforms:aarch64_linux",
3242
)
3343

3444
pkg_tar(
@@ -40,8 +50,8 @@ pkg_tar(
4050

4151
platform_transition_filegroup(
4252
name = "tabulate_fortran_armv7",
43-
target_platform = "//platforms:armv7_linux",
4453
srcs = [":tabulate_fortran"],
54+
target_platform = "//platforms:armv7_linux",
4555
)
4656

4757
pkg_tar(

0 commit comments

Comments
 (0)