diff options
author | Andrew Walbran <qwandor@google.com> | 2023-11-21 19:29:53 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-11-21 19:29:53 +0000 |
commit | 8fbb0b8d068781ac7f6262f69de2a0a86b9badef (patch) | |
tree | 1a114fbc5e7b9d3db4563efeb7d95c013bbb93d2 | |
parent | d5270a0c77df127e26af2937bf6b130c4c905d5a (diff) | |
parent | e007c3760378ddff0385b9c00a7594c578a3380d (diff) | |
download | ring-8fbb0b8d068781ac7f6262f69de2a0a86b9badef.tar.gz |
Fix cargo test. am: e007c37603
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/ring/+/2841413
Change-Id: If3b7ef79af994cacb033012ac456e65bc79a4409
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | Android.bp | 16 | ||||
-rw-r--r-- | cargo2android.json | 1 | ||||
-rw-r--r-- | cfg_soong.bp | 1 | ||||
-rw-r--r-- | patches/hardcode_prefix.patch | 53 | ||||
-rw-r--r-- | src/prefixed.rs | 30 |
5 files changed, 89 insertions, 12 deletions
@@ -67,6 +67,7 @@ rust_library { product_available: true, vendor_available: true, min_sdk_version: "29", + cfgs: ["soong"], } rust_library_rlib { @@ -101,6 +102,7 @@ rust_library_rlib { product_available: true, vendor_available: true, min_sdk_version: "29", + cfgs: ["soong"], } rust_test { @@ -134,6 +136,7 @@ rust_test { "libring-core", "libring-test", ], + cfgs: ["soong"], } rust_defaults { @@ -169,6 +172,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -180,6 +184,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -191,6 +196,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -202,6 +208,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -213,6 +220,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -224,6 +232,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -235,6 +244,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -246,6 +256,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -257,6 +268,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -268,6 +280,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -279,6 +292,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -290,6 +304,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } rust_test { @@ -301,6 +316,7 @@ rust_test { test_options: { unit_test: true, }, + cfgs: ["soong"], } cc_library_static { diff --git a/cargo2android.json b/cargo2android.json index e7b015e..2abef64 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -1,5 +1,6 @@ { "add-toplevel-block": "cargo2android_cc.bp", + "add-module-block": "cfg_soong.bp", "apex-available": [ "//apex_available:platform", "com.android.resolv" diff --git a/cfg_soong.bp b/cfg_soong.bp new file mode 100644 index 0000000..83a9214 --- /dev/null +++ b/cfg_soong.bp @@ -0,0 +1 @@ +cfgs: ["soong"]
\ No newline at end of file diff --git a/patches/hardcode_prefix.patch b/patches/hardcode_prefix.patch index a37c68a..41d00ec 100644 --- a/patches/hardcode_prefix.patch +++ b/patches/hardcode_prefix.patch @@ -1,14 +1,45 @@ -diff --git a/src/prefixed.rs b/src/prefixed.rs -index 0f1c13e8c..c8ac807ee 100644 ---- a/src/prefixed.rs -+++ b/src/prefixed.rs -@@ -68,7 +68,8 @@ macro_rules! prefixed_item { - } => { - prefixed_item! { - $attr -- { concat!(env!("RING_CORE_PREFIX"), stringify!($name)) } -+ //{ concat!(env!("RING_CORE_PREFIX"), stringify!($name)) } -+ { concat!("ring_core_android_platform_", stringify!($name)) } +--- src/prefixed.rs.orig 2023-11-21 14:54:21.563997351 +0000 ++++ src/prefixed.rs 2023-11-21 14:48:18.346428666 +0000 +@@ -73,6 +73,7 @@ + }; + } + ++#[cfg(not(soong))] + macro_rules! prefixed_item { + // Calculate the prefixed name in a separate layer of macro expansion + // because rustc won't currently accept a non-literal expression as +@@ -88,6 +89,34 @@ { $( $item )+ } } }; ++ ++ // Output the item. ++ { ++ $attr:ident ++ { $prefixed_name:expr } ++ { $( $item:tt )+ } ++ } => { ++ #[$attr = $prefixed_name] ++ $( $item )+ ++ }; ++} ++ ++#[cfg(soong)] ++macro_rules! prefixed_item { ++ // Calculate the prefixed name in a separate layer of macro expansion ++ // because rustc won't currently accept a non-literal expression as ++ // the value for `#[link_name = value]`. ++ { ++ $attr:ident ++ $name:ident ++ { $( $item:tt )+ } ++ } => { ++ prefixed_item! { ++ $attr ++ { concat!("ring_core_android_platform_", stringify!($name)) } ++ { $( $item )+ } ++ } ++ }; + + // Output the item. + { diff --git a/src/prefixed.rs b/src/prefixed.rs index a35f921..0b90721 100644 --- a/src/prefixed.rs +++ b/src/prefixed.rs @@ -73,6 +73,35 @@ macro_rules! prefixed_export { }; } +#[cfg(not(soong))] +macro_rules! prefixed_item { + // Calculate the prefixed name in a separate layer of macro expansion + // because rustc won't currently accept a non-literal expression as + // the value for `#[link_name = value]`. + { + $attr:ident + $name:ident + { $( $item:tt )+ } + } => { + prefixed_item! { + $attr + { concat!(env!("RING_CORE_PREFIX"), stringify!($name)) } + { $( $item )+ } + } + }; + + // Output the item. + { + $attr:ident + { $prefixed_name:expr } + { $( $item:tt )+ } + } => { + #[$attr = $prefixed_name] + $( $item )+ + }; +} + +#[cfg(soong)] macro_rules! prefixed_item { // Calculate the prefixed name in a separate layer of macro expansion // because rustc won't currently accept a non-literal expression as @@ -84,7 +113,6 @@ macro_rules! prefixed_item { } => { prefixed_item! { $attr - //{ concat!(env!("RING_CORE_PREFIX"), stringify!($name)) } { concat!("ring_core_android_platform_", stringify!($name)) } { $( $item )+ } } |