blob: 8dd06378e0c5c256def27c6e6299c7c8e57ff68b [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")
James Kuszmaul27da8142019-07-21 16:13:55 -07006
Brian Silvermanfbe79b82015-09-12 15:10:54 -04007cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -07008 name = "gflags_build_test",
9 size = "small",
10 srcs = [
11 "gflags.cc",
12 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080013 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070014 deps = [
Brian Silverman16a923c2018-10-31 19:40:51 -070015 "@com_github_gflags_gflags//:gflags",
Austin Schuhf9724442018-10-28 20:30:21 -070016 ],
Brian Silvermanfbe79b82015-09-12 15:10:54 -040017)
Brian Silvermanb67da232015-09-12 23:50:30 -040018
Brian Silverman516ceb22015-11-27 01:29:05 -050019cc_binary(
Austin Schuhf9724442018-10-28 20:30:21 -070020 name = "tcmalloc_build_test_binary",
21 srcs = [
22 "tcmalloc.cc",
23 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080024 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050025)
26
27sh_test(
Austin Schuhf9724442018-10-28 20:30:21 -070028 name = "tcmalloc_build_test",
29 size = "small",
30 srcs = [
31 "tcmalloc_test.sh",
32 ],
33 data = [
34 ":tcmalloc_build_test_binary",
35 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080036 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman516ceb22015-11-27 01:29:05 -050037)
Brian Silvermaneb16fa42016-02-20 15:29:56 -050038
Austin Schuhf9724442018-10-28 20:30:21 -070039cc_proto_library(
40 name = "proto_build_test_library",
41 srcs = ["proto.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080042 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070043 deps = [
44 ":proto_build_test_library_base",
45 "@com_google_protobuf//:cc_wkt_protos",
46 ],
Parker Schuh971588a2017-03-01 22:15:04 -080047)
48
Austin Schuhf9724442018-10-28 20:30:21 -070049cc_proto_library(
50 name = "proto_build_test_library_base",
51 srcs = ["proto_base.proto"],
Philipp Schraderdada1072020-11-24 11:34:46 -080052 target_compatible_with = ["@platforms//os:linux"],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050053)
54
55cc_test(
Austin Schuhf9724442018-10-28 20:30:21 -070056 name = "proto_build_test",
57 size = "small",
58 srcs = [
59 "proto.cc",
60 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080061 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhf9724442018-10-28 20:30:21 -070062 deps = [
63 ":proto_build_test_library",
64 "//aos/testing:googletest",
65 ],
Brian Silvermaneb16fa42016-02-20 15:29:56 -050066)
James Kuszmaulf385c462019-12-24 09:37:34 -080067
Brian Silverman28760272020-02-02 13:21:51 -080068flatbuffer_py_library(
James Kuszmaulf385c462019-12-24 09:37:34 -080069 name = "test_python_fbs",
70 srcs = ["test.fbs"],
71 namespace = "aos.examples",
72 tables = [
73 "Foo",
74 "Bar",
75 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080076 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080077 visibility = ["//visibility:public"],
78)
79
Alex Perry0d0aae32022-02-09 21:10:17 -080080flatbuffer_go_library(
81 name = "test_go_fbs",
82 srcs = ["test.fbs"],
83 importpath = "github.com/frc971/971-Robot-Code/build_tests/fbs",
84 target_compatible_with = ["@platforms//cpu:x86_64"],
85 visibility = ["//visibility:public"],
86)
87
James Kuszmaulf385c462019-12-24 09:37:34 -080088py_test(
89 name = "python_fbs",
90 srcs = ["python_fbs.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -080091 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf385c462019-12-24 09:37:34 -080092 deps = [":test_python_fbs"],
93)
Brian Silverman4fe44ea2020-02-02 12:56:42 -080094
95py_test(
96 name = "python3_opencv",
97 srcs = ["python_opencv.py"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -080098 main = "python_opencv.py",
Philipp Schraderdada1072020-11-24 11:34:46 -080099 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman4fe44ea2020-02-02 12:56:42 -0800100 deps = ["@opencv_contrib_nonfree_amd64//:python_opencv"],
101)
James Kuszmaulc91e4402020-05-10 18:47:20 -0700102
103py_test(
104 name = "python_jinja2",
105 srcs = ["python_jinja2.py"],
106 srcs_version = "PY2AND3",
Philipp Schraderdada1072020-11-24 11:34:46 -0800107 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulc91e4402020-05-10 18:47:20 -0700108 deps = ["@python_jinja2"],
109)
Philipp Schrader73e56602021-12-06 21:37:30 -0800110
111go_binary(
112 name = "hello_go",
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800113 embed = [":build_tests_lib"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800114 target_compatible_with = ["@platforms//cpu:x86_64"],
Philipp Schrader37fdbb62021-12-18 00:30:37 -0800115 visibility = ["//visibility:public"],
116)
117
118go_library(
119 name = "build_tests_lib",
120 srcs = ["hello.go"],
121 importpath = "github.com/frc971/971-Robot-Code/build_tests",
122 target_compatible_with = ["@platforms//cpu:x86_64"],
123 visibility = ["//visibility:private"],
Philipp Schrader69082a02022-01-22 16:49:38 -0800124 deps = ["//build_tests/go_greeter"],
Philipp Schrader73e56602021-12-06 21:37:30 -0800125)
Philipp Schraderd0e33a42022-01-22 21:55:15 -0800126
127py_binary(
128 name = "dummy_http_server",
129 srcs = ["dummy_http_server.py"],
130 target_compatible_with = ["@platforms//cpu:x86_64"],
131)
132
133apache_wrapper(
134 name = "apache_https_demo",
135 binary = ":dummy_http_server",
136 target_compatible_with = ["@platforms//cpu:x86_64"],
137)
Ravago Jones16809802021-11-18 20:40:03 -0800138
139rust_library(
140 name = "hello_lib",
141 srcs = ["hello_lib.rs"],
142 target_compatible_with = ["@platforms//os:linux"],
143)
144
145rust_test(
146 name = "hello_lib_test",
147 srcs = ["hello_lib.rs"],
148 target_compatible_with = ["@platforms//os:linux"],
149 deps = [":hello_lib"],
150)
151
152rust_binary(
153 name = "rust_hello",
154 srcs = ["rust_hello.rs"],
155 target_compatible_with = ["@platforms//os:linux"],
156 deps = [":hello_lib"],
157)