Alex Perry | 0d0aae3 | 2022-02-09 21:10:17 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_go_library", "flatbuffer_py_library") |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 2 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") |
Austin Schuh | 8f99c82 | 2024-05-05 22:43:40 -0700 | [diff] [blame] | 3 | load("@rules_cc//cc:defs.bzl", "cc_proto_library") |
| 4 | load("@rules_proto//proto:defs.bzl", "proto_library") |
Adam Snaider | f560ae9 | 2023-11-07 17:06:21 -0800 | [diff] [blame] | 5 | load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") |
Austin Schuh | 8f99c82 | 2024-05-05 22:43:40 -0700 | [diff] [blame] | 6 | load("//tools/build_rules:apache.bzl", "apache_wrapper") |
Brian Silverman | c270a4d | 2022-07-23 16:08:06 -0700 | [diff] [blame] | 7 | load("//tools/build_rules:autocxx.bzl", "autocxx_library") |
Austin Schuh | 8f99c82 | 2024-05-05 22:43:40 -0700 | [diff] [blame] | 8 | load("//tools/build_rules:js.bzl", "ts_project") |
James Kuszmaul | 27da814 | 2019-07-21 16:13:55 -0700 | [diff] [blame] | 9 | |
Brian Silverman | fbe79b8 | 2015-09-12 15:10:54 -0400 | [diff] [blame] | 10 | cc_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 11 | name = "gflags_build_test", |
| 12 | size = "small", |
| 13 | srcs = [ |
| 14 | "gflags.cc", |
| 15 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 16 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 17 | deps = [ |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 18 | "@com_google_absl//absl/flags:flag", |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 19 | ], |
Brian Silverman | fbe79b8 | 2015-09-12 15:10:54 -0400 | [diff] [blame] | 20 | ) |
Brian Silverman | b67da23 | 2015-09-12 23:50:30 -0400 | [diff] [blame] | 21 | |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 22 | cc_binary( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 23 | name = "tcmalloc_build_test_binary", |
| 24 | srcs = [ |
| 25 | "tcmalloc.cc", |
| 26 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 27 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 28 | ) |
| 29 | |
| 30 | sh_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 31 | name = "tcmalloc_build_test", |
| 32 | size = "small", |
| 33 | srcs = [ |
| 34 | "tcmalloc_test.sh", |
| 35 | ], |
| 36 | data = [ |
| 37 | ":tcmalloc_build_test_binary", |
| 38 | ], |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame^] | 39 | # TODO(austin): Turn this back on when we get memory instrumentation figured out for tcmalloc for --die_on_malloc |
| 40 | tags = ["manual"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 41 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 42 | ) |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 43 | |
Adam Snaider | 13d48d9 | 2023-08-03 12:20:15 -0700 | [diff] [blame] | 44 | proto_library( |
| 45 | name = "proto_build_test_library_proto", |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 46 | srcs = ["proto.proto"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 47 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 48 | deps = [ |
| 49 | ":proto_build_test_library_base", |
Adam Snaider | 13d48d9 | 2023-08-03 12:20:15 -0700 | [diff] [blame] | 50 | "@com_google_protobuf//:empty_proto", |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 51 | ], |
Parker Schuh | 971588a | 2017-03-01 22:15:04 -0800 | [diff] [blame] | 52 | ) |
| 53 | |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 54 | cc_proto_library( |
Adam Snaider | 13d48d9 | 2023-08-03 12:20:15 -0700 | [diff] [blame] | 55 | name = "proto_build_test_library", |
| 56 | deps = [":proto_build_test_library_proto"], |
| 57 | ) |
| 58 | |
| 59 | proto_library( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 60 | name = "proto_build_test_library_base", |
| 61 | srcs = ["proto_base.proto"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 62 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 63 | ) |
| 64 | |
| 65 | cc_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 66 | name = "proto_build_test", |
| 67 | size = "small", |
| 68 | srcs = [ |
| 69 | "proto.cc", |
| 70 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 71 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 72 | deps = [ |
| 73 | ":proto_build_test_library", |
| 74 | "//aos/testing:googletest", |
| 75 | ], |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 76 | ) |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 77 | |
Brian Silverman | 2876027 | 2020-02-02 13:21:51 -0800 | [diff] [blame] | 78 | flatbuffer_py_library( |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 79 | name = "test_python_fbs", |
| 80 | srcs = ["test.fbs"], |
| 81 | namespace = "aos.examples", |
| 82 | tables = [ |
| 83 | "Foo", |
| 84 | "Bar", |
| 85 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 86 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 87 | visibility = ["//visibility:public"], |
| 88 | ) |
| 89 | |
Alex Perry | 0d0aae3 | 2022-02-09 21:10:17 -0800 | [diff] [blame] | 90 | flatbuffer_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 Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 98 | py_test( |
| 99 | name = "python_fbs", |
| 100 | srcs = ["python_fbs.py"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 101 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 102 | deps = [":test_python_fbs"], |
| 103 | ) |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 104 | |
| 105 | py_test( |
| 106 | name = "python3_opencv", |
| 107 | srcs = ["python_opencv.py"], |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 108 | main = "python_opencv.py", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 109 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | ebb658f | 2022-09-17 17:31:09 -0700 | [diff] [blame] | 110 | deps = ["@pip//opencv_python"], |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 111 | ) |
James Kuszmaul | c91e440 | 2020-05-10 18:47:20 -0700 | [diff] [blame] | 112 | |
| 113 | py_test( |
| 114 | name = "python_jinja2", |
| 115 | srcs = ["python_jinja2.py"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 116 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | ebb658f | 2022-09-17 17:31:09 -0700 | [diff] [blame] | 117 | deps = ["@pip//jinja2"], |
James Kuszmaul | c91e440 | 2020-05-10 18:47:20 -0700 | [diff] [blame] | 118 | ) |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 119 | |
| 120 | go_binary( |
| 121 | name = "hello_go", |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 122 | embed = [":build_tests_lib"], |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 123 | target_compatible_with = ["@platforms//cpu:x86_64"], |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 124 | visibility = ["//visibility:public"], |
| 125 | ) |
| 126 | |
| 127 | go_library( |
| 128 | name = "build_tests_lib", |
Brian Silverman | c270a4d | 2022-07-23 16:08:06 -0700 | [diff] [blame] | 129 | srcs = [ |
| 130 | "hello.go", |
| 131 | # Not sure why gazelle wants this here? |
| 132 | "hello_autocxx.h", |
| 133 | ], |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 134 | importpath = "github.com/frc971/971-Robot-Code/build_tests", |
| 135 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 136 | visibility = ["//visibility:private"], |
Philipp Schrader | 69082a0 | 2022-01-22 16:49:38 -0800 | [diff] [blame] | 137 | deps = ["//build_tests/go_greeter"], |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 138 | ) |
Philipp Schrader | d0e33a4 | 2022-01-22 21:55:15 -0800 | [diff] [blame] | 139 | |
| 140 | py_binary( |
| 141 | name = "dummy_http_server", |
| 142 | srcs = ["dummy_http_server.py"], |
| 143 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 144 | ) |
| 145 | |
| 146 | apache_wrapper( |
| 147 | name = "apache_https_demo", |
| 148 | binary = ":dummy_http_server", |
| 149 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 150 | ) |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 151 | |
| 152 | rust_library( |
| 153 | name = "hello_lib", |
| 154 | srcs = ["hello_lib.rs"], |
Brian Silverman | a8ad1af | 2022-07-23 16:05:12 -0700 | [diff] [blame] | 155 | target_compatible_with = ["//tools/platforms/rust:has_support"], |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 156 | ) |
| 157 | |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 158 | rust_binary( |
| 159 | name = "rust_hello", |
| 160 | srcs = ["rust_hello.rs"], |
Brian Silverman | a8ad1af | 2022-07-23 16:05:12 -0700 | [diff] [blame] | 161 | target_compatible_with = ["//tools/platforms/rust:has_support"], |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 162 | deps = [":hello_lib"], |
| 163 | ) |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 164 | |
Philipp Schrader | 3de4dfc | 2023-02-15 20:18:25 -0800 | [diff] [blame] | 165 | ts_project( |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 166 | name = "build_tests_ts", |
| 167 | srcs = ["basic.ts"], |
| 168 | ) |
| 169 | |
Brian Silverman | 8751d48 | 2022-05-18 23:28:44 -0700 | [diff] [blame] | 170 | rust_library( |
| 171 | name = "rust_in_cc_rs", |
| 172 | srcs = ["rust_in_cc.rs"], |
Brian Silverman | a8ad1af | 2022-07-23 16:05:12 -0700 | [diff] [blame] | 173 | target_compatible_with = ["//tools/platforms/rust:has_support"], |
Brian Silverman | 8751d48 | 2022-05-18 23:28:44 -0700 | [diff] [blame] | 174 | ) |
| 175 | |
| 176 | cc_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 Silverman | c270a4d | 2022-07-23 16:08:06 -0700 | [diff] [blame] | 182 | |
| 183 | cc_library( |
| 184 | name = "hello_autocxx_cc", |
| 185 | hdrs = [ |
| 186 | "hello_autocxx.h", |
| 187 | ], |
| 188 | ) |
| 189 | |
| 190 | autocxx_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 Schrader | 9e1b9bd | 2021-12-28 00:15:12 -0800 | [diff] [blame] | 198 | py_test( |
| 199 | name = "upstream_python_test", |
| 200 | srcs = [ |
| 201 | "upstream_python_test.py", |
| 202 | ], |
James Kuszmaul | ef420da | 2023-12-27 12:02:15 -0800 | [diff] [blame] | 203 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9e1b9bd | 2021-12-28 00:15:12 -0800 | [diff] [blame] | 204 | deps = [ |
| 205 | "@pip//matplotlib", |
| 206 | "@pip//numpy", |
| 207 | "@pip//scipy", |
| 208 | ], |
| 209 | ) |
Philipp Schrader | 7520ee6 | 2022-12-10 14:04:40 -0800 | [diff] [blame] | 210 | |
| 211 | py_binary( |
| 212 | name = "pygobject_example", |
| 213 | srcs = ["pygobject_example.py"], |
| 214 | deps = [ |
| 215 | "@pip//pygobject", |
| 216 | ], |
| 217 | ) |
| 218 | |
| 219 | py_binary( |
| 220 | name = "matplotlib_example", |
| 221 | srcs = ["matplotlib_example.py"], |
| 222 | deps = [ |
| 223 | "@pip//matplotlib", |
| 224 | "@pip//pygobject", |
| 225 | ], |
| 226 | ) |