Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | # gn-format disable |
| 16 | import("//build_overrides/pigweed.gni") |
| 17 | |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 18 | import("$dir_pw_build/facade.gni") |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 19 | import("$dir_pw_build/target_types.gni") |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 20 | import("$dir_pw_docgen/docs.gni") |
karthik bharadwaj | eabe9a2 | 2020-04-14 09:28:28 -0700 | [diff] [blame] | 21 | import("$dir_pw_fuzzer/fuzzer.gni") |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 22 | import("$dir_pw_unit_test/test.gni") |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 23 | import("backend.gni") |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 24 | config("default_config") { |
| 25 | include_dirs = [ "public" ] |
| 26 | } |
| 27 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 28 | pw_source_set("pw_tokenizer") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 29 | public_configs = [ ":default_config" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 30 | public_deps = [ |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 31 | dir_pw_preprocessor, |
| 32 | dir_pw_span, |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 33 | ] |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 34 | deps = [ dir_pw_varint ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 35 | public = [ |
| 36 | "public/pw_tokenizer/pw_tokenizer_65599_fixed_length_hash.h", |
| 37 | "public/pw_tokenizer/tokenize.h", |
| 38 | ] |
| 39 | sources = [ |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 40 | "encode_args.cc", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 41 | "public/pw_tokenizer/config.h", |
| 42 | "public/pw_tokenizer/internal/argument_types.h", |
| 43 | "public/pw_tokenizer/internal/argument_types_macro_4_byte.h", |
| 44 | "public/pw_tokenizer/internal/argument_types_macro_8_byte.h", |
| 45 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_128_hash_macro.h", |
| 46 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_80_hash_macro.h", |
| 47 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_96_hash_macro.h", |
| 48 | "public/pw_tokenizer/internal/tokenize_string.h", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 49 | "pw_tokenizer_private/encode_args.h", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 50 | "tokenize.cc", |
| 51 | ] |
Wyatt Hepler | a8557ef | 2020-05-04 16:29:23 -0700 | [diff] [blame] | 52 | friend = [ ":*" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 53 | } |
| 54 | |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 55 | # As a temporary workaround, if no backend is set, use an empty test backend so |
| 56 | # that the test can define the handler function. |
| 57 | # TODO(hepler): Switch this to a facade test when available. |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 58 | if (pw_tokenizer_GLOBAL_HANDLER_BACKEND == "" && |
| 59 | pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND == "") { |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 60 | # This is an empty library to use as the backend for global_handler and |
| 61 | # global_handler_with_payload tests. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 62 | pw_source_set("test_backend") { |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 63 | visibility = [ ":*" ] |
| 64 | } |
| 65 | |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 66 | pw_tokenizer_GLOBAL_HANDLER_BACKEND = ":test_backend" |
| 67 | pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND = ":test_backend" |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 68 | |
| 69 | enable_global_handler_test = true |
| 70 | } else { |
| 71 | enable_global_handler_test = false |
| 72 | } |
| 73 | |
| 74 | pw_facade("global_handler") { |
| 75 | facade_name = "global_handler_facade" |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 76 | backend = pw_tokenizer_GLOBAL_HANDLER_BACKEND |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 77 | |
| 78 | public_configs = [ ":default_config" ] |
| 79 | public = [ "public/pw_tokenizer/tokenize_to_global_handler.h" ] |
| 80 | sources = [ "tokenize_to_global_handler.cc" ] |
| 81 | public_deps = [ ":pw_tokenizer" ] |
| 82 | } |
| 83 | |
| 84 | pw_facade("global_handler_with_payload") { |
| 85 | facade_name = "global_handler_with_payload_facade" |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 86 | backend = pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 87 | |
| 88 | public_configs = [ ":default_config" ] |
| 89 | public = [ "public/pw_tokenizer/tokenize_to_global_handler_with_payload.h" ] |
| 90 | sources = [ "tokenize_to_global_handler_with_payload.cc" ] |
| 91 | public_deps = [ ":pw_tokenizer" ] |
| 92 | } |
| 93 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 94 | pw_source_set("base64") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 95 | public_configs = [ ":default_config" ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 96 | public = [ "public/pw_tokenizer/base64.h" ] |
Wyatt Hepler | a8557ef | 2020-05-04 16:29:23 -0700 | [diff] [blame] | 97 | sources = [ "base64.cc" ] |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 98 | public_deps = [ |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 99 | dir_pw_preprocessor, |
| 100 | dir_pw_span, |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 101 | ] |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 102 | deps = [ dir_pw_base64 ] |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 103 | } |
| 104 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 105 | pw_source_set("decoder") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 106 | public_configs = [ ":default_config" ] |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 107 | public_deps = [ dir_pw_span ] |
| 108 | deps = [ dir_pw_varint ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 109 | public = [ |
| 110 | "public/pw_tokenizer/detokenize.h", |
| 111 | "public/pw_tokenizer/token_database.h", |
| 112 | ] |
| 113 | sources = [ |
| 114 | "decode.cc", |
| 115 | "detokenize.cc", |
| 116 | "public/pw_tokenizer/internal/decode.h", |
| 117 | "token_database.cc", |
| 118 | ] |
Wyatt Hepler | a8557ef | 2020-05-04 16:29:23 -0700 | [diff] [blame] | 119 | friend = [ ":*" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | # Executable for generating test data for the C++ and Python detokenizers. This |
| 123 | # target should only be built for the host. |
Alexei Frolov | 2e55ee2 | 2020-06-17 17:00:10 -0700 | [diff] [blame] | 124 | pw_executable("generate_decoding_test_data") { |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 125 | deps = [ |
| 126 | ":decoder", |
| 127 | ":pw_tokenizer", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 128 | dir_pw_varint, |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 129 | ] |
Aaron Green | b3ae1dc | 2020-04-13 11:37:05 -0700 | [diff] [blame] | 130 | sources = [ |
| 131 | "generate_decoding_test_data.cc", |
| 132 | "tokenize_test_fakes.cc", |
| 133 | ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Wyatt Hepler | bc25497 | 2020-01-06 18:35:30 -0800 | [diff] [blame] | 136 | # Executable for generating a test ELF file for elf_reader_test.py. A host |
| 137 | # version of this binary is checked in for use in elf_reader_test.py. |
Alexei Frolov | 2e55ee2 | 2020-06-17 17:00:10 -0700 | [diff] [blame] | 138 | pw_executable("elf_reader_test_binary") { |
Wyatt Hepler | bc25497 | 2020-01-06 18:35:30 -0800 | [diff] [blame] | 139 | deps = [ |
| 140 | ":pw_tokenizer", |
| 141 | "$dir_pw_varint", |
| 142 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 143 | sources = [ "py/elf_reader_test_binary.c" ] |
Wyatt Hepler | bc25497 | 2020-01-06 18:35:30 -0800 | [diff] [blame] | 144 | ldflags = [ "-Wl,--unresolved-symbols=ignore-all" ] # main is not defined |
| 145 | } |
| 146 | |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 147 | pw_test_group("tests") { |
| 148 | tests = [ |
| 149 | ":argument_types_test", |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 150 | ":base64_test", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 151 | ":decode_test", |
karthik bharadwaj | eabe9a2 | 2020-04-14 09:28:28 -0700 | [diff] [blame] | 152 | ":detokenize_fuzzer", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 153 | ":detokenize_test", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 154 | ":global_handlers_test", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 155 | ":hash_test", |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 156 | ":simple_tokenize_test_cpp11", |
| 157 | ":simple_tokenize_test_cpp14", |
| 158 | ":simple_tokenize_test_cpp17", |
karthik bharadwaj | 2ee244b | 2020-04-16 14:08:22 -0700 | [diff] [blame] | 159 | ":token_database_fuzzer", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 160 | ":token_database_test", |
| 161 | ":tokenize_test", |
| 162 | ] |
| 163 | group_deps = [ |
| 164 | "$dir_pw_preprocessor:tests", |
| 165 | "$dir_pw_span:tests", |
| 166 | "$dir_pw_status:tests", |
| 167 | ] |
| 168 | } |
| 169 | |
| 170 | pw_test("argument_types_test") { |
| 171 | sources = [ |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 172 | "argument_types_test.cc", |
Michael Spang | a99220e | 2020-06-11 20:07:16 -0400 | [diff] [blame] | 173 | "argument_types_test_c.c", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 174 | "pw_tokenizer_private/argument_types_test.h", |
Aaron Green | b3ae1dc | 2020-04-13 11:37:05 -0700 | [diff] [blame] | 175 | "tokenize_test_fakes.cc", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 176 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 177 | deps = [ ":pw_tokenizer" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 178 | } |
| 179 | |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 180 | pw_test("base64_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 181 | sources = [ "base64_test.cc" ] |
| 182 | deps = [ ":base64" ] |
Wyatt Hepler | 3c2e952 | 2020-01-09 16:08:54 -0800 | [diff] [blame] | 183 | } |
| 184 | |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 185 | pw_test("decode_test") { |
| 186 | sources = [ |
| 187 | "decode_test.cc", |
| 188 | "pw_tokenizer_private/tokenized_string_decoding_test_data.h", |
| 189 | "pw_tokenizer_private/varint_decoding_test_data.h", |
| 190 | ] |
| 191 | deps = [ |
| 192 | ":decoder", |
| 193 | "$dir_pw_varint", |
| 194 | ] |
| 195 | } |
| 196 | |
| 197 | pw_test("detokenize_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 198 | sources = [ "detokenize_test.cc" ] |
| 199 | deps = [ ":decoder" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 200 | } |
| 201 | |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 202 | pw_test("global_handlers_test") { |
| 203 | sources = [ |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 204 | "global_handlers_test.cc", |
Michael Spang | a99220e | 2020-06-11 20:07:16 -0400 | [diff] [blame] | 205 | "global_handlers_test_c.c", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 206 | "pw_tokenizer_private/tokenize_test.h", |
| 207 | ] |
| 208 | deps = [ |
| 209 | ":global_handler", |
| 210 | ":global_handler_with_payload", |
| 211 | ] |
| 212 | |
| 213 | # TODO(hepler): Switch this to a facade test when available. |
| 214 | enable_if = enable_global_handler_test |
| 215 | } |
| 216 | |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 217 | pw_test("hash_test") { |
| 218 | sources = [ |
| 219 | "hash_test.cc", |
| 220 | "pw_tokenizer_private/generated_hash_test_cases.h", |
Aaron Green | b3ae1dc | 2020-04-13 11:37:05 -0700 | [diff] [blame] | 221 | "tokenize_test_fakes.cc", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 222 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 223 | deps = [ ":pw_tokenizer" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 224 | } |
| 225 | |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 226 | # Fully test C++11 and C++14 compatibility by compiling all sources as C++11 or |
| 227 | # C++14. |
| 228 | _simple_tokenize_test_sources = [ |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 229 | "$dir_pw_varint/public/pw_varint/varint.h", |
| 230 | "$dir_pw_varint/varint.cc", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 231 | "encode_args.cc", |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 232 | "public/pw_tokenizer/config.h", |
| 233 | "public/pw_tokenizer/internal/argument_types.h", |
| 234 | "public/pw_tokenizer/internal/argument_types_macro_4_byte.h", |
| 235 | "public/pw_tokenizer/internal/argument_types_macro_8_byte.h", |
| 236 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_128_hash_macro.h", |
| 237 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_80_hash_macro.h", |
| 238 | "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_96_hash_macro.h", |
| 239 | "public/pw_tokenizer/internal/tokenize_string.h", |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 240 | "public/pw_tokenizer/pw_tokenizer_65599_fixed_length_hash.h", |
| 241 | "public/pw_tokenizer/tokenize.h", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 242 | "public/pw_tokenizer/tokenize_to_global_handler.h", |
| 243 | "public/pw_tokenizer/tokenize_to_global_handler_with_payload.h", |
| 244 | "pw_tokenizer_private/encode_args.h", |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 245 | "simple_tokenize_test.cc", |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 246 | "tokenize.cc", |
Wyatt Hepler | 6639c45 | 2020-05-06 11:43:07 -0700 | [diff] [blame] | 247 | "tokenize_to_global_handler.cc", |
| 248 | "tokenize_to_global_handler_with_payload.cc", |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 249 | ] |
| 250 | _simple_tokenize_test_configs = [ |
| 251 | ":default_config", |
| 252 | "$dir_pw_varint:default_config", |
| 253 | ] |
| 254 | |
| 255 | pw_test("simple_tokenize_test_cpp11") { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 256 | remove_configs = [ "$dir_pw_build:cpp17" ] |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 257 | configs = [ "$dir_pw_build:cpp11" ] + _simple_tokenize_test_configs |
| 258 | sources = _simple_tokenize_test_sources |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 259 | deps = [ dir_pw_preprocessor ] |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | pw_test("simple_tokenize_test_cpp14") { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 263 | remove_configs = [ "$dir_pw_build:cpp17" ] |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 264 | configs = [ "$dir_pw_build:cpp14" ] + _simple_tokenize_test_configs |
| 265 | sources = _simple_tokenize_test_sources |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 266 | deps = [ dir_pw_preprocessor ] |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | pw_test("simple_tokenize_test_cpp17") { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 270 | configs = _simple_tokenize_test_configs |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 271 | sources = _simple_tokenize_test_sources |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 272 | deps = [ dir_pw_preprocessor ] |
Wyatt Hepler | a6d5cc6 | 2020-01-17 14:15:40 -0800 | [diff] [blame] | 273 | } |
| 274 | |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 275 | pw_test("token_database_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 276 | sources = [ "token_database_test.cc" ] |
| 277 | deps = [ ":decoder" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | pw_test("tokenize_test") { |
| 281 | sources = [ |
| 282 | "pw_tokenizer_private/tokenize_test.h", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 283 | "tokenize_test.cc", |
Michael Spang | a99220e | 2020-06-11 20:07:16 -0400 | [diff] [blame] | 284 | "tokenize_test_c.c", |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 285 | ] |
| 286 | deps = [ |
| 287 | ":pw_tokenizer", |
| 288 | "$dir_pw_varint", |
| 289 | ] |
| 290 | } |
| 291 | |
karthik bharadwaj | 2ee244b | 2020-04-16 14:08:22 -0700 | [diff] [blame] | 292 | pw_fuzzer("token_database_fuzzer") { |
| 293 | sources = [ "token_database_fuzzer.cc" ] |
| 294 | deps = [ |
| 295 | ":decoder", |
| 296 | "$dir_pw_fuzzer", |
| 297 | "$dir_pw_preprocessor", |
| 298 | "$dir_pw_span", |
| 299 | ] |
| 300 | } |
| 301 | |
karthik bharadwaj | eabe9a2 | 2020-04-14 09:28:28 -0700 | [diff] [blame] | 302 | pw_fuzzer("detokenize_fuzzer") { |
| 303 | sources = [ "detokenize_fuzzer.cc" ] |
| 304 | deps = [ |
| 305 | ":decoder", |
| 306 | "$dir_pw_fuzzer", |
| 307 | "$dir_pw_preprocessor", |
| 308 | ] |
| 309 | } |
| 310 | |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 311 | declare_args() { |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 312 | # pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS specifies the paths to use for |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 313 | # building Java Native Interface libraries. If no paths are provided, targets |
| 314 | # that require JNI may not build correctly. |
| 315 | # |
| 316 | # Example JNI include paths for a Linux system: |
| 317 | # |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 318 | # pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS = [ |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 319 | # "/usr/local/buildtools/java/jdk/include/", |
| 320 | # "/usr/local/buildtools/java/jdk/include/linux", |
| 321 | # ] |
| 322 | # |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 323 | pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS = [] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | # Create a shared library for the tokenizer JNI wrapper. The include paths for |
| 327 | # the JNI headers must be available in the system or provided with the |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 328 | # pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS variable. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 329 | pw_shared_library("detokenizer_jni") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 330 | public_configs = [ ":default_config" ] |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 331 | include_dirs = pw_JAVA_NATIVE_INTERFACE_INCLUDE_DIRS |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 332 | sources = [ "java/dev/pigweed/tokenizer/detokenizer.cc" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 333 | public_deps = [ |
| 334 | ":decoder", |
| 335 | "$dir_pw_preprocessor", |
| 336 | ] |
| 337 | } |
| 338 | |
| 339 | pw_doc_group("docs") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 340 | sources = [ "docs.rst" ] |
Wyatt Hepler | f5e984a | 2020-04-15 18:15:09 -0700 | [diff] [blame] | 341 | inputs = [ "py/pw_tokenizer/encode.py" ] |
Wyatt Hepler | 80c6ee5 | 2020-01-03 09:54:58 -0800 | [diff] [blame] | 342 | } |