From 0e4d420f69030e5f94758b34283ffc80a211a41c Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Tue, 9 Jul 2024 13:07:36 -0400 Subject: [PATCH] Add libsignal-jni-testing crate with test-only functions for Java This parallels the exiting libsignal-jni crate but exports functions from libsignal-bridge-testing instead of libsignal-bridge. The crate is compiled as a separate shared object that is included in the published libsignal package, but which can be excluded at Android packaging time. --- Cargo.lock | 32 ++++++++++++ Cargo.toml | 1 + acknowledgments/acknowledgments.html | 4 +- acknowledgments/acknowledgments.md | 2 +- acknowledgments/acknowledgments.plist | 2 +- bin/update_versions.py | 5 +- java/android/build.gradle | 1 + java/build.gradle | 4 +- java/build_jni.sh | 5 +- .../org/signal/libsignal/internal/Native.java | 51 ++++++++++++------- .../libsignal/internal/NativeTesting.java | 48 +++++++++++++++++ .../libsignal/internal/NativeTestingTest.java | 18 +++++++ rust/bridge/jni/bin/Native.java.in | 51 ++++++++++++------- rust/bridge/jni/bin/NativeTesting.java.in | 48 +++++++++++++++++ rust/bridge/jni/bin/gen_java_decl.py | 19 ++++--- rust/bridge/jni/testing/Cargo.toml | 25 +++++++++ rust/bridge/jni/testing/cbindgen.toml | 28 ++++++++++ rust/bridge/jni/testing/src/lib.rs | 9 ++++ rust/bridge/shared/macros/src/ffi.rs | 1 + rust/bridge/shared/macros/src/jni.rs | 2 + rust/bridge/shared/src/message_backup.rs | 2 - rust/bridge/shared/testing/Cargo.toml | 34 +++++++++++++ rust/bridge/shared/testing/build.rs | 14 +++++ rust/bridge/shared/testing/src/lib.rs | 16 ++++++ 24 files changed, 371 insertions(+), 51 deletions(-) create mode 100644 java/shared/java/org/signal/libsignal/internal/NativeTesting.java create mode 100644 java/shared/test/java/org/signal/libsignal/internal/NativeTestingTest.java create mode 100644 rust/bridge/jni/bin/NativeTesting.java.in create mode 100644 rust/bridge/jni/testing/Cargo.toml create mode 100644 rust/bridge/jni/testing/cbindgen.toml create mode 100644 rust/bridge/jni/testing/src/lib.rs create mode 100644 rust/bridge/shared/testing/Cargo.toml create mode 100644 rust/bridge/shared/testing/build.rs create mode 100644 rust/bridge/shared/testing/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index e3931af71..45f2a3f1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2007,6 +2007,25 @@ dependencies = [ "syn-mid", ] +[[package]] +name = "libsignal-bridge-testing" +version = "0.1.0" +dependencies = [ + "bytemuck", + "futures-util", + "jni 0.21.1", + "libsignal-bridge-macros", + "libsignal-bridge-types", + "libsignal-message-backup", + "linkme", + "neon", + "paste", + "scopeguard", + "signal-neon-futures", + "strum", + "thiserror", +] + [[package]] name = "libsignal-bridge-types" version = "0.1.0" @@ -2108,6 +2127,19 @@ dependencies = [ "signal-crypto", ] +[[package]] +name = "libsignal-jni-testing" +version = "0.52.1" +dependencies = [ + "async-trait", + "cfg-if", + "jni 0.21.1", + "libsignal-bridge-testing", + "log", + "log-panics", + "rand", +] + [[package]] name = "libsignal-message-backup" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 023dea88e..34870366a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "rust/zkgroup", "rust/bridge/ffi", "rust/bridge/jni", + "rust/bridge/jni/testing", "rust/bridge/node", ] default-members = [ diff --git a/acknowledgments/acknowledgments.html b/acknowledgments/acknowledgments.html index f4f1208d2..2128840ec 100644 --- a/acknowledgments/acknowledgments.html +++ b/acknowledgments/acknowledgments.html @@ -47,7 +47,7 @@

Third Party Licenses

Overview of licenses: