Migrate pdl-compiler to monorepo. Bug: http://b/339424309 Test: treehugger Change-Id: Iefb5f16611afc2e8672a137a114f026b9576d9fa
diff --git a/Android.bp b/Android.bp index ce5e80e..96beb97 100644 --- a/Android.bp +++ b/Android.bp
@@ -1,548 +1 @@ -// This file is generated by cargo_embargo. -// Do not modify this file because the changes will be overridden on upgrade. - -package { - default_applicable_licenses: ["external_rust_crates_pdl-compiler_license"], - default_team: "trendy_team_android_rust", -} - -license { - name: "external_rust_crates_pdl-compiler_license", - visibility: [":__subpackages__"], - license_kinds: ["SPDX-license-identifier-Apache-2.0"], - license_text: ["LICENSE"], -} - -rust_library_host { - name: "libpdl_compiler", - host_cross_supported: false, - crate_name: "pdl_compiler", - cargo_env_compat: true, - cargo_pkg_version: "0.3.1", - crate_root: "src/lib.rs", - edition: "2021", - features: [ - "default", - "serde", - ], - rustlibs: [ - "libargh", - "libcodespan_reporting", - "libheck", - "libpest", - "libprettyplease", - "libproc_macro2", - "libquote", - "libserde", - "libserde_json", - "libsyn", - ], - proc_macros: ["libpest_derive"], - compile_multilib: "first", -} - -rust_binary_host { - name: "pdlc", - host_cross_supported: false, - crate_name: "pdlc", - cargo_env_compat: true, - cargo_pkg_version: "0.3.1", - crate_root: "src/main.rs", - edition: "2021", - features: [ - "default", - "serde", - ], - rustlibs: [ - "libargh", - "libcodespan_reporting", - "libheck", - "libpdl_compiler", - "libpest", - "libprettyplease", - "libproc_macro2", - "libquote", - "libserde", - "libserde_json", - "libsyn", - ], - proc_macros: ["libpest_derive"], - compile_multilib: "first", -} - -// Defaults for rust backend generation. -genrule_defaults { - name: "pdl_rust_generator_defaults", - cmd: "$(location :pdlc) --output-format rust $(in) > $(out)", - tools: [":pdlc"], - defaults_visibility: [ - "//system/nfc:__subpackages__", - "//external/rust/pica", - "//external/uwb/src", - "//packages/modules/Bluetooth:__subpackages__", - "//tools/netsim:__subpackages__", - ], -} - -// Defaults for legacy rust backend generation. -genrule_defaults { - name: "pdl_rust_legacy_generator_defaults", - cmd: "$(location :pdlc) --output-format rust_legacy $(in) > $(out)", - tools: [":pdlc"], - defaults_visibility: [ - "//system/nfc:__subpackages__", - "//external/rust/pica", - "//external/uwb/src", - "//packages/modules/Bluetooth:__subpackages__", - "//tools/netsim:__subpackages__", - ], -} - -// Defaults for rust_noalloc backend generation. -genrule_defaults { - name: "pdl_rust_noalloc_generator_defaults", - cmd: "$(location :pdlc) --output-format rust_no_alloc $(in) > $(out)", - tools: [":pdlc"], -} - -// Defaults for PDL python backend generation. -genrule_defaults { - name: "pdl_python_generator_defaults", - tools: [ - ":pdlc", - ":pdl_python_generator", - ], -} - -// Defaults for PDL C++ backend generation. -genrule_defaults { - name: "pdl_cxx_generator_defaults", - tools: [ - ":pdlc", - ":pdl_cxx_generator", - ], -} - -filegroup { - name: "pdl_generated_files", - srcs: [ - "tests/generated/rust/**/*.rs", - ], -} - -rust_test_host { - name: "pdl_tests", - host_cross_supported: false, - srcs: ["src/main.rs"], - rustlibs: [ - "libargh", - "libcodespan_reporting", - "libheck", - "libpdl_compiler", - "libpest", - "libprettyplease", - "libproc_macro2", - "libquote", - "libserde", - "libserde_json", - "libsyn", - "libtempfile", - ], - proc_macros: [ - "libpest_derive", - "libpaste", - ], - test_suites: ["general-tests"], - data: [ - ":pdl_generated_files", - ], -} - -genrule { - name: "pdl_generated_files_compile_rs", - cmd: "$(location tests/generated_files_compile.sh) $(in) > $(out)", - srcs: [":pdl_generated_files"], - out: ["generated_files_compile.rs"], - tool_files: ["tests/generated_files_compile.sh"], -} - -rust_test_host { - name: "pdl_generated_files_compile", - srcs: [":pdl_generated_files_compile_rs"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libserde", - "libtempfile", - "libpdl_runtime", - ], - test_suites: ["general-tests"], - clippy_lints: "none", - lints: "none", -} - -// The generators support more features for LE packets than for BE -// packets. We use a single input written for LE packets and remove -// the parts that don't work for BE packets. We do this by removing -// everything between -// -// // Start: little_endian_only -// -// and -// -// // End: little_endian_only -// -// from the LE packet input. -genrule_defaults { - name: "pdl_be_test_file_defaults", - cmd: "sed -e 's/little_endian_packets/big_endian_packets/' " + - " -e '/Start: little_endian_only/,/End: little_endian_only/d' " + - " < $(in) > $(out)", -} - -genrule { - name: "pdl_be_test_file", - defaults: ["pdl_be_test_file_defaults"], - srcs: ["tests/canonical/le_test_file.pdl"], - out: ["be_test_file.pdl"], -} - -genrule { - name: "pdl_rust_generator_tests_le_src", - cmd: "$(location :pdlc)" + - " --output-format rust" + - " --exclude-declaration UnsizedCustomField" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Checksum" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --exclude-declaration Packet_Array_Field_UnsizedElement_SizeModifier" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier_" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier" + - " $(location tests/canonical/le_test_file.pdl) > $(out);" + - "$(location :pdlc) $(location tests/canonical/le_test_vectors.json) --output-format rust --tests >> $(out)", - srcs: [ - "tests/canonical/le_test_file.pdl", - "tests/canonical/le_test_vectors.json", - ], - out: ["le_canonical.rs"], - tools: [":pdlc"], -} - -genrule { - name: "pdl_rust_generator_tests_be_src", - cmd: "$(location :pdlc)" + - " --output-format rust" + - " --exclude-declaration UnsizedCustomField" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Checksum" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_UnsizedElement_SizeModifier" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier_" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier" + - " $(location :pdl_be_test_file) > $(out);" + - "$(location :pdlc) $(location tests/canonical/be_test_vectors.json) --output-format rust --tests >> $(out)", - srcs: [ - ":pdl_be_test_file", - "tests/canonical/be_test_vectors.json", - ], - out: ["be_canonical.rs"], - tools: [":pdlc"], -} - -rust_test_host { - name: "pdl_rust_generator_tests_le", - srcs: [":pdl_rust_generator_tests_le_src"], - test_suites: ["general-tests"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libnum_traits", - "libpdl_runtime", - "libserde", - "libserde_json", - ], - clippy_lints: "none", - lints: "none", -} - -rust_test_host { - name: "pdl_rust_generator_tests_be", - srcs: [":pdl_rust_generator_tests_be_src"], - test_suites: ["general-tests"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libnum_traits", - "libpdl_runtime", - "libserde", - "libserde_json", - ], - clippy_lints: "none", - lints: "none", -} - -// Generate the python parser+serializer backend for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_python_generator_le_test_gen", - defaults: ["pdl_python_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_python_generator)" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --output $(out) --custom-type-location tests.custom_types", - tool_files: [ - "tests/custom_types.py", - ], - srcs: [ - "tests/canonical/le_test_file.pdl", - ], - out: [ - "le_backend.py", - ], -} - -// Generate the python parser+serializer backend for a big endian test -// file derived from tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_python_generator_be_test_gen", - defaults: ["pdl_python_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_python_generator)" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --output $(out) --custom-type-location tests.custom_types", - tool_files: [ - "tests/custom_types.py", - ], - srcs: [ - ":pdl_be_test_file", - ], - out: [ - "be_backend.py", - ], -} - -// Test the generated python parser+serializer against -// pre-generated binary inputs. -python_test_host { - name: "pdl_python_generator_test", - main: "tests/python_generator_test.py", - srcs: [ - ":pdl_python_generator_be_test_gen", - ":pdl_python_generator_le_test_gen", - "tests/custom_types.py", - "tests/python_generator_test.py", - ], - data: [ - "tests/canonical/be_test_vectors.json", - "tests/canonical/le_test_vectors.json", - ], - libs: [ - "typing_extensions", - ], - test_options: { - unit_test: true, - }, - version: { - py3: { - embedded_launcher: true, - }, - }, -} - -// Generate the rust_noalloc backend srcs against the little-endian test vectors -genrule { - name: "pdl_rust_noalloc_le_test_backend_srcs", - defaults: ["pdl_rust_noalloc_generator_defaults"], - srcs: ["tests/canonical/le_rust_noalloc_test_file.pdl"], - out: ["_packets.rs"], -} - -// Generate the C++ parser+serializer backend for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_cxx_canonical_le_src_gen", - defaults: ["pdl_cxx_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_cxx_generator)" + - " --exclude-declaration Packet_Custom_Field_ConstantSize" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Custom_Field_ConstantSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --exclude-declaration Struct_Custom_Field_ConstantSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --namespace le_test" + - " --output $(out)", - srcs: [ - "tests/canonical/le_test_file.pdl", - ], - out: [ - "canonical_le_test_file.h", - ], -} - -// Generate the C++ parser+serializer backend tests for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_cxx_canonical_le_test_gen", - cmd: "set -o pipefail;" + - " inputs=( $(in) ) &&" + - " $(location :pdlc) $${inputs[0]} |" + - " $(location :pdl_cxx_unittest_generator)" + - " --output $(out)" + - " --test-vectors $${inputs[1]}" + - " --include-header $$(basename $${inputs[2]})" + - " --using-namespace le_test" + - " --namespace le_test" + - " --parser-test-suite LeParserTest" + - " --serializer-test-suite LeSerializerTest", - tools: [ - ":pdlc", - ":pdl_cxx_unittest_generator", - ], - srcs: [ - "tests/canonical/le_test_file.pdl", - - "tests/canonical/le_test_vectors.json", - - ":pdl_cxx_canonical_le_src_gen", - ], - out: [ - "canonical_le_test.cc", - ], -} - -// Generate the C++ parser+serializer backend for the -// big endian test file. -genrule { - name: "pdl_cxx_canonical_be_src_gen", - defaults: ["pdl_cxx_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_cxx_generator)" + - " --exclude-declaration Packet_Custom_Field_ConstantSize" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Custom_Field_ConstantSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --exclude-declaration Struct_Custom_Field_ConstantSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --namespace be_test" + - " --output $(out)", - srcs: [ - ":pdl_be_test_file", - ], - out: [ - "canonical_be_test_file.h", - ], -} - -// Generate the C++ parser+serializer backend tests for the -// big endian test file. -genrule { - name: "pdl_cxx_canonical_be_test_gen", - cmd: "set -o pipefail;" + - " inputs=( $(in) ) &&" + - " $(location :pdlc) $${inputs[0]} |" + - " $(location :pdl_cxx_unittest_generator)" + - " --output $(out)" + - " --test-vectors $${inputs[1]}" + - " --include-header $$(basename $${inputs[2]})" + - " --using-namespace be_test" + - " --namespace be_test" + - " --parser-test-suite BeParserTest" + - " --serializer-test-suite BeSerializerTest", - tools: [ - ":pdlc", - ":pdl_cxx_unittest_generator", - ], - srcs: [ - ":pdl_be_test_file", - - "tests/canonical/be_test_vectors.json", - - ":pdl_cxx_canonical_be_src_gen", - ], - out: [ - "canonical_be_test.cc", - ], -} - -// Test the generated C++ parser+serializer against -// pre-generated binary inputs. -cc_test_host { - name: "pdl_cxx_generator_test", - local_include_dirs: [ - "scripts", - ], - generated_headers: [ - "pdl_cxx_canonical_be_src_gen", - "pdl_cxx_canonical_le_src_gen", - ], - generated_sources: [ - "pdl_cxx_canonical_be_test_gen", - "pdl_cxx_canonical_le_test_gen", - ], - static_libs: [ - "libgtest", - ], -} +// This crate has been migrated to external/rust/android-crates-io.
diff --git a/cargo2android_toplevel.bp b/cargo2android_toplevel.bp deleted file mode 100644 index 566e400..0000000 --- a/cargo2android_toplevel.bp +++ /dev/null
@@ -1,476 +0,0 @@ -// Defaults for rust backend generation. -genrule_defaults { - name: "pdl_rust_generator_defaults", - cmd: "$(location :pdlc) --output-format rust $(in) > $(out)", - tools: [":pdlc"], - defaults_visibility: [ - "//system/nfc:__subpackages__", - "//external/rust/pica", - "//external/uwb/src", - "//packages/modules/Bluetooth:__subpackages__", - "//tools/netsim:__subpackages__", - ], -} - -// Defaults for legacy rust backend generation. -genrule_defaults { - name: "pdl_rust_legacy_generator_defaults", - cmd: "$(location :pdlc) --output-format rust_legacy $(in) > $(out)", - tools: [":pdlc"], - defaults_visibility: [ - "//system/nfc:__subpackages__", - "//external/rust/pica", - "//external/uwb/src", - "//packages/modules/Bluetooth:__subpackages__", - "//tools/netsim:__subpackages__", - ], -} - -// Defaults for rust_noalloc backend generation. -genrule_defaults { - name: "pdl_rust_noalloc_generator_defaults", - cmd: "$(location :pdlc) --output-format rust_no_alloc $(in) > $(out)", - tools: [":pdlc"], -} - -// Defaults for PDL python backend generation. -genrule_defaults { - name: "pdl_python_generator_defaults", - tools: [ - ":pdlc", - ":pdl_python_generator", - ], -} - -// Defaults for PDL C++ backend generation. -genrule_defaults { - name: "pdl_cxx_generator_defaults", - tools: [ - ":pdlc", - ":pdl_cxx_generator", - ], -} - -filegroup { - name: "pdl_generated_files", - srcs: [ - "tests/generated/rust/**/*.rs", - ], -} - -rust_test_host { - name: "pdl_tests", - host_cross_supported: false, - srcs: ["src/main.rs"], - rustlibs: [ - "libargh", - "libcodespan_reporting", - "libheck", - "libpdl_compiler", - "libpest", - "libprettyplease", - "libproc_macro2", - "libquote", - "libserde", - "libserde_json", - "libsyn", - "libtempfile", - ], - proc_macros: [ - "libpest_derive", - "libpaste", - ], - test_suites: ["general-tests"], - data: [ - ":pdl_generated_files", - ], -} - -genrule { - name: "pdl_generated_files_compile_rs", - cmd: "$(location tests/generated_files_compile.sh) $(in) > $(out)", - srcs: [":pdl_generated_files"], - out: ["generated_files_compile.rs"], - tool_files: ["tests/generated_files_compile.sh"], -} - -rust_test_host { - name: "pdl_generated_files_compile", - srcs: [":pdl_generated_files_compile_rs"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libserde", - "libtempfile", - "libpdl_runtime", - ], - test_suites: ["general-tests"], - clippy_lints: "none", - lints: "none", -} - -// The generators support more features for LE packets than for BE -// packets. We use a single input written for LE packets and remove -// the parts that don't work for BE packets. We do this by removing -// everything between -// -// // Start: little_endian_only -// -// and -// -// // End: little_endian_only -// -// from the LE packet input. -genrule_defaults { - name: "pdl_be_test_file_defaults", - cmd: "sed -e 's/little_endian_packets/big_endian_packets/' " + - " -e '/Start: little_endian_only/,/End: little_endian_only/d' " + - " < $(in) > $(out)", -} - -genrule { - name: "pdl_be_test_file", - defaults: ["pdl_be_test_file_defaults"], - srcs: ["tests/canonical/le_test_file.pdl"], - out: ["be_test_file.pdl"], -} - -genrule { - name: "pdl_rust_generator_tests_le_src", - cmd: "$(location :pdlc)" + - " --output-format rust" + - " --exclude-declaration UnsizedCustomField" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Checksum" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --exclude-declaration Packet_Array_Field_UnsizedElement_SizeModifier" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier_" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier" + - " $(location tests/canonical/le_test_file.pdl) > $(out);" + - "$(location :pdlc) $(location tests/canonical/le_test_vectors.json) --output-format rust --tests >> $(out)", - srcs: [ - "tests/canonical/le_test_file.pdl", - "tests/canonical/le_test_vectors.json", - ], - out: ["le_canonical.rs"], - tools: [":pdlc"], -} - -genrule { - name: "pdl_rust_generator_tests_be_src", - cmd: "$(location :pdlc)" + - " --output-format rust" + - " --exclude-declaration UnsizedCustomField" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Checksum" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_UnsizedElement_SizeModifier" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier_" + - " --exclude-declaration Struct_Array_Field_UnsizedElement_SizeModifier" + - " $(location :pdl_be_test_file) > $(out);" + - "$(location :pdlc) $(location tests/canonical/be_test_vectors.json) --output-format rust --tests >> $(out)", - srcs: [ - ":pdl_be_test_file", - "tests/canonical/be_test_vectors.json", - ], - out: ["be_canonical.rs"], - tools: [":pdlc"], -} - -rust_test_host { - name: "pdl_rust_generator_tests_le", - srcs: [":pdl_rust_generator_tests_le_src"], - test_suites: ["general-tests"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libnum_traits", - "libpdl_runtime", - "libserde", - "libserde_json", - ], - clippy_lints: "none", - lints: "none", -} - -rust_test_host { - name: "pdl_rust_generator_tests_be", - srcs: [":pdl_rust_generator_tests_be_src"], - test_suites: ["general-tests"], - features: ["serde"], - rustlibs: [ - "libbytes", - "libnum_traits", - "libpdl_runtime", - "libserde", - "libserde_json", - ], - clippy_lints: "none", - lints: "none", -} - -// Generate the python parser+serializer backend for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_python_generator_le_test_gen", - defaults: ["pdl_python_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_python_generator)" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --output $(out) --custom-type-location tests.custom_types", - tool_files: [ - "tests/custom_types.py", - ], - srcs: [ - "tests/canonical/le_test_file.pdl", - ], - out: [ - "le_backend.py", - ], -} - -// Generate the python parser+serializer backend for a big endian test -// file derived from tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_python_generator_be_test_gen", - defaults: ["pdl_python_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_python_generator)" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --output $(out) --custom-type-location tests.custom_types", - tool_files: [ - "tests/custom_types.py", - ], - srcs: [ - ":pdl_be_test_file", - ], - out: [ - "be_backend.py", - ], -} - -// Test the generated python parser+serializer against -// pre-generated binary inputs. -python_test_host { - name: "pdl_python_generator_test", - main: "tests/python_generator_test.py", - srcs: [ - ":pdl_python_generator_be_test_gen", - ":pdl_python_generator_le_test_gen", - "tests/custom_types.py", - "tests/python_generator_test.py", - ], - data: [ - "tests/canonical/be_test_vectors.json", - "tests/canonical/le_test_vectors.json", - ], - libs: [ - "typing_extensions", - ], - test_options: { - unit_test: true, - }, - version: { - py3: { - embedded_launcher: true, - }, - }, -} - -// Generate the rust_noalloc backend srcs against the little-endian test vectors -genrule { - name: "pdl_rust_noalloc_le_test_backend_srcs", - defaults: ["pdl_rust_noalloc_generator_defaults"], - srcs: ["tests/canonical/le_rust_noalloc_test_file.pdl"], - out: ["_packets.rs"], -} - -// Generate the C++ parser+serializer backend for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_cxx_canonical_le_src_gen", - defaults: ["pdl_cxx_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_cxx_generator)" + - " --exclude-declaration Packet_Custom_Field_ConstantSize" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Custom_Field_ConstantSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --exclude-declaration Struct_Custom_Field_ConstantSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --namespace le_test" + - " --output $(out)", - srcs: [ - "tests/canonical/le_test_file.pdl", - ], - out: [ - "canonical_le_test_file.h", - ], -} - -// Generate the C++ parser+serializer backend tests for the -// little endian test file located at tests/canonical/le_test_file.pdl. -genrule { - name: "pdl_cxx_canonical_le_test_gen", - cmd: "set -o pipefail;" + - " inputs=( $(in) ) &&" + - " $(location :pdlc) $${inputs[0]} |" + - " $(location :pdl_cxx_unittest_generator)" + - " --output $(out)" + - " --test-vectors $${inputs[1]}" + - " --include-header $$(basename $${inputs[2]})" + - " --using-namespace le_test" + - " --namespace le_test" + - " --parser-test-suite LeParserTest" + - " --serializer-test-suite LeSerializerTest", - tools: [ - ":pdlc", - ":pdl_cxx_unittest_generator", - ], - srcs: [ - "tests/canonical/le_test_file.pdl", - - "tests/canonical/le_test_vectors.json", - - ":pdl_cxx_canonical_le_src_gen", - ], - out: [ - "canonical_le_test.cc", - ], -} - -// Generate the C++ parser+serializer backend for the -// big endian test file. -genrule { - name: "pdl_cxx_canonical_be_src_gen", - defaults: ["pdl_cxx_generator_defaults"], - cmd: "set -o pipefail;" + - " $(location :pdlc) $(in) |" + - " $(location :pdl_cxx_generator)" + - " --exclude-declaration Packet_Custom_Field_ConstantSize" + - " --exclude-declaration Packet_Custom_Field_VariableSize" + - " --exclude-declaration Packet_Checksum_Field_FromStart" + - " --exclude-declaration Packet_Checksum_Field_FromEnd" + - " --exclude-declaration Struct_Custom_Field_ConstantSize" + - " --exclude-declaration Struct_Custom_Field_VariableSize" + - " --exclude-declaration Struct_Checksum_Field_FromStart" + - " --exclude-declaration Struct_Checksum_Field_FromEnd" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount" + - " --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize" + - " --exclude-declaration Struct_Custom_Field_ConstantSize_" + - " --exclude-declaration Struct_Custom_Field_VariableSize_" + - " --exclude-declaration Struct_Checksum_Field_FromStart_" + - " --exclude-declaration Struct_Checksum_Field_FromEnd_" + - " --exclude-declaration PartialParent5" + - " --exclude-declaration PartialChild5_A" + - " --exclude-declaration PartialChild5_B" + - " --exclude-declaration PartialParent12" + - " --exclude-declaration PartialChild12_A" + - " --exclude-declaration PartialChild12_B" + - " --namespace be_test" + - " --output $(out)", - srcs: [ - ":pdl_be_test_file", - ], - out: [ - "canonical_be_test_file.h", - ], -} - -// Generate the C++ parser+serializer backend tests for the -// big endian test file. -genrule { - name: "pdl_cxx_canonical_be_test_gen", - cmd: "set -o pipefail;" + - " inputs=( $(in) ) &&" + - " $(location :pdlc) $${inputs[0]} |" + - " $(location :pdl_cxx_unittest_generator)" + - " --output $(out)" + - " --test-vectors $${inputs[1]}" + - " --include-header $$(basename $${inputs[2]})" + - " --using-namespace be_test" + - " --namespace be_test" + - " --parser-test-suite BeParserTest" + - " --serializer-test-suite BeSerializerTest", - tools: [ - ":pdlc", - ":pdl_cxx_unittest_generator", - ], - srcs: [ - ":pdl_be_test_file", - - "tests/canonical/be_test_vectors.json", - - ":pdl_cxx_canonical_be_src_gen", - ], - out: [ - "canonical_be_test.cc", - ], -} - -// Test the generated C++ parser+serializer against -// pre-generated binary inputs. -cc_test_host { - name: "pdl_cxx_generator_test", - local_include_dirs: [ - "scripts", - ], - generated_headers: [ - "pdl_cxx_canonical_be_src_gen", - "pdl_cxx_canonical_le_src_gen", - ], - generated_sources: [ - "pdl_cxx_canonical_be_test_gen", - "pdl_cxx_canonical_le_test_gen", - ], - static_libs: [ - "libgtest", - ], -}
diff --git a/cargo_embargo.json b/cargo_embargo.json deleted file mode 100644 index b3817ce..0000000 --- a/cargo_embargo.json +++ /dev/null
@@ -1,10 +0,0 @@ -{ - "package": { - "pdl-compiler": { - "add_toplevel_block": "cargo2android_toplevel.bp", - "device_supported": false, - "host_first_multilib": true - } - }, - "run_cargo": false -}
diff --git a/scripts/Android.bp b/scripts/Android.bp deleted file mode 100644 index 05bee6b..0000000 --- a/scripts/Android.bp +++ /dev/null
@@ -1,58 +0,0 @@ -// Python generator. -python_binary_host { - name: "pdl_python_generator", - main: "generate_python_backend.py", - srcs: [ - "generate_python_backend.py", - "pdl/ast.py", - "pdl/core.py", - "pdl/utils.py", - ], - version: { - py3: { - embedded_launcher: true, - }, - }, -} - -// C++ generator. -python_binary_host { - name: "pdl_cxx_generator", - main: "generate_cxx_backend.py", - srcs: [ - "generate_cxx_backend.py", - "pdl/ast.py", - "pdl/core.py", - "pdl/utils.py", - ], - version: { - py3: { - embedded_launcher: true, - }, - }, -} - -// C++ test generator. -python_binary_host { - name: "pdl_cxx_unittest_generator", - main: "generate_cxx_backend_tests.py", - srcs: [ - "generate_cxx_backend_tests.py", - "pdl/ast.py", - "pdl/core.py", - "pdl/utils.py", - ], - version: { - py3: { - embedded_launcher: true, - }, - }, -} - -// C++ packet runtime. -cc_library_headers { - name: "pdl_cxx_packet_runtime", - export_include_dirs: ["."], - host_supported: true, - vendor_available: true, -}