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