Skip to content

Commit

Permalink
[jnigen] CI Fix: update AGP and fix compile sdk version (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
HosseinYousefi authored Sep 13, 2024
1 parent 20f8160 commit 4af11a0
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 34 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/jnigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkgs/jni/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if (flutterVersionName == null) {
}

android {
namespace "com.github.dart_lang.jni_example"

compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkgs/jni/example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/jni/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions pkgs/jnigen/android_test_runner/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkgs/jnigen/android_test_runner/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions pkgs/jnigen/example/in_app_java/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (flutterVersionName == null) {
}

android {
compileSdkVersion flutter.compileSdkVersion
namespace "com.example.in_app_java"

compileSdkVersion 35
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkgs/jnigen/example/in_app_java/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
29 changes: 29 additions & 0 deletions pkgs/jnigen/example/in_app_java/lib/android_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down Expand Up @@ -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<ffi.Void>, jni.JMethodIDPtr,
ffi.VarArgs<($Int32,)>)>>('globalEnv_CallStaticObjectMethod')
.asFunction<
jni.JniResult Function(
ffi.Pointer<ffi.Void>, 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>
Expand Down
2 changes: 2 additions & 0 deletions pkgs/jnigen/example/kotlin_plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (flutterVersionName == null) {
}

android {
compileSdkVersion flutter.compileSdkVersion
namespace "com.example.kotlin_plugin.example"

compileSdkVersion 35
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions pkgs/jnigen/example/notification_plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (flutterVersionName == null) {
}

android {
compileSdkVersion flutter.compileSdkVersion
namespace "com.example.notification_plugin_example"

compileSdkVersion 35
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions pkgs/jnigen/example/pdfbox_plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (flutterVersionName == null) {
}

android {
compileSdkVersion flutter.compileSdkVersion
namespace "com.example.pdfbox_plugin_example"

compileSdkVersion 35
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 4af11a0

Please sign in to comment.