diff --git a/.github/workflows/jnigen.yaml b/.github/workflows/jnigen.yaml index 806251180..42a0577da 100644 --- a/.github/workflows/jnigen.yaml +++ b/.github/workflows/jnigen.yaml @@ -84,7 +84,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' cache: maven ## Committed bindings are formatted with clang-format. ## So this is required to format generated bindings identically @@ -135,7 +135,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - uses: axel-op/googlejavaformat-action@fe78db8a90171b6a836449f8d0e982d5d71e5c5a name: 'Check Java formatting with google-java-format' with: @@ -173,7 +173,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: | sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev libclang-dev @@ -222,7 +222,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server" - run: dart pub get - run: dart run jni:setup @@ -249,7 +249,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: git config --global core.autocrlf true - run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server" - run: dart pub get @@ -275,7 +275,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - run: dart pub get - run: dart run jni:setup - run: dart test --test-randomize-ordering-seed random @@ -300,7 +300,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - run: git config --global core.autocrlf true - run: dart pub get - name: Build summarizer @@ -323,7 +323,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: | sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev @@ -347,7 +347,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: flutter config --enable-windows-desktop - run: flutter pub get - run: flutter build windows @@ -362,7 +362,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'stable' @@ -386,7 +386,7 @@ jobs: - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - run: | sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev clang-format diff --git a/pkgs/jni/example/android/app/build.gradle b/pkgs/jni/example/android/app/build.gradle index 1578d193d..e2f649869 100644 --- a/pkgs/jni/example/android/app/build.gradle +++ b/pkgs/jni/example/android/app/build.gradle @@ -23,6 +23,8 @@ if (flutterVersionName == null) { } android { + namespace "com.github.dart_lang.jni_example" + compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion diff --git a/pkgs/jni/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jni/example/android/gradle/wrapper/gradle-wrapper.properties index cc5527d78..7aeeb11c6 100644 --- a/pkgs/jni/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jni/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jni/example/android/settings.gradle b/pkgs/jni/example/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jni/example/android/settings.gradle +++ b/pkgs/jni/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/pkgs/jni/pubspec.yaml b/pkgs/jni/pubspec.yaml index 48dc04701..09dce1f04 100644 --- a/pkgs/jni/pubspec.yaml +++ b/pkgs/jni/pubspec.yaml @@ -21,7 +21,7 @@ environment: dependencies: args: ^2.3.1 collection: ^1.0.0 - ffi: ^2.0.1 + ffi: ^2.1.3 package_config: ^2.1.0 path: ^1.8.0 plugin_platform_interface: ^2.0.2 diff --git a/pkgs/jnigen/android_test_runner/android/app/build.gradle b/pkgs/jnigen/android_test_runner/android/app/build.gradle index 18596cf0a..033226005 100644 --- a/pkgs/jnigen/android_test_runner/android/app/build.gradle +++ b/pkgs/jnigen/android_test_runner/android/app/build.gradle @@ -23,7 +23,9 @@ if (flutterVersionName == null) { } android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.github.dart_lang.jnigen.android_integration_test" + + compileSdkVersion 35 ndkVersion flutter.ndkVersion compileOptions { @@ -42,7 +44,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.github.dart_lang.jnigen.android_integration_test" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. diff --git a/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99c..3c85cfe05 100644 --- a/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jnigen/android_test_runner/android/settings.gradle b/pkgs/jnigen/android_test_runner/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jnigen/android_test_runner/android/settings.gradle +++ b/pkgs/jnigen/android_test_runner/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/pkgs/jnigen/example/in_app_java/android/app/build.gradle b/pkgs/jnigen/example/in_app_java/android/app/build.gradle index 96798166c..8c8168980 100644 --- a/pkgs/jnigen/example/in_app_java/android/app/build.gradle +++ b/pkgs/jnigen/example/in_app_java/android/app/build.gradle @@ -23,7 +23,9 @@ if (flutterVersionName == null) { } android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.example.in_app_java" + + compileSdkVersion 35 ndkVersion flutter.ndkVersion compileOptions { @@ -40,7 +42,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.in_app_java" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. diff --git a/pkgs/jnigen/example/in_app_java/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/example/in_app_java/android/gradle/wrapper/gradle-wrapper.properties index cc5527d78..7aeeb11c6 100644 --- a/pkgs/jnigen/example/in_app_java/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jnigen/example/in_app_java/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jnigen/example/in_app_java/android/settings.gradle b/pkgs/jnigen/example/in_app_java/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jnigen/example/in_app_java/android/settings.gradle +++ b/pkgs/jnigen/example/in_app_java/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart index 0a73adc93..2459d5d0b 100644 --- a/pkgs/jnigen/example/in_app_java/lib/android_utils.dart +++ b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart @@ -2855,6 +2855,9 @@ class Build_VERSION_CODES extends jni.JObject { /// from: `static public final int UPSIDE_DOWN_CAKE` static const UPSIDE_DOWN_CAKE = 34; + + /// from: `static public final int VANILLA_ICE_CREAM` + static const VANILLA_ICE_CREAM = 35; static final _id_new$ = _class.constructorId( r'()V', ); @@ -4130,6 +4133,32 @@ class HashMap<$K extends jni.JObject, $V extends jni.JObject> return _clone(reference.pointer, _id_clone as jni.JMethodIDPtr) .object(const jni.JObjectType()); } + + static final _id_newHashMap = _class.staticMethodId( + r'newHashMap', + r'(I)Ljava/util/HashMap;', + ); + + static final _newHashMap = ProtectedJniExtensions.lookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer, jni.JMethodIDPtr, + ffi.VarArgs<($Int32,)>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni.JniResult Function( + ffi.Pointer, jni.JMethodIDPtr, int)>(); + + /// from: `static public java.util.HashMap newHashMap(int i)` + /// The returned object must be released after use, by calling the [release] method. + static HashMap<$K, $V> + newHashMap<$K extends jni.JObject, $V extends jni.JObject>( + int i, { + required jni.JObjType<$K> K, + required jni.JObjType<$V> V, + }) { + return _newHashMap( + _class.reference.pointer, _id_newHashMap as jni.JMethodIDPtr, i) + .object($HashMapType(K, V)); + } } final class $HashMapType<$K extends jni.JObject, $V extends jni.JObject> diff --git a/pkgs/jnigen/example/kotlin_plugin/android/build.gradle b/pkgs/jnigen/example/kotlin_plugin/android/build.gradle index 04bce9b0c..3393b9fbe 100644 --- a/pkgs/jnigen/example/kotlin_plugin/android/build.gradle +++ b/pkgs/jnigen/example/kotlin_plugin/android/build.gradle @@ -14,6 +14,8 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { + namespace 'com.example.kotlin_plugin' + // Bumping the plugin compileSdkVersion requires all clients of this plugin // to bump the version in their app. compileSdkVersion 31 diff --git a/pkgs/jnigen/example/kotlin_plugin/example/android/app/build.gradle b/pkgs/jnigen/example/kotlin_plugin/example/android/app/build.gradle index 542a2d4bb..355a12ad8 100644 --- a/pkgs/jnigen/example/kotlin_plugin/example/android/app/build.gradle +++ b/pkgs/jnigen/example/kotlin_plugin/example/android/app/build.gradle @@ -23,7 +23,9 @@ if (flutterVersionName == null) { } android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.example.kotlin_plugin.example" + + compileSdkVersion 35 ndkVersion flutter.ndkVersion compileOptions { @@ -40,7 +42,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.kotlin_plugin.example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. diff --git a/pkgs/jnigen/example/kotlin_plugin/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/example/kotlin_plugin/example/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99c..3c85cfe05 100644 --- a/pkgs/jnigen/example/kotlin_plugin/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jnigen/example/kotlin_plugin/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jnigen/example/kotlin_plugin/example/android/settings.gradle b/pkgs/jnigen/example/kotlin_plugin/example/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jnigen/example/kotlin_plugin/example/android/settings.gradle +++ b/pkgs/jnigen/example/kotlin_plugin/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/pkgs/jnigen/example/notification_plugin/android/build.gradle b/pkgs/jnigen/example/notification_plugin/android/build.gradle index fd63c0d8a..763c15ec3 100644 --- a/pkgs/jnigen/example/notification_plugin/android/build.gradle +++ b/pkgs/jnigen/example/notification_plugin/android/build.gradle @@ -13,6 +13,8 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { + namespace 'com.example.notification_plugin' + // Bumping the plugin compileSdkVersion requires all clients of this plugin // to bump the version in their app. compileSdkVersion 31 diff --git a/pkgs/jnigen/example/notification_plugin/example/android/app/build.gradle b/pkgs/jnigen/example/notification_plugin/example/android/app/build.gradle index a8c8103ab..3491cecc5 100644 --- a/pkgs/jnigen/example/notification_plugin/example/android/app/build.gradle +++ b/pkgs/jnigen/example/notification_plugin/example/android/app/build.gradle @@ -23,7 +23,9 @@ if (flutterVersionName == null) { } android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.example.notification_plugin_example" + + compileSdkVersion 35 ndkVersion flutter.ndkVersion compileOptions { @@ -40,7 +42,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.notification_plugin_example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. diff --git a/pkgs/jnigen/example/notification_plugin/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/example/notification_plugin/example/android/gradle/wrapper/gradle-wrapper.properties index cb24abda1..3c85cfe05 100644 --- a/pkgs/jnigen/example/notification_plugin/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jnigen/example/notification_plugin/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jnigen/example/notification_plugin/example/android/settings.gradle b/pkgs/jnigen/example/notification_plugin/example/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jnigen/example/notification_plugin/example/android/settings.gradle +++ b/pkgs/jnigen/example/notification_plugin/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false } diff --git a/pkgs/jnigen/example/pdfbox_plugin/android/build.gradle b/pkgs/jnigen/example/pdfbox_plugin/android/build.gradle index 6ea97b832..d7c4919c0 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/android/build.gradle +++ b/pkgs/jnigen/example/pdfbox_plugin/android/build.gradle @@ -13,6 +13,8 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { + namespace 'com.example.pdfbox_plugin' + // Bumping the plugin compileSdkVersion requires all clients of this plugin // to bump the version in their app. compileSdkVersion 31 diff --git a/pkgs/jnigen/example/pdfbox_plugin/example/android/app/build.gradle b/pkgs/jnigen/example/pdfbox_plugin/example/android/app/build.gradle index ec6579a75..b1e71c460 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/example/android/app/build.gradle +++ b/pkgs/jnigen/example/pdfbox_plugin/example/android/app/build.gradle @@ -23,7 +23,9 @@ if (flutterVersionName == null) { } android { - compileSdkVersion flutter.compileSdkVersion + namespace "com.example.pdfbox_plugin_example" + + compileSdkVersion 35 ndkVersion flutter.ndkVersion compileOptions { @@ -40,7 +42,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.pdfbox_plugin_example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. diff --git a/pkgs/jnigen/example/pdfbox_plugin/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/jnigen/example/pdfbox_plugin/example/android/gradle/wrapper/gradle-wrapper.properties index cc5527d78..7aeeb11c6 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkgs/jnigen/example/pdfbox_plugin/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/pkgs/jnigen/example/pdfbox_plugin/example/android/settings.gradle b/pkgs/jnigen/example/pdfbox_plugin/example/android/settings.gradle index 536165d35..03e70fe44 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/example/android/settings.gradle +++ b/pkgs/jnigen/example/pdfbox_plugin/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false + id "com.android.application" version "8.6.0" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false }