blob: 1eaf7379c03c28b0ea8624050c3da168617f2c14 [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 = [
Brian Silverman16a923c2018-10-31 19:40:51 -070018 "@com_github_gflags_gflags//:gflags",
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 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080039 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050040)
Brian Silvermaneb16fa42016-02-20 15:29:56 -050041
Adam Snaider13d48d92023-08-03 12:20:15 -070042proto_library(
43 name = "proto_build_test_library_proto",
Austin Schuhf9724442018-10-28 20:30:21 -070044 srcs = ["proto.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080045 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070046 deps = [
47 ":proto_build_test_library_base",
Adam Snaider13d48d92023-08-03 12:20:15 -070048 "@com_google_protobuf//:empty_proto",
Austin Schuhf9724442018-10-28 20:30:21 -070049 ],
Parker Schuh971588a2017-03-01 22:15:04 -080050)
51
Austin Schuhf9724442018-10-28 20:30:21 -070052cc_proto_library(
Adam Snaider13d48d92023-08-03 12:20:15 -070053 name = "proto_build_test_library",
54 deps = [":proto_build_test_library_proto"],
55)
56
57proto_library(
Austin Schuhf9724442018-10-28 20:30:21 -070058 name = "proto_build_test_library_base",
59 srcs = ["proto_base.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080060 target_compatible_with = ["@platforms//os:linux"],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050061)
62
63cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070064 name = "proto_build_test",
65 size = "small",
66 srcs = [
67 "proto.cc",
68 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080069 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070070 deps = [
71 ":proto_build_test_library",
72 "//aos/testing:googletest",
73 ],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050074)
James Kuszmaulf385c462019-12-24 09:37:34 -080075
Brian Silverman28760272020-02-02 13:21:51 -080076flatbuffer_py_library(
James Kuszmaulf385c462019-12-24 09:37:34 -080077 name = "test_python_fbs",
78 srcs = ["test.fbs"],
79 namespace = "aos.examples",
80 tables = [
81 "Foo",
82 "Bar",
83 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080084 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080085 visibility = ["//visibility:public"],
86)
87
Alex Perry0d0aae32022-02-09 21:10:17 -080088flatbuffer_go_library(
89 name = "test_go_fbs",
90 srcs = ["test.fbs"],
91 importpath = "github.com/frc971/971-Robot-Code/build_tests/fbs",
92 target_compatible_with = ["@platforms//cpu:x86_64"],
93 visibility = ["//visibility:public"],
94)
95
James Kuszmaulf385c462019-12-24 09:37:34 -080096py_test(
97 name = "python_fbs",
98 srcs = ["python_fbs.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080099 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -0800100 deps = [":test_python_fbs"],
101)
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800102
103py_test(
104 name = "python3_opencv",
105 srcs = ["python_opencv.py"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800106 main = "python_opencv.py",
Philipp Schraderdada1072020-11-24 11:34:46 -0800107 target_compatible_with = ["@platforms//os:linux"],
Philipp Schraderebb658f2022-09-17 17:31:09 -0700108 deps = ["@pip//opencv_python"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800109)
James Kuszmaulc91e4402020-05-10 18:47:20 -0700110
111py_test(
112 name = "python_jinja2",
113 srcs = ["python_jinja2.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800114 target_compatible_with = ["@platforms//os:linux"],
Philipp Schraderebb658f2022-09-17 17:31:09 -0700115 deps = ["@pip//jinja2"],
James Kuszmaulc91e4402020-05-10 18:47:20 -0700116)
Philipp Schrader73e56602021-12-06 21:37:30 -0800117
118go_binary(
119 name = "hello_go",
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800120 embed = [":build_tests_lib"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800121 target_compatible_with = ["@platforms//cpu:x86_64"],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800122 visibility = ["//visibility:public"],
123)
124
125go_library(
126 name = "build_tests_lib",
Brian Silvermanc270a4d2022-07-23 16:08:06 -0700127 srcs = [
128 "hello.go",
129 # Not sure why gazelle wants this here?
130 "hello_autocxx.h",
131 ],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800132 importpath = "github.com/frc971/971-Robot-Code/build_tests",
133 target_compatible_with = ["@platforms//cpu:x86_64"],
134 visibility = ["//visibility:private"],
Philipp Schrader69082a02022-01-22 16:49:38 -0800135 deps = ["//build_tests/go_greeter"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800136)
Philipp Schraderd0e33a42022-01-22 21:55:15 -0800137
138py_binary(
139 name = "dummy_http_server",
140 srcs = ["dummy_http_server.py"],
141 target_compatible_with = ["@platforms//cpu:x86_64"],
142)
143
144apache_wrapper(
145 name = "apache_https_demo",
146 binary = ":dummy_http_server",
147 target_compatible_with = ["@platforms//cpu:x86_64"],
148)
Ravago Jones16809802021-11-18 20:40:03 -0800149
150rust_library(
151 name = "hello_lib",
152 srcs = ["hello_lib.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700153 target_compatible_with = ["//tools/platforms/rust:has_support"],
Ravago Jones16809802021-11-18 20:40:03 -0800154)
155
Ravago Jones16809802021-11-18 20:40:03 -0800156rust_binary(
157 name = "rust_hello",
158 srcs = ["rust_hello.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700159 target_compatible_with = ["//tools/platforms/rust:has_support"],
Ravago Jones16809802021-11-18 20:40:03 -0800160 deps = [":hello_lib"],
161)
Philipp Schrader54047962022-02-16 21:05:11 -0800162
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800163ts_project(
Philipp Schrader54047962022-02-16 21:05:11 -0800164 name = "build_tests_ts",
165 srcs = ["basic.ts"],
166)
167
Brian Silverman8751d482022-05-18 23:28:44 -0700168rust_library(
169 name = "rust_in_cc_rs",
170 srcs = ["rust_in_cc.rs"],
Brian Silvermana8ad1af2022-07-23 16:05:12 -0700171 target_compatible_with = ["//tools/platforms/rust:has_support"],
Brian Silverman8751d482022-05-18 23:28:44 -0700172)
173
174cc_test(
175 name = "rust_in_cc",
176 srcs = ["rust_in_cc.cc"],
177 target_compatible_with = ["@platforms//os:linux"],
178 deps = [":rust_in_cc_rs"],
179)
Brian Silvermanc270a4d2022-07-23 16:08:06 -0700180
181cc_library(
182 name = "hello_autocxx_cc",
183 hdrs = [
184 "hello_autocxx.h",
185 ],
186)
187
188autocxx_library(
189 name = "hello_autocxx",
190 srcs = ["hello_autocxx.rs"],
191 libs = [":hello_autocxx_cc"],
192 override_cc_toolchain = "@llvm_toolchain//:cc-clang-x86_64-linux",
193 target_compatible_with = ["//tools/platforms/rust:has_support"],
194)
195
Philipp Schrader9e1b9bd2021-12-28 00:15:12 -0800196py_test(
197 name = "upstream_python_test",
198 srcs = [
199 "upstream_python_test.py",
200 ],
James Kuszmaulef420da2023-12-27 12:02:15 -0800201 target_compatible_with = ["@platforms//os:linux"],
Philipp Schrader9e1b9bd2021-12-28 00:15:12 -0800202 deps = [
203 "@pip//matplotlib",
204 "@pip//numpy",
205 "@pip//scipy",
206 ],
207)
Philipp Schrader7520ee62022-12-10 14:04:40 -0800208
209py_binary(
210 name = "pygobject_example",
211 srcs = ["pygobject_example.py"],
212 deps = [
213 "@pip//pygobject",
214 ],
215)
216
217py_binary(
218 name = "matplotlib_example",
219 srcs = ["matplotlib_example.py"],
220 deps = [
221 "@pip//matplotlib",
222 "@pip//pygobject",
223 ],
224)