blob: 7a362089864e52a9f6147638d560f48121ee2102 [file] [log] [blame]
Alex Perry0d0aae32022-02-09 21:10:17 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_go_library", "flatbuffer_py_library")
Philipp Schrader37fdbb62021-12-18 00:30:37 -08002load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Austin Schuh8f99c822024-05-05 22:43:40 -07003load("@rules_cc//cc:defs.bzl", "cc_proto_library")
4load("@rules_proto//proto:defs.bzl", "proto_library")
Adam Snaiderf560ae92023-11-07 17:06:21 -08005load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
Austin Schuh8f99c822024-05-05 22:43:40 -07006load("//tools/build_rules:apache.bzl", "apache_wrapper")
Brian Silvermanc270a4d2022-07-23 16:08:06 -07007load("//tools/build_rules:autocxx.bzl", "autocxx_library")
Austin Schuh8f99c822024-05-05 22:43:40 -07008load("//tools/build_rules:js.bzl", "ts_project")
James Kuszmaul27da8142019-07-21 16:13:55 -07009
Brian Silvermanfbe79b82015-09-12 15:10:54 -040010cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070011 name = "gflags_build_test",
12 size = "small",
13 srcs = [
14 "gflags.cc",
15 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080016 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070017 deps = [
Austin Schuh99f7c6a2024-06-25 22:07:44 -070018 "@com_google_absl//absl/flags:flag",
Austin Schuhf9724442018-10-28 20:30:21 -070019 ],
Brian Silvermanfbe79b82015-09-12 15:10:54 -040020)
Brian Silvermanb67da232015-09-12 23:50:30 -040021
Brian Silverman516ceb22015-11-27 01:29:05 -050022cc_binary(
Austin Schuhf9724442018-10-28 20:30:21 -070023 name = "tcmalloc_build_test_binary",
24 srcs = [
25 "tcmalloc.cc",
26 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080027 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050028)
29
30sh_test(
Austin Schuhf9724442018-10-28 20:30:21 -070031 name = "tcmalloc_build_test",
32 size = "small",
33 srcs = [
34 "tcmalloc_test.sh",
35 ],
36 data = [
37 ":tcmalloc_build_test_binary",
38 ],
Austin Schuh99f7c6a2024-06-25 22:07:44 -070039 # TODO(austin): Turn this back on when we get memory instrumentation figured out for tcmalloc for --die_on_malloc
40 tags = ["manual"],
Philipp Schraderdada1072020-11-24 11:34:46 -080041 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050042)
Brian Silvermaneb16fa42016-02-20 15:29:56 -050043
Adam Snaider13d48d92023-08-03 12:20:15 -070044proto_library(
45 name = "proto_build_test_library_proto",
Austin Schuhf9724442018-10-28 20:30:21 -070046 srcs = ["proto.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070048 deps = [
49 ":proto_build_test_library_base",
Adam Snaider13d48d92023-08-03 12:20:15 -070050 "@com_google_protobuf//:empty_proto",
Austin Schuhf9724442018-10-28 20:30:21 -070051 ],
Parker Schuh971588a2017-03-01 22:15:04 -080052)
53
Austin Schuhf9724442018-10-28 20:30:21 -070054cc_proto_library(
Adam Snaider13d48d92023-08-03 12:20:15 -070055 name = "proto_build_test_library",
56 deps = [":proto_build_test_library_proto"],
57)
58
59proto_library(
Austin Schuhf9724442018-10-28 20:30:21 -070060 name = "proto_build_test_library_base",
61 srcs = ["proto_base.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080062 target_compatible_with = ["@platforms//os:linux"],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050063)
64
65cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070066 name = "proto_build_test",
67 size = "small",
68 srcs = [
69 "proto.cc",
70 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080071 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070072 deps = [
73 ":proto_build_test_library",
74 "//aos/testing:googletest",
75 ],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050076)
James Kuszmaulf385c462019-12-24 09:37:34 -080077
Brian Silverman28760272020-02-02 13:21:51 -080078flatbuffer_py_library(
James Kuszmaulf385c462019-12-24 09:37:34 -080079 name = "test_python_fbs",
80 srcs = ["test.fbs"],
81 namespace = "aos.examples",
82 tables = [
83 "Foo",
84 "Bar",
85 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080086 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080087 visibility = ["//visibility:public"],
88)
89
Alex Perry0d0aae32022-02-09 21:10:17 -080090flatbuffer_go_library(
91 name = "test_go_fbs",
92 srcs = ["test.fbs"],
93 importpath = "github.com/frc971/971-Robot-Code/build_tests/fbs",
94 target_compatible_with = ["@platforms//cpu:x86_64"],
95 visibility = ["//visibility:public"],
96)
97
James Kuszmaulf385c462019-12-24 09:37:34 -080098py_test(
99 name = "python_fbs",
100 srcs = ["python_fbs.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800101 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -0800102 deps = [":test_python_fbs"],
103)
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800104
105py_test(
106 name = "python3_opencv",
107 srcs = ["python_opencv.py"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800108 main = "python_opencv.py",
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
Philipp Schraderebb658f2022-09-17 17:31:09 -0700110 deps = ["@pip//opencv_python"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800111)
James Kuszmaulc91e4402020-05-10 18:47:20 -0700112
113py_test(
114 name = "python_jinja2",
115 srcs = ["python_jinja2.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800116 target_compatible_with = ["@platforms//os:linux"],
Philipp Schraderebb658f2022-09-17 17:31:09 -0700117 deps = ["@pip//jinja2"],
James Kuszmaulc91e4402020-05-10 18:47:20 -0700118)
Philipp Schrader73e56602021-12-06 21:37:30 -0800119
120go_binary(
121 name = "hello_go",
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800122 embed = [":build_tests_lib"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800123 target_compatible_with = ["@platforms//cpu:x86_64"],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800124 visibility = ["//visibility:public"],
125)
126
127go_library(
128 name = "build_tests_lib",
Brian Silvermanc270a4d2022-07-23 16:08:06 -0700129 srcs = [
130 "hello.go",
131 # Not sure why gazelle wants this here?
132 "hello_autocxx.h",
133 ],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800134 importpath = "github.com/frc971/971-Robot-Code/build_tests",
135 target_compatible_with = ["@platforms//cpu:x86_64"],
136 visibility = ["//visibility:private"],
Philipp Schrader69082a02022-01-22 16:49:38 -0800137 deps = ["//build_tests/go_greeter"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800138)
Philipp Schraderd0e33a42022-01-22 21:55:15 -0800139
140py_binary(
141 name = "dummy_http_server",
142 srcs = ["dummy_http_server.py"],
143 target_compatible_with = ["@platforms//cpu:x86_64"],
144)
145
146apache_wrapper(
147 name = "apache_https_demo",
148 binary = ":dummy_http_server",
149 target_compatible_with = ["@platforms//cpu:x86_64"],
150)
Ravago Jones16809802021-11-18 20:40:03 -0800151
152rust_library(
153 name = "hello_lib",
154 srcs = ["hello_lib.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700155 target_compatible_with = ["//tools/platforms/rust:has_support"],
Ravago Jones16809802021-11-18 20:40:03 -0800156)
157
Ravago Jones16809802021-11-18 20:40:03 -0800158rust_binary(
159 name = "rust_hello",
160 srcs = ["rust_hello.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700161 target_compatible_with = ["//tools/platforms/rust:has_support"],
Ravago Jones16809802021-11-18 20:40:03 -0800162 deps = [":hello_lib"],
163)
Philipp Schrader54047962022-02-16 21:05:11 -0800164
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800165ts_project(
Philipp Schrader54047962022-02-16 21:05:11 -0800166 name = "build_tests_ts",
167 srcs = ["basic.ts"],
168)
169
Brian Silverman8751d482022-05-18 23:28:44 -0700170rust_library(
171 name = "rust_in_cc_rs",
172 srcs = ["rust_in_cc.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700173 target_compatible_with = ["//tools/platforms/rust:has_support"],
Brian Silverman8751d482022-05-18 23:28:44 -0700174)
175
176cc_test(
177 name = "rust_in_cc",
178 srcs = ["rust_in_cc.cc"],
179 target_compatible_with = ["@platforms//os:linux"],
180 deps = [":rust_in_cc_rs"],
181)
Brian Silvermanc270a4d2022-07-23 16:08:06 -0700182
183cc_library(
184 name = "hello_autocxx_cc",
185 hdrs = [
186 "hello_autocxx.h",
187 ],
188)
189
190autocxx_library(
191 name = "hello_autocxx",
192 srcs = ["hello_autocxx.rs"],
193 libs = [":hello_autocxx_cc"],
194 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
195 target_compatible_with = ["//tools/platforms/rust:has_support"],
196)
197
Philipp Schrader9e1b9bd2021-12-28 00:15:12 -0800198py_test(
199 name = "upstream_python_test",
200 srcs = [
201 "upstream_python_test.py",
202 ],
James Kuszmaulef420da2023-12-27 12:02:15 -0800203 target_compatible_with = ["@platforms//os:linux"],
Philipp Schrader9e1b9bd2021-12-28 00:15:12 -0800204 deps = [
205 "@pip//matplotlib",
206 "@pip//numpy",
207 "@pip//scipy",
208 ],
209)
Philipp Schrader7520ee62022-12-10 14:04:40 -0800210
211py_binary(
212 name = "pygobject_example",
213 srcs = ["pygobject_example.py"],
214 deps = [
215 "@pip//pygobject",
216 ],
217)
218
219py_binary(
220 name = "matplotlib_example",
221 srcs = ["matplotlib_example.py"],
222 deps = [
223 "@pip//matplotlib",
224 "@pip//pygobject",
225 ],
226)