Skip to content

Commit 326473f

Browse files
committed
fix: Android AAR packaging and bump to 0.18.3
Fix empty classes.jar in published Android AAR by: - Use cp -r instead of find -exec cp to preserve directory structure when copying generated Kotlin bindings - Add missing androidx.core:core-ktx dependency (needed for @RequiresApi in uniffi-generated code) - Add verification steps that fail early if Kotlin bindings are missing at each stage of the pipeline
1 parent 4613601 commit 326473f

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ jobs:
241241
--language kotlin \
242242
--out-dir out/kotlin
243243
244+
# Verify bindings were generated
245+
KT_COUNT=$(find out/kotlin -name "*.kt" | wc -l)
246+
if [ "$KT_COUNT" -eq 0 ]; then
247+
echo "ERROR: No Kotlin bindings were generated!"
248+
exit 1
249+
fi
250+
echo "Generated $KT_COUNT Kotlin binding file(s):"
251+
find out/kotlin -name "*.kt" -exec ls -la {} \;
252+
244253
- name: Organize JNI libraries
245254
run: |
246255
mkdir -p target/android/jniLibs/{arm64-v8a,armeabi-v7a,x86_64}
@@ -256,8 +265,17 @@ jobs:
256265
# Copy JNI libs
257266
cp -R target/android/jniLibs/* target/android/parser/src/main/jniLibs/
258267
259-
# Copy Kotlin bindings
260-
find bindings/out/kotlin -name "*.kt" -exec cp {} target/android/parser/src/main/kotlin/ \;
268+
# Copy Kotlin bindings (preserve directory structure)
269+
cp -r bindings/out/kotlin/* target/android/parser/src/main/kotlin/
270+
271+
# Verify Kotlin bindings were copied
272+
KT_COUNT=$(find target/android/parser/src/main/kotlin -name "*.kt" | wc -l)
273+
if [ "$KT_COUNT" -eq 0 ]; then
274+
echo "ERROR: No Kotlin bindings found in Android module!"
275+
exit 1
276+
fi
277+
echo "Kotlin bindings in Android module:"
278+
find target/android/parser/src/main/kotlin -name "*.kt" -exec ls -la {} \;
261279
262280
# Create build.gradle.kts
263281
cat > target/android/parser/build.gradle.kts << 'EOF'
@@ -302,6 +320,7 @@ jobs:
302320
dependencies {
303321
implementation("net.java.dev.jna:jna:5.14.0@aar")
304322
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
323+
implementation("androidx.core:core-ktx:1.9.0")
305324
}
306325
EOF
307326
@@ -525,6 +544,16 @@ jobs:
525544
mkdir -p target/android
526545
unzip cooklang-parser-android.zip -d target/android/
527546
547+
# Verify Kotlin sources are present
548+
KT_COUNT=$(find target/android/parser/src/main/kotlin -name "*.kt" | wc -l)
549+
if [ "$KT_COUNT" -eq 0 ]; then
550+
echo "ERROR: No Kotlin sources found in extracted artifacts!"
551+
echo "Contents of parser directory:"
552+
find target/android/parser -type f
553+
exit 1
554+
fi
555+
echo "Found $KT_COUNT Kotlin source file(s)"
556+
528557
- name: Setup JDK
529558
uses: actions/setup-java@v4
530559
with:
@@ -618,6 +647,7 @@ jobs:
618647
dependencies {
619648
implementation("net.java.dev.jna:jna:5.14.0@aar")
620649
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
650+
implementation("androidx.core:core-ktx:1.9.0")
621651
}
622652
623653
publishing {

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cooklang"
3-
version = "0.18.2"
3+
version = "0.18.3"
44
edition = "2021"
55
authors = ["Zheoni <zheoni@outlook.es>"]
66
description = "Cooklang parser with opt-in extensions"

bindings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cooklang-bindings"
3-
version = "0.18.2"
3+
version = "0.18.3"
44
edition = "2021"
55
authors = ["dubadub <dubovskoy.a@gmail.com>"]
66
description = "Cooklang Uniffi bindings"

0 commit comments

Comments
 (0)