Skip to content

Commit 435f3b7

Browse files
Run jnigen on Android SDK bump (#3083)
* Add script to regenerate Dart JNI bindings during Android SDK update Co-authored-by: giancarlo.buenaflor <[email protected]> * Remove unnecessary comments from JNI bindings generation script Co-authored-by: giancarlo.buenaflor <[email protected]> * Update generate-jni-bindings.sh * Update update-android.sh --------- Co-authored-by: Cursor Agent <[email protected]>
1 parent 8403ffc commit 435f3b7

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ -n ${CI:+x} ]]; then
5+
echo "Running in CI – setting up Flutter SDK first"
6+
# Note: keep version in sync with other binding generation scripts.
7+
curl -Lv https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.27.3-stable.tar.xz --output /tmp/flutter.tar.xz
8+
tar xf /tmp/flutter.tar.xz -C /tmp
9+
export PATH="/tmp/flutter/bin:$PATH"
10+
which flutter
11+
flutter --version
12+
fi
13+
14+
# Move to the Flutter package root (…/flutter).
15+
cd "$(dirname "$0")/../"
16+
17+
binding_path="lib/src/native/java/binding.dart"
18+
19+
# Regenerate the bindings.
20+
dart run jnigen --config ffi-jni.yaml
21+
22+
# Format the generated code so that it passes CI linters.
23+
dart format "$binding_path"

flutter/scripts/update-android.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ get-repo)
2020
set-version)
2121
newValue="${BASH_REMATCH[1]}$2"
2222
echo "${content/${BASH_REMATCH[0]}/$newValue}" >$file
23+
# Regenerate Dart JNI bindings so they stay in sync with the updated Android SDK version.
24+
../scripts/generate-jni-bindings.sh "$2"
2325
;;
2426
*)
2527
echo "Unknown argument $1"

0 commit comments

Comments
 (0)