diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd99a462..cec5ac9a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ The release run heads these entries with the version and opens a fresh ## Unreleased +- Android packaging rejects ABI directories missing either native library or + containing empty libraries. JNI jar configuration now requires its actual JDK 17 minimum. + - Java `Measure`, `DrawingPath` and `DrawingTransform` equality now agrees with hashing for signed zero and is reflexive for NaN, following `Double` semantics. diff --git a/android/build.gradle.kts b/android/build.gradle.kts index b49b4c98d..1cd63ecf0 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -77,12 +77,21 @@ val checkNative = dependsOn(buildNative) val jniLibs = layout.projectDirectory.dir("native/prebuilt/jniLibs").asFile doLast { - if (jniLibs.list().isNullOrEmpty()) { + val abiDirectories = jniLibs.listFiles()?.filter { it.isDirectory }.orEmpty() + if (abiDirectories.isEmpty()) { throw GradleException( "nothing in $jniLibs — run android/build_native.py, " + "or pass -Podr.abis= to have the build run it" ) } + for (directory in abiDirectories) { + for (name in listOf("libodr_jni.so", "libc++_shared.so")) { + val library = directory.resolve(name) + if (!library.isFile || library.length() == 0L) { + throw GradleException("missing or empty native library: $library") + } + } + } } } diff --git a/jni/CMakeLists.txt b/jni/CMakeLists.txt index f4f27fe71..8ffc66120 100644 --- a/jni/CMakeLists.txt +++ b/jni/CMakeLists.txt @@ -32,7 +32,7 @@ endif () # quietly shipping half a package. option(ODR_JNI_JAR "Build the java half, `odr-core-java.jar`" ON) if (ODR_JNI_JAR) - find_package(Java 11 REQUIRED COMPONENTS Development) + find_package(Java 17 REQUIRED COMPONENTS Development) include(UseJava) endif ()