blob: 24fdad842a0d49338c86baded89c2f08f5cc27ef [file] [log] [blame]
Austin Schuhf9724442018-10-28 20:30:21 -07001load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
Alex Perry0d0aae32022-02-09 21:10:17 -08002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_go_library", "flatbuffer_py_library")
Philipp Schrader37fdbb62021-12-18 00:30:37 -08003load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
Philipp Schraderd0e33a42022-01-22 21:55:15 -08004load("//tools/build_rules:apache.bzl", "apache_wrapper")
Ravago Jones16809802021-11-18 20:40:03 -08005load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
Philipp Schrader54047962022-02-16 21:05:11 -08006load("@npm//@bazel/typescript:index.bzl", "ts_library")
7load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite")
James Kuszmaul27da8142019-07-21 16:13:55 -07008
Brian Silvermanfbe79b82015-09-12 15:10:54 -04009cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070010 name = "gflags_build_test",
11 size = "small",
12 srcs = [
13 "gflags.cc",
14 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080015 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070016 deps = [
Brian Silverman16a923c2018-10-31 19:40:51 -070017 "@com_github_gflags_gflags//:gflags",
Austin Schuhf9724442018-10-28 20:30:21 -070018 ],
Brian Silvermanfbe79b82015-09-12 15:10:54 -040019)
Brian Silvermanb67da232015-09-12 23:50:30 -040020
Brian Silverman516ceb22015-11-27 01:29:05 -050021cc_binary(
Austin Schuhf9724442018-10-28 20:30:21 -070022 name = "tcmalloc_build_test_binary",
23 srcs = [
24 "tcmalloc.cc",
25 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080026 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050027)
28
29sh_test(
Austin Schuhf9724442018-10-28 20:30:21 -070030 name = "tcmalloc_build_test",
31 size = "small",
32 srcs = [
33 "tcmalloc_test.sh",
34 ],
35 data = [
36 ":tcmalloc_build_test_binary",
37 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080038 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050039)
Brian Silvermaneb16fa42016-02-20 15:29:56 -050040
Austin Schuhf9724442018-10-28 20:30:21 -070041cc_proto_library(
42 name = "proto_build_test_library",
43 srcs = ["proto.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080044 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070045 deps = [
46 ":proto_build_test_library_base",
47 "@com_google_protobuf//:cc_wkt_protos",
48 ],
Parker Schuh971588a2017-03-01 22:15:04 -080049)
50
Austin Schuhf9724442018-10-28 20:30:21 -070051cc_proto_library(
52 name = "proto_build_test_library_base",
53 srcs = ["proto_base.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080054 target_compatible_with = ["@platforms//os:linux"],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050055)
56
57cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070058 name = "proto_build_test",
59 size = "small",
60 srcs = [
61 "proto.cc",
62 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080063 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070064 deps = [
65 ":proto_build_test_library",
66 "//aos/testing:googletest",
67 ],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050068)
James Kuszmaulf385c462019-12-24 09:37:34 -080069
Brian Silverman28760272020-02-02 13:21:51 -080070flatbuffer_py_library(
James Kuszmaulf385c462019-12-24 09:37:34 -080071 name = "test_python_fbs",
72 srcs = ["test.fbs"],
73 namespace = "aos.examples",
74 tables = [
75 "Foo",
76 "Bar",
77 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080078 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080079 visibility = ["//visibility:public"],
80)
81
Alex Perry0d0aae32022-02-09 21:10:17 -080082flatbuffer_go_library(
83 name = "test_go_fbs",
84 srcs = ["test.fbs"],
85 importpath = "github.com/frc971/971-Robot-Code/build_tests/fbs",
86 target_compatible_with = ["@platforms//cpu:x86_64"],
87 visibility = ["//visibility:public"],
88)
89
James Kuszmaulf385c462019-12-24 09:37:34 -080090py_test(
91 name = "python_fbs",
92 srcs = ["python_fbs.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080093 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080094 deps = [":test_python_fbs"],
95)
Brian Silverman4fe44ea2020-02-02 12:56:42 -080096
97py_test(
98 name = "python3_opencv",
99 srcs = ["python_opencv.py"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800100 main = "python_opencv.py",
Philipp Schraderdada1072020-11-24 11:34:46 -0800101 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800102 deps = ["@opencv_contrib_nonfree_amd64//:python_opencv"],
103)
James Kuszmaulc91e4402020-05-10 18:47:20 -0700104
105py_test(
106 name = "python_jinja2",
107 srcs = ["python_jinja2.py"],
108 srcs_version = "PY2AND3",
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulc91e4402020-05-10 18:47:20 -0700110 deps = ["@python_jinja2"],
111)
Philipp Schrader73e56602021-12-06 21:37:30 -0800112
113go_binary(
114 name = "hello_go",
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800115 embed = [":build_tests_lib"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800116 target_compatible_with = ["@platforms//cpu:x86_64"],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800117 visibility = ["//visibility:public"],
118)
119
120go_library(
121 name = "build_tests_lib",
122 srcs = ["hello.go"],
123 importpath = "github.com/frc971/971-Robot-Code/build_tests",
124 target_compatible_with = ["@platforms//cpu:x86_64"],
125 visibility = ["//visibility:private"],
Philipp Schrader69082a02022-01-22 16:49:38 -0800126 deps = ["//build_tests/go_greeter"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800127)
Philipp Schraderd0e33a42022-01-22 21:55:15 -0800128
129py_binary(
130 name = "dummy_http_server",
131 srcs = ["dummy_http_server.py"],
132 target_compatible_with = ["@platforms//cpu:x86_64"],
133)
134
135apache_wrapper(
136 name = "apache_https_demo",
137 binary = ":dummy_http_server",
138 target_compatible_with = ["@platforms//cpu:x86_64"],
139)
Ravago Jones16809802021-11-18 20:40:03 -0800140
141rust_library(
142 name = "hello_lib",
143 srcs = ["hello_lib.rs"],
144 target_compatible_with = ["@platforms//os:linux"],
145)
146
147rust_test(
148 name = "hello_lib_test",
Brian Silverman847121b2022-03-09 15:48:08 -0800149 crate = ":hello_lib",
Ravago Jones16809802021-11-18 20:40:03 -0800150 target_compatible_with = ["@platforms//os:linux"],
Ravago Jones16809802021-11-18 20:40:03 -0800151)
152
153rust_binary(
154 name = "rust_hello",
155 srcs = ["rust_hello.rs"],
156 target_compatible_with = ["@platforms//os:linux"],
157 deps = [":hello_lib"],
158)
Philipp Schrader54047962022-02-16 21:05:11 -0800159
160ts_library(
161 name = "build_tests_ts",
162 srcs = ["basic.ts"],
163)
164
165ts_library(
166 name = "ts_test",
167 testonly = True,
168 srcs = ["basic_test.ts"],
169 deps = [
170 ":build_tests_ts",
171 "@npm//@types/jasmine",
172 ],
173)
174
175karma_web_test_suite(
176 name = "karma",
177 testonly = True,
178 target_compatible_with = ["@platforms//os:linux"],
179 deps = [":ts_test"],
180)
Brian Silverman8751d482022-05-18 23:28:44 -0700181
182rust_library(
183 name = "rust_in_cc_rs",
184 srcs = ["rust_in_cc.rs"],
185 target_compatible_with = ["@platforms//os:linux"],
186)
187
188cc_test(
189 name = "rust_in_cc",
190 srcs = ["rust_in_cc.cc"],
191 target_compatible_with = ["@platforms//os:linux"],
192 deps = [":rust_in_cc_rs"],
193)