Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 1 | load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library") |
Alex Perry | 0d0aae3 | 2022-02-09 21:10:17 -0800 | [diff] [blame] | 2 | 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] | 3 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") |
Philipp Schrader | d0e33a4 | 2022-01-22 21:55:15 -0800 | [diff] [blame] | 4 | load("//tools/build_rules:apache.bzl", "apache_wrapper") |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 5 | load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test") |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 6 | load("@npm//@bazel/typescript:index.bzl", "ts_library") |
| 7 | load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite") |
James Kuszmaul | 27da814 | 2019-07-21 16:13:55 -0700 | [diff] [blame] | 8 | |
Brian Silverman | fbe79b8 | 2015-09-12 15:10:54 -0400 | [diff] [blame] | 9 | cc_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 10 | name = "gflags_build_test", |
| 11 | size = "small", |
| 12 | srcs = [ |
| 13 | "gflags.cc", |
| 14 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 15 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 16 | deps = [ |
Brian Silverman | 16a923c | 2018-10-31 19:40:51 -0700 | [diff] [blame] | 17 | "@com_github_gflags_gflags//:gflags", |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 18 | ], |
Brian Silverman | fbe79b8 | 2015-09-12 15:10:54 -0400 | [diff] [blame] | 19 | ) |
Brian Silverman | b67da23 | 2015-09-12 23:50:30 -0400 | [diff] [blame] | 20 | |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 21 | cc_binary( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 22 | name = "tcmalloc_build_test_binary", |
| 23 | srcs = [ |
| 24 | "tcmalloc.cc", |
| 25 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 26 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 27 | ) |
| 28 | |
| 29 | sh_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 30 | name = "tcmalloc_build_test", |
| 31 | size = "small", |
| 32 | srcs = [ |
| 33 | "tcmalloc_test.sh", |
| 34 | ], |
| 35 | data = [ |
| 36 | ":tcmalloc_build_test_binary", |
| 37 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 38 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | 516ceb2 | 2015-11-27 01:29:05 -0500 | [diff] [blame] | 39 | ) |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 40 | |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 41 | cc_proto_library( |
| 42 | name = "proto_build_test_library", |
| 43 | srcs = ["proto.proto"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 44 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 45 | deps = [ |
| 46 | ":proto_build_test_library_base", |
| 47 | "@com_google_protobuf//:cc_wkt_protos", |
| 48 | ], |
Parker Schuh | 971588a | 2017-03-01 22:15:04 -0800 | [diff] [blame] | 49 | ) |
| 50 | |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 51 | cc_proto_library( |
| 52 | name = "proto_build_test_library_base", |
| 53 | srcs = ["proto_base.proto"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 54 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 55 | ) |
| 56 | |
| 57 | cc_test( |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 58 | name = "proto_build_test", |
| 59 | size = "small", |
| 60 | srcs = [ |
| 61 | "proto.cc", |
| 62 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 63 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | f972444 | 2018-10-28 20:30:21 -0700 | [diff] [blame] | 64 | deps = [ |
| 65 | ":proto_build_test_library", |
| 66 | "//aos/testing:googletest", |
| 67 | ], |
Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame] | 68 | ) |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 69 | |
Brian Silverman | 2876027 | 2020-02-02 13:21:51 -0800 | [diff] [blame] | 70 | flatbuffer_py_library( |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 71 | name = "test_python_fbs", |
| 72 | srcs = ["test.fbs"], |
| 73 | namespace = "aos.examples", |
| 74 | tables = [ |
| 75 | "Foo", |
| 76 | "Bar", |
| 77 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 78 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 79 | visibility = ["//visibility:public"], |
| 80 | ) |
| 81 | |
Alex Perry | 0d0aae3 | 2022-02-09 21:10:17 -0800 | [diff] [blame] | 82 | flatbuffer_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 Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 90 | py_test( |
| 91 | name = "python_fbs", |
| 92 | srcs = ["python_fbs.py"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 93 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | f385c46 | 2019-12-24 09:37:34 -0800 | [diff] [blame] | 94 | deps = [":test_python_fbs"], |
| 95 | ) |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 96 | |
| 97 | py_test( |
| 98 | name = "python3_opencv", |
| 99 | srcs = ["python_opencv.py"], |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 100 | main = "python_opencv.py", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 101 | target_compatible_with = ["@platforms//os:linux"], |
Brian Silverman | 4fe44ea | 2020-02-02 12:56:42 -0800 | [diff] [blame] | 102 | deps = ["@opencv_contrib_nonfree_amd64//:python_opencv"], |
| 103 | ) |
James Kuszmaul | c91e440 | 2020-05-10 18:47:20 -0700 | [diff] [blame] | 104 | |
| 105 | py_test( |
| 106 | name = "python_jinja2", |
| 107 | srcs = ["python_jinja2.py"], |
| 108 | srcs_version = "PY2AND3", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 109 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | c91e440 | 2020-05-10 18:47:20 -0700 | [diff] [blame] | 110 | deps = ["@python_jinja2"], |
| 111 | ) |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 112 | |
| 113 | go_binary( |
| 114 | name = "hello_go", |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 115 | embed = [":build_tests_lib"], |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 116 | target_compatible_with = ["@platforms//cpu:x86_64"], |
Philipp Schrader | 37fdbb6 | 2021-12-18 00:30:37 -0800 | [diff] [blame] | 117 | visibility = ["//visibility:public"], |
| 118 | ) |
| 119 | |
| 120 | go_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 Schrader | 69082a0 | 2022-01-22 16:49:38 -0800 | [diff] [blame] | 126 | deps = ["//build_tests/go_greeter"], |
Philipp Schrader | 73e5660 | 2021-12-06 21:37:30 -0800 | [diff] [blame] | 127 | ) |
Philipp Schrader | d0e33a4 | 2022-01-22 21:55:15 -0800 | [diff] [blame] | 128 | |
| 129 | py_binary( |
| 130 | name = "dummy_http_server", |
| 131 | srcs = ["dummy_http_server.py"], |
| 132 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 133 | ) |
| 134 | |
| 135 | apache_wrapper( |
| 136 | name = "apache_https_demo", |
| 137 | binary = ":dummy_http_server", |
| 138 | target_compatible_with = ["@platforms//cpu:x86_64"], |
| 139 | ) |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 140 | |
| 141 | rust_library( |
| 142 | name = "hello_lib", |
| 143 | srcs = ["hello_lib.rs"], |
| 144 | target_compatible_with = ["@platforms//os:linux"], |
| 145 | ) |
| 146 | |
| 147 | rust_test( |
| 148 | name = "hello_lib_test", |
Brian Silverman | 847121b | 2022-03-09 15:48:08 -0800 | [diff] [blame] | 149 | crate = ":hello_lib", |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 150 | target_compatible_with = ["@platforms//os:linux"], |
Ravago Jones | 1680980 | 2021-11-18 20:40:03 -0800 | [diff] [blame] | 151 | ) |
| 152 | |
| 153 | rust_binary( |
| 154 | name = "rust_hello", |
| 155 | srcs = ["rust_hello.rs"], |
| 156 | target_compatible_with = ["@platforms//os:linux"], |
| 157 | deps = [":hello_lib"], |
| 158 | ) |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 159 | |
| 160 | ts_library( |
| 161 | name = "build_tests_ts", |
| 162 | srcs = ["basic.ts"], |
| 163 | ) |
| 164 | |
| 165 | ts_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 | |
| 175 | karma_web_test_suite( |
| 176 | name = "karma", |
| 177 | testonly = True, |
| 178 | target_compatible_with = ["@platforms//os:linux"], |
| 179 | deps = [":ts_test"], |
| 180 | ) |
Brian Silverman | 8751d48 | 2022-05-18 23:28:44 -0700 | [diff] [blame^] | 181 | |
| 182 | rust_library( |
| 183 | name = "rust_in_cc_rs", |
| 184 | srcs = ["rust_in_cc.rs"], |
| 185 | target_compatible_with = ["@platforms//os:linux"], |
| 186 | ) |
| 187 | |
| 188 | cc_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 | ) |