Commit Graph

61 Commits

Author SHA1 Message Date
Jordan Rose
3f0d2b1384 Revert "java: Publish to GitHub Packages instead of Maven Central"
This reverts commit b2c5685080.
2025-11-07 11:37:25 -08:00
Jordan Rose
b2c5685080 java: Publish to GitHub Packages instead of Maven Central 2025-11-06 16:36:17 -08:00
Jordan Rose
26f46d3d68 android: Bump minSdkVersion to 23 2025-11-06 15:51:06 -08:00
Jordan Rose
5843f17141 java: Simplify build by including rustls' CertificateVerifier directly 2025-09-16 15:08:02 -07:00
Jordan Rose
b2c2537277 java: Switch from javadoc to Dokka to include our Kotlin sources
The Maven publication will still contain a -javadoc jar for
consistency, but the -dokka jar is likely to have superior rendering
in practice, particularly for Kotlin-only APIs!
2025-06-18 10:57:50 -07:00
Jordan Rose
5001df1ee4 Kotlin: use explicitApi() mode 2025-06-13 10:27:37 -07:00
Jordan Rose
1b469bb6c7 Make acknowledgments platform-specific 2025-06-12 16:01:33 -07:00
Alex Bakon
3c89a5fa07 Colocate Kotlin sources with Java 2025-06-12 16:00:05 -04:00
Jordan Rose
f40d20a72f Add CompletableFuture.await() helper for Kotlin clients
Test it by porting several tests from FutureTest.java to Kotlin and
using Kotlin idioms for awaiting and cancellation.
2025-06-05 12:34:15 -07:00
Alex Bakon
033abcf96f Support checking Java @CalledFromNative annotation 2025-06-02 13:02:41 -04:00
Jordan Rose
26d92fb09e jni: Add a debug mode to type-tag bridged object handles
Use `./gradlew -P jniTypeTagging` to build with type tags enabled.

This has a moderate code size cost, and an unmeasured cost in run-time
performance. On 64-bit targets, the tagging relies on bits 48..56 of 
pointers produced by the default Rust memory allocator being unused
(specifically 0), which they are on all our current targets.
2025-05-12 08:37:08 -07:00
Alex Bakon
890ac9e006 Enable account registration via Java registration service client 2025-04-29 13:41:51 -04:00
andrew-signal
1d0ae662d0 Bump Android Gradle Plugin to v8.9.0 2025-04-25 11:53:52 -06:00
andrew-signal
7a4bd18e1d Update to NDK v28.0.13004108 (current latest stable) 2025-04-09 15:46:03 -05:00
andrew-signal
9c0f28715b Bump the version of com.library.android to match Signal-Android 2025-01-16 13:45:33 -05:00
Jordan Rose
a8814d16f8 Move all "testing-fns" APIs into libsignal-bridge-testing
This means they'll be shipped to clients, but still filtered out of
the device builds on Android (via having two separate libraries on
disk) and iOS (by not being included in non-simulator builds). The
biggest benefit of this is dropping the :android:makeTestJniLibraries
step for running libsignal's Android tests.
2024-08-27 08:29:06 -07:00
Jordan Rose
d2d68763a2 Gradle: No need to publish a separate libWithDebugSymbols artifact
Follow-up to 9d729ff0.
2024-08-27 08:23:06 -07:00
Jordan Rose
97dfb275d6 android: Update to NDK r27 (current latest) 2024-08-23 11:23:05 -07:00
Jordan Rose
4470192aa6 java: When running Cargo as part of Gradle, fall back to ~/.cargo/bin
This is important when the Gradle configuration is processed by an IDE
on macOS, which won't have had PATH set by shell login scripts.
2024-08-22 09:23:16 -07:00
Jordan Rose
21dbd79192 java: Update to Gradle 8.6 and AGP 8.4.1 to match Signal-Android 2024-08-22 09:23:16 -07:00
Jordan Rose
4a1ed695b0 java: Specify working directory relative to project root 2024-08-22 09:23:16 -07:00
Jordan Rose
9d729ff083 Re-apply "android: Don't strip debug info out of the AAR"
A revised version of the earlier 23192280:
- Uses --build-id for all archs, not just aarch64
- Also raises Gradle's memory limits
2024-07-25 14:22:56 -07:00
Alex Konradi
4c0bb6d87f Revert "android: Don't strip debug info out of the AAR" 2024-07-19 11:25:58 -04:00
Jordan Rose
2319228027 android: Don't strip debug info out of the AAR
This *greatly* increases the size of the artifacts uploaded to Maven,
but it looks like the libraries do correctly get stripped when the
final APK is built. (This was not true in the past.)

Also, make sure the built library includes a "build ID", or else the
stripped version of the library will be treated as a different
library, and all the line tables will go to waste.
2024-07-18 10:26:02 -07:00
Alex Konradi
0e4d420f69 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.
2024-07-09 13:07:36 -04:00
Jordan Rose
4791773954 java: Add -P debugLevelLogs as a Gradle build option
Similar to the previous commits, but for Java/Android. If invoking
build_jni.sh directly, use `--debug-level-logs` like build_ffi.sh.

As a consequence, LOGGING IS NO LONGER AUTOMATICALLY ENABLED FOR
JAVA/ANDROID. Clients must call SignalProtocolLoggerProvider.
initializeLogging() in addition to setting a provider.
2024-06-13 12:08:31 -07:00
Jordan Rose
9d622d9bcb android: Add rustls-platform-verifier support 2024-04-24 14:13:30 -07:00
Jordan Rose
3d2471cc8b Make LIBSIGNAL_TESTING_ env vars available to Android and iOS tests
And adjust the existing ENCLAVE_SECRET tests and examples to use this
(including Rust and Node's).

This also requires adding an AndroidManifest.xml that notes the tests
might use the network.
2024-04-17 16:06:46 -07:00
Jordan Rose
f896129db9 Java: Update to Gradle 8.4, Android Gradle Plugin 8.3, SDK 34, Java 17
Each of these updates is required for the following update, and the
final one allows us to use 'record'.

The target SDK version is set to 33, matching the Android app.
2024-03-08 10:34:18 -08:00
Jordan Rose
c80ceda985 Java: Allow limiting which archs are built for Android
And use this to cut down CI testing time: only build armv7 and aarch64
slices of the real library, and x86_64 for the testing library (which
we don't even run in the every-commit CI, but we want to make sure we
haven't broken something in that configuration).
2024-03-07 10:15:57 -08:00
Alex Konradi
8959e64ed1 Build TESTING_ functions for Android test
Run tests that call native TESTING_ functions on Android. This requires 
building a separate version of libsignal_jni.so with the testing functions 
included. The test code is still omitted from the published artifacts.
2024-02-15 16:53:05 -05:00
Jordan Rose
88a25e889e Collect acknowledgments for libsignal's Cargo dependencies 2023-12-11 16:39:33 -08:00
Alex Konradi
7f023e7d46 Fix exclude for libsignal-net tests on Android
Use the path within the directory specified by srcDir without the common
prefix. Verified with ./gradlew test :android:connectedDebugAndroidTest
locally.
2023-11-16 14:47:17 -05:00
Alex Konradi
4c78373114 Expose libsignal-net function for CDSI via JNI
Expose the existing CDSI lookup async function to Java clients. Provide a small
library that can be easily integrated into the existing codebase.
2023-11-15 10:00:46 -05:00
Jordan Rose
3ac14b17a7 Fix Android tests for 9c79bc97c 2023-10-26 13:25:43 -07:00
Jordan Rose
a563c9b93d Java: Add a bare-bones Future implementation for upcoming async APIs 2023-09-27 06:48:21 -07:00
Jordan Rose
3810154436 Automate the Android and Server publishing to Sonatype 2023-08-25 12:33:56 -07:00
Jordan Rose
e11a825fe3 Gradle: Adopt Nexus plugin to automatically close releases on Sonatype 2023-08-24 12:21:25 -07:00
Jordan Rose
b27f5c0f2e Gradle: Set version and group info in the root project
This will be necessary to adopt the Gradle Nexus publishing plugin,
but it's also just simpler.
2023-08-24 12:21:25 -07:00
Max Moiseev
58ebf5f06d Bump NDK version to match the Github runner update 2023-02-13 10:03:45 -08:00
Jordan Rose
5b3d8bb731 Remove Android 19 support 2023-01-26 12:59:06 -08:00
Jordan Rose
3c5f00fffe java: Fix host build / server testing on Windows
- We weren't loading the native library as "signal_jni.dll"
- The Gradle build commands, though still requiring a shell environment,
  shouldn't rely on Unix-style #! lines to execute shell scripts
2022-12-05 11:42:06 -08:00
Jordan Rose
b8ac70227d Android: no need to set ANDROID_NDK_HOME when using Gradle
The Android Gradle plugin already allows you to specify which NDK to
use; we should let the plugin find it for us.
2022-12-05 10:02:54 -08:00
Jordan Rose
572ba1e38b Update Rust to nightly-2022-11-03, and the Android NDK to r25b
These are intertwined: older versions of Rust don't support the newer
NDK, but the newer Rust can't successfully compile BoringSSL against
the older NDK.

This requires a boring-sys update to find the Android NDK sysroot in
the right place.
2022-12-01 12:23:57 -08:00
Jordan Rose
f2f6188593 Android: fix connectedAndroidTests
- Include the same resources that the 'client' project uses
- Desugar newer JDK APIs so we can test on the oldest devices (KitKat)
2022-08-22 12:16:47 -07:00
Jordan Rose
0542686e70 Update artifact/package/module names across all three app languages
- Java: org.whispersystems:signal-client-java ->
    org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
    org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
    org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
    github.com/signalapp/libsignal
2022-03-23 10:49:09 -07:00
Jordan Rose
bd30563044 Java: use the artifact name as the human-readable name when publishing
This matches the (explicitly-specified) name in the previous Gradle
configuration.
2022-03-11 13:31:13 -08:00
Jordan Rose
43054913ed Java: Always include Mac and Windows support when publishing
Rather than have a separate "testable" artifact, always include Mac
and Windows versions of libsignal_jni.so when publishing
signal-client-java *and* libsignal_server (though not when just
building locally).

Also, finally attach these tasks to the correct step (processResources
rather than compileJava).
2022-03-10 13:36:26 -08:00
Jordan Rose
821d72d65a Java: add back missing repository information
I deleted this for simplicity when updating to Gradle 7.4 and then
forgot to put it back.
2022-03-10 13:36:26 -08:00
Jordan Rose
7931bf0812 java: Build a separate libsignal-server artifact
Reorganize the Gradle build with three targets:

- signal-client-java (client/)
- signal-client-android (android/)
- libsignal-server (server/)

plus an additional shared/ directory for sources shared between
client/ and server/.

This maintains the distinction between signal-client-java (the Java
parts, plus a Linux libsignal_jni.so for running tests outside of the
Android emulator) and signal-client-android (contains the Android JNI
libraries, plus any Android-specific code, which for now is just
AndroidSignalProtocolLogger, which the app doesn't even use).

The new libsignal-server is built very similarly to
signal-client-java, but only contains the Java sources relevant for
the server...plus the base org.whispersystems.libsignal classes from
the original libsignal-protocol-java, because some of them are
referenced directly in our generated Native.java. (We can improve on
this in the future.) The "testable" artifact that includes macOS and
Windows versions of libsignal_jni.so is now only built for
libsignal-server, not signal-client-java; our Android development
happens on Linux, but server development happens on multiple
platforms.

Tests were recently reorganized into a top-level tests/ directory, but
now there's been another reorganization:

- client/src/test/ - tests to run on any clients
- android/src/androidTest/ - tests to run only on Android devices /
  emulators (currently none)
- server/src/test/ - tests to run specifically for the server
  (currently none)
- shared/test/ - does not exist to avoid running the same tests twice

There are no tests to run "only not on Android devices", and it's
currently assumed that all server functionality is tested by the
client tests. The Android device tests run all the client tests as
well (by direct path reference). This may not be the "best" Gradle
layout, but it's at least straightforward to read the Gradle files.

For now there's still only one native library built for both
signal-client-java and libsignal-server, but that could change in the
future.
2022-03-10 09:14:55 -08:00