Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 1 | # Copyright 2019 Google LLC |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of 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, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # Emboss C++ code generator. |
| 16 | |
Ted Pudlik | 4a044db | 2024-04-10 15:56:42 -0700 | [diff] [blame] | 17 | load("@rules_python//python:py_binary.bzl", "py_binary") |
| 18 | load("@rules_python//python:py_library.bzl", "py_library") |
| 19 | load("@rules_python//python:py_test.bzl", "py_test") |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 20 | load(":build_defs.bzl", "emboss_cc_test") |
| 21 | |
| 22 | package( |
Ben Olmstead | 5b019b5 | 2019-09-05 17:13:45 -0700 | [diff] [blame] | 23 | default_visibility = [ |
| 24 | "//visibility:private", |
| 25 | ], |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 26 | features = ["-layering_check"], |
| 27 | ) |
| 28 | |
| 29 | py_binary( |
| 30 | name = "emboss_codegen_cpp", |
| 31 | srcs = ["emboss_codegen_cpp.py"], |
| 32 | python_version = "PY3", |
| 33 | visibility = ["//visibility:public"], |
| 34 | deps = [ |
| 35 | ":header_generator", |
reventlov | 6731fc4 | 2019-10-03 15:23:13 -0700 | [diff] [blame] | 36 | "//compiler/util:ir_pb2", |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 37 | ], |
| 38 | ) |
| 39 | |
| 40 | py_library( |
Jason Graffius | 699bf1a | 2023-06-28 20:15:15 -0400 | [diff] [blame] | 41 | name = "attributes", |
| 42 | srcs = ["attributes.py"], |
Ted Pudlik | 4a044db | 2024-04-10 15:56:42 -0700 | [diff] [blame] | 43 | deps = [], |
Jason Graffius | 699bf1a | 2023-06-28 20:15:15 -0400 | [diff] [blame] | 44 | ) |
| 45 | |
| 46 | py_library( |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 47 | name = "header_generator", |
| 48 | srcs = ["header_generator.py"], |
| 49 | data = [ |
| 50 | "generated_code_templates", |
| 51 | ], |
| 52 | deps = [ |
Jason Graffius | 699bf1a | 2023-06-28 20:15:15 -0400 | [diff] [blame] | 53 | ":attributes", |
reventlov | 6731fc4 | 2019-10-03 15:23:13 -0700 | [diff] [blame] | 54 | "//compiler/back_end/util:code_template", |
Dmitri Prime | 5b38126 | 2023-05-01 23:55:07 -0700 | [diff] [blame] | 55 | "//compiler/util:attribute_util", |
reventlov | 6731fc4 | 2019-10-03 15:23:13 -0700 | [diff] [blame] | 56 | "//compiler/util:ir_pb2", |
| 57 | "//compiler/util:ir_util", |
| 58 | "//compiler/util:name_conversion", |
Ben Olmstead | b9b93c3 | 2024-02-20 21:47:41 +0000 | [diff] [blame] | 59 | "//compiler/util:resources", |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 60 | ], |
| 61 | ) |
| 62 | |
Dmitri Prime | 5b38126 | 2023-05-01 23:55:07 -0700 | [diff] [blame] | 63 | py_test( |
| 64 | name = "header_generator_test", |
| 65 | srcs = ["header_generator_test.py"], |
| 66 | deps = [ |
| 67 | ":header_generator", |
| 68 | "//compiler/front_end:glue", |
Jason Graffius | 9191077 | 2023-05-18 12:43:52 -0400 | [diff] [blame] | 69 | "//compiler/util:test_util", |
Dmitri Prime | 5b38126 | 2023-05-01 23:55:07 -0700 | [diff] [blame] | 70 | ], |
| 71 | ) |
| 72 | |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 73 | emboss_cc_test( |
| 74 | name = "span_se_log_file_status_emb_generated_code_test", |
| 75 | srcs = [ |
| 76 | "testcode/read_log_file_status_test.cc", |
| 77 | ], |
| 78 | deps = [ |
| 79 | "//testdata:span_se_log_file_status_emboss", |
| 80 | "@com_google_googletest//:gtest_main", |
| 81 | ], |
| 82 | ) |
| 83 | |
| 84 | emboss_cc_test( |
| 85 | name = "nested_structure_test", |
| 86 | srcs = [ |
| 87 | "testcode/nested_structure_test.cc", |
| 88 | ], |
| 89 | deps = [ |
| 90 | "//testdata:nested_structure_emboss", |
| 91 | "@com_google_googletest//:gtest_main", |
| 92 | ], |
| 93 | ) |
| 94 | |
| 95 | emboss_cc_test( |
| 96 | name = "alignments_test", |
| 97 | srcs = [ |
| 98 | "testcode/alignments_test.cc", |
| 99 | ], |
| 100 | deps = [ |
| 101 | "//testdata:alignments_emboss", |
| 102 | "@com_google_googletest//:gtest_main", |
| 103 | ], |
| 104 | ) |
| 105 | |
| 106 | emboss_cc_test( |
| 107 | name = "condition_test", |
| 108 | srcs = [ |
| 109 | "testcode/condition_test.cc", |
| 110 | ], |
| 111 | deps = [ |
| 112 | "//testdata:condition_emboss", |
| 113 | "@com_google_googletest//:gtest_main", |
| 114 | ], |
| 115 | ) |
| 116 | |
| 117 | emboss_cc_test( |
| 118 | name = "enum_test", |
| 119 | srcs = [ |
| 120 | "testcode/enum_test.cc", |
| 121 | ], |
| 122 | deps = [ |
| 123 | "//testdata:enum_emboss", |
| 124 | "@com_google_googletest//:gtest_main", |
| 125 | ], |
| 126 | ) |
| 127 | |
| 128 | emboss_cc_test( |
Jason Graffius | 699bf1a | 2023-06-28 20:15:15 -0400 | [diff] [blame] | 129 | name = "enum_case_test", |
| 130 | srcs = [ |
| 131 | "testcode/enum_case_test.cc", |
| 132 | ], |
| 133 | deps = [ |
| 134 | "//testdata:enum_case_emboss", |
| 135 | "@com_google_googletest//:gtest_main", |
| 136 | ], |
| 137 | ) |
| 138 | |
| 139 | emboss_cc_test( |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 140 | name = "explicit_sizes_test", |
| 141 | srcs = [ |
| 142 | "testcode/explicit_sizes_test.cc", |
| 143 | ], |
| 144 | deps = [ |
| 145 | "//testdata:explicit_sizes_emboss", |
| 146 | "@com_google_googletest//:gtest_main", |
| 147 | ], |
| 148 | ) |
| 149 | |
| 150 | emboss_cc_test( |
| 151 | name = "importer_test", |
| 152 | srcs = [ |
| 153 | "testcode/importer_test.cc", |
| 154 | ], |
| 155 | deps = [ |
| 156 | "//testdata:importer_emboss", |
| 157 | "@com_google_googletest//:gtest_main", |
| 158 | ], |
| 159 | ) |
| 160 | |
| 161 | emboss_cc_test( |
Ben Olmstead | 378cd5d | 2023-03-21 00:38:33 +0000 | [diff] [blame] | 162 | name = "importer2_test", |
| 163 | srcs = [ |
| 164 | "testcode/importer2_test.cc", |
| 165 | ], |
| 166 | deps = [ |
| 167 | "//testdata:importer2_emboss", |
| 168 | "@com_google_googletest//:gtest_main", |
| 169 | ], |
| 170 | ) |
| 171 | |
| 172 | emboss_cc_test( |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 173 | name = "uint_sizes_test", |
| 174 | srcs = [ |
| 175 | "testcode/uint_sizes_test.cc", |
| 176 | ], |
| 177 | deps = [ |
| 178 | "//testdata:uint_sizes_emboss", |
| 179 | "@com_google_googletest//:gtest_main", |
| 180 | ], |
| 181 | ) |
| 182 | |
| 183 | emboss_cc_test( |
| 184 | name = "int_sizes_test", |
| 185 | srcs = [ |
| 186 | "testcode/int_sizes_test.cc", |
| 187 | ], |
| 188 | deps = [ |
| 189 | "//testdata:int_sizes_emboss", |
| 190 | "@com_google_googletest//:gtest_main", |
| 191 | ], |
| 192 | ) |
| 193 | |
| 194 | emboss_cc_test( |
| 195 | name = "float_test", |
| 196 | srcs = [ |
| 197 | "testcode/float_test.cc", |
| 198 | ], |
| 199 | deps = [ |
| 200 | "//testdata:float_emboss", |
| 201 | "@com_google_googletest//:gtest_main", |
| 202 | ], |
| 203 | ) |
| 204 | |
| 205 | emboss_cc_test( |
| 206 | name = "dynamic_size_test", |
| 207 | srcs = [ |
| 208 | "testcode/dynamic_size_test.cc", |
| 209 | ], |
| 210 | deps = [ |
| 211 | "//testdata:dynamic_size_emboss", |
| 212 | "@com_google_googletest//:gtest_main", |
| 213 | ], |
| 214 | ) |
| 215 | |
| 216 | emboss_cc_test( |
| 217 | name = "auto_array_size_test", |
| 218 | srcs = [ |
| 219 | "testcode/auto_array_size_test.cc", |
| 220 | ], |
| 221 | deps = [ |
| 222 | "//testdata:auto_array_size_emboss", |
| 223 | "@com_google_googletest//:gtest_main", |
| 224 | ], |
| 225 | ) |
| 226 | |
| 227 | emboss_cc_test( |
| 228 | name = "start_size_range_test", |
| 229 | srcs = [ |
| 230 | "testcode/start_size_range_test.cc", |
| 231 | ], |
| 232 | deps = [ |
| 233 | "//testdata:start_size_range_emboss", |
| 234 | "@com_google_googletest//:gtest_main", |
| 235 | ], |
| 236 | ) |
| 237 | |
| 238 | emboss_cc_test( |
| 239 | name = "bcd_test", |
| 240 | srcs = [ |
| 241 | "testcode/bcd_test.cc", |
| 242 | ], |
| 243 | deps = [ |
| 244 | "//testdata:bcd_emboss", |
| 245 | "@com_google_googletest//:gtest_main", |
| 246 | ], |
| 247 | ) |
| 248 | |
| 249 | emboss_cc_test( |
| 250 | name = "namespace_test", |
| 251 | srcs = [ |
| 252 | "testcode/namespace_test.cc", |
| 253 | ], |
| 254 | deps = [ |
| 255 | "//testdata:absolute_cpp_namespace_emboss", |
| 256 | "//testdata:cpp_namespace_emboss", |
| 257 | "//testdata:no_cpp_namespace_emboss", |
| 258 | "@com_google_googletest//:gtest_main", |
| 259 | ], |
| 260 | ) |
| 261 | |
| 262 | emboss_cc_test( |
| 263 | name = "requires_test", |
| 264 | srcs = [ |
| 265 | "testcode/requires_test.cc", |
| 266 | ], |
| 267 | deps = [ |
| 268 | "//testdata:requires_emboss", |
| 269 | "@com_google_googletest//:gtest_main", |
| 270 | ], |
| 271 | ) |
| 272 | |
| 273 | emboss_cc_test( |
| 274 | name = "subtypes_test", |
| 275 | srcs = [ |
| 276 | "testcode/subtypes_test.cc", |
| 277 | ], |
| 278 | deps = [ |
| 279 | "//testdata:subtypes_emboss", |
| 280 | "@com_google_googletest//:gtest_main", |
| 281 | ], |
| 282 | ) |
| 283 | |
| 284 | emboss_cc_test( |
| 285 | name = "inline_type_test", |
| 286 | srcs = [ |
| 287 | "testcode/inline_type_test.cc", |
| 288 | ], |
| 289 | deps = [ |
| 290 | "//testdata:inline_type_emboss", |
| 291 | "@com_google_googletest//:gtest_main", |
| 292 | ], |
| 293 | ) |
| 294 | |
| 295 | emboss_cc_test( |
| 296 | name = "bits_test", |
| 297 | srcs = [ |
| 298 | "testcode/bits_test.cc", |
| 299 | ], |
| 300 | deps = [ |
reventlov | 6731fc4 | 2019-10-03 15:23:13 -0700 | [diff] [blame] | 301 | "//runtime/cpp:cpp_utils", |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 302 | "//testdata:bits_emboss", |
| 303 | "@com_google_googletest//:gtest_main", |
| 304 | ], |
| 305 | ) |
| 306 | |
| 307 | emboss_cc_test( |
| 308 | name = "anonymous_bits_test", |
| 309 | srcs = [ |
| 310 | "testcode/anonymous_bits_test.cc", |
| 311 | ], |
| 312 | deps = [ |
reventlov | 6731fc4 | 2019-10-03 15:23:13 -0700 | [diff] [blame] | 313 | "//runtime/cpp:cpp_utils", |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 314 | "//testdata:anonymous_bits_emboss", |
| 315 | "@com_google_googletest//:gtest_main", |
| 316 | ], |
| 317 | ) |
| 318 | |
| 319 | emboss_cc_test( |
reventlov | 4000cd0 | 2022-04-05 12:15:39 -0700 | [diff] [blame] | 320 | name = "next_keyword_test", |
| 321 | srcs = [ |
| 322 | "testcode/next_keyword_test.cc", |
| 323 | ], |
| 324 | deps = [ |
| 325 | "//testdata:next_keyword_emboss", |
| 326 | "@com_google_googletest//:gtest_main", |
| 327 | ], |
| 328 | ) |
| 329 | |
| 330 | emboss_cc_test( |
Ben Olmstead | c0d7784 | 2019-07-31 17:34:05 -0700 | [diff] [blame] | 331 | name = "virtual_field_test", |
| 332 | srcs = [ |
| 333 | "testcode/virtual_field_test.cc", |
| 334 | ], |
| 335 | deps = [ |
| 336 | "//testdata:virtual_field_emboss", |
| 337 | "@com_google_googletest//:gtest_main", |
| 338 | ], |
| 339 | ) |
| 340 | |
| 341 | emboss_cc_test( |
| 342 | name = "text_format_test", |
| 343 | srcs = [ |
| 344 | "testcode/text_format_test.cc", |
| 345 | ], |
| 346 | deps = [ |
| 347 | "//testdata:text_format_emboss", |
| 348 | "@com_google_googletest//:gtest_main", |
| 349 | ], |
| 350 | ) |
| 351 | |
| 352 | emboss_cc_test( |
| 353 | name = "parameters_test", |
| 354 | srcs = [ |
| 355 | "testcode/parameters_test.cc", |
| 356 | ], |
| 357 | deps = [ |
| 358 | "//testdata:parameters_emboss", |
| 359 | "@com_google_googletest//:gtest_main", |
| 360 | ], |
| 361 | ) |
| 362 | |
| 363 | emboss_cc_test( |
| 364 | name = "complex_structure_test", |
| 365 | srcs = ["testcode/complex_structure_test.cc"], |
| 366 | deps = [ |
| 367 | "//testdata:complex_structure_emboss", |
| 368 | "@com_google_googletest//:gtest_main", |
| 369 | ], |
| 370 | ) |
Dmitri Prime | ec162e4 | 2020-09-13 23:47:51 -0700 | [diff] [blame] | 371 | |
| 372 | emboss_cc_test( |
| 373 | name = "complex_offset_test", |
| 374 | srcs = ["testcode/complex_offset_test.cc"], |
| 375 | deps = [ |
| 376 | "//testdata:complex_offset_emboss", |
| 377 | "@com_google_googletest//:gtest_main", |
| 378 | ], |
| 379 | ) |