From ae392e9d1a629a4f2b7f7970c0c1d8fa22ee638b Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Thu, 16 Nov 2023 16:17:24 +0000 Subject: Migrate to cargo_embargo. Bug: 293289578 Test: Ran cargo_embargo, compared Android.bp Change-Id: Ie8d63e984ddf3ff114d3758ecbfbdc6708496cea --- Android.bp | 89 ++++++++++++++++++++++++++++++------------------------ cargo2android.json | 19 ------------ cargo_embargo.json | 31 +++++++++++++++++++ 3 files changed, 81 insertions(+), 58 deletions(-) delete mode 100644 cargo2android.json create mode 100644 cargo_embargo.json diff --git a/Android.bp b/Android.bp index 2155d28..1393a8b 100644 --- a/Android.bp +++ b/Android.bp @@ -1,4 +1,4 @@ -// This file is generated by cargo2android.py --config cargo2android.json. +// This file is generated by cargo_embargo. // Do not modify this file as changes will be overridden on upgrade. package { @@ -53,9 +53,7 @@ rust_library { "std", "tinyvec_macros", ], - rustlibs: [ - "libtinyvec_macros", - ], + rustlibs: ["libtinyvec_macros"], apex_available: [ "//apex_available:platform", "//apex_available:anyapex", @@ -65,35 +63,46 @@ rust_library { min_sdk_version: "29", } -rust_library_rlib { - name: "libtinyvec_nostd", - crate_name: "tinyvec", +rust_test { + name: "tinyvec_test_tests_arrayvec", + host_supported: true, + crate_name: "arrayvec", cargo_env_compat: true, cargo_pkg_version: "1.6.0", - srcs: ["src/lib.rs"], + srcs: ["tests/arrayvec.rs"], + test_suites: ["general-tests"], + auto_gen_config: true, + test_options: { + unit_test: true, + }, edition: "2018", - apex_available: [ - "//apex_available:platform", - "//apex_available:anyapex", + features: [ + "alloc", + "default", + "std", + "tinyvec_macros", ], - prefer_rlib: true, - no_stdlibs: true, - stdlibs: [ - "libcompiler_builtins.rust_sysroot", - "libcore.rust_sysroot", + rustlibs: [ + "libcriterion", + "libserde_test", + "libsmallvec", + "libtinyvec", + "libtinyvec_macros", ], - product_available: true, - vendor_available: true, - min_sdk_version: "29", } -rust_defaults { - name: "tinyvec_test_defaults", +rust_test { + name: "tinyvec_test_tests_tinyvec", + host_supported: true, crate_name: "tinyvec", cargo_env_compat: true, cargo_pkg_version: "1.6.0", + srcs: ["tests/tinyvec.rs"], test_suites: ["general-tests"], auto_gen_config: true, + test_options: { + unit_test: true, + }, edition: "2018", features: [ "alloc", @@ -110,22 +119,24 @@ rust_defaults { ], } -rust_test { - name: "tinyvec_test_tests_arrayvec", - defaults: ["tinyvec_test_defaults"], - host_supported: true, - srcs: ["tests/arrayvec.rs"], - test_options: { - unit_test: true, - }, -} - -rust_test { - name: "tinyvec_test_tests_tinyvec", - defaults: ["tinyvec_test_defaults"], - host_supported: true, - srcs: ["tests/tinyvec.rs"], - test_options: { - unit_test: true, - }, +rust_library_rlib { + name: "libtinyvec_nostd", + crate_name: "tinyvec", + cargo_env_compat: true, + cargo_pkg_version: "1.6.0", + srcs: ["src/lib.rs"], + edition: "2018", + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], + prefer_rlib: true, + no_stdlibs: true, + stdlibs: [ + "libcompiler_builtins.rust_sysroot", + "libcore.rust_sysroot", + ], + product_available: true, + vendor_available: true, + min_sdk_version: "29", } diff --git a/cargo2android.json b/cargo2android.json deleted file mode 100644 index d3ea6e6..0000000 --- a/cargo2android.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "dependencies": true, - "device": true, - "min-sdk-version": "29", - "run": true, - "variants": [ - { - "features": "alloc,default,std,tinyvec_macros", - "tests": true - }, - { - "features": "", - "force-rlib": true, - "no-host": true, - "suffix": "_nostd", - "no-std": true - } - ] -} \ No newline at end of file diff --git a/cargo_embargo.json b/cargo_embargo.json new file mode 100644 index 0000000..f7826ad --- /dev/null +++ b/cargo_embargo.json @@ -0,0 +1,31 @@ +{ + "min_sdk_version": "29", + "module_blocklist": [ + "tinyvec_test_src_lib" + ], + "run_cargo": false, + "variants": [ + { + "features": [ + "alloc", + "default", + "std", + "tinyvec_macros" + ], + "tests": true + }, + { + "features": [], + "module_name_overrides": { + "libtinyvec": "libtinyvec_nostd" + }, + "package": { + "tinyvec": { + "force_rlib": true, + "host_supported": false, + "no_std": true + } + } + } + ] +} -- cgit v1.2.3