From 0755b4f7e8e48a31678d8afa3f9b3b9b0bfb3a08 Mon Sep 17 00:00:00 2001 From: Debanjan Basu Date: Fri, 7 Jun 2024 22:45:20 +1000 Subject: [PATCH 1/3] upgraded to take into account sdk versions defined from parent --- flutter_ffi_plugin/android/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flutter_ffi_plugin/android/build.gradle b/flutter_ffi_plugin/android/build.gradle index 32230e31..cc141468 100755 --- a/flutter_ffi_plugin/android/build.gradle +++ b/flutter_ffi_plugin/android/build.gradle @@ -24,6 +24,12 @@ rootProject.allprojects { apply plugin: 'com.android.library' +// SDK Version 34 is the LTS as of now, till Flutter upgrades +// There are also deprecated attributes, this takes all of them into account +def compileSdkVersion = Math.max(android.compileSdkVersion, android.compileSdk, 31).toInteger() +// Defaults to the 16 if nothing is specified, or else overrides from the parent +def minSdkVersion = Math.max(android.minSdkVersion, android.minSdk, 16).toInteger() + android { if (project.android.hasProperty("namespace")) { namespace 'com.cunarist.rinf' @@ -31,7 +37,7 @@ android { // Bumping the plugin compileSdkVersion requires all clients of this plugin // to bump the version in their app. - compileSdkVersion 31 + compileSdkVersion compileSdkVersion // Simply use the `android.ndkVersion` // declared in the `./android/app/build.gradle` file of the Flutter project. @@ -58,7 +64,7 @@ android { } defaultConfig { - minSdkVersion 16 + minSdkVersion minSdkVersion } } From 74d5ef6645c9223b519d0885a969a471e11cb53f Mon Sep 17 00:00:00 2001 From: Kim Dong-Hyun Date: Sat, 8 Jun 2024 19:13:14 +0900 Subject: [PATCH 2/3] Apply latest Flutter Android config without `Math.max` --- flutter_ffi_plugin/android/build.gradle | 75 ++++++++++++------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/flutter_ffi_plugin/android/build.gradle b/flutter_ffi_plugin/android/build.gradle index cc141468..123deb83 100755 --- a/flutter_ffi_plugin/android/build.gradle +++ b/flutter_ffi_plugin/android/build.gradle @@ -1,70 +1,69 @@ -// The Android Gradle Plugin builds the native code with the Android NDK. - -group 'com.cunarist.rinf' -version '1.0' +group = "com.cunarist.rinf" +version = "1.0-SNAPSHOT" buildscript { + ext.kotlin_version = "1.7.10" repositories { google() mavenCentral() } dependencies { - // The Android Gradle Plugin knows how to build native code with the NDK. - classpath 'com.android.tools.build:gradle:7.3.0' + classpath("com.android.tools.build:gradle:7.3.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") } } -rootProject.allprojects { +allprojects { repositories { google() mavenCentral() } } -apply plugin: 'com.android.library' - -// SDK Version 34 is the LTS as of now, till Flutter upgrades -// There are also deprecated attributes, this takes all of them into account -def compileSdkVersion = Math.max(android.compileSdkVersion, android.compileSdk, 31).toInteger() -// Defaults to the 16 if nothing is specified, or else overrides from the parent -def minSdkVersion = Math.max(android.minSdkVersion, android.minSdk, 16).toInteger() +apply plugin: "com.android.library" +apply plugin: "kotlin-android" android { if (project.android.hasProperty("namespace")) { - namespace 'com.cunarist.rinf' + namespace = "com.cunarist.rinf" } - // Bumping the plugin compileSdkVersion requires all clients of this plugin - // to bump the version in their app. - compileSdkVersion compileSdkVersion + compileSdk = 34 - // Simply use the `android.ndkVersion` - // declared in the `./android/app/build.gradle` file of the Flutter project. - ndkVersion android.ndkVersion - - // Invoke the shared CMake build with the Android Gradle Plugin. - externalNativeBuild { - cmake { - path "../src/CMakeLists.txt" + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } - // The default CMake version for the Android Gradle Plugin is 3.10.2. - // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake - // - // The Flutter tooling requires that developers have CMake 3.10 or later - // installed. You should not increase this version, as doing so will cause - // the plugin to fail to compile for some customers of the plugin. - // version "3.10.2" - } + kotlinOptions { + jvmTarget = "1.8" } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceSets { + main.java.srcDirs += "src/main/kotlin" + test.java.srcDirs += "src/test/kotlin" } defaultConfig { - minSdkVersion minSdkVersion + minSdk = 21 + } + + dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test") + testImplementation("org.mockito:mockito-core:5.0.0") + } + + testOptions { + unitTests.all { + useJUnitPlatform() + + testLogging { + events "passed", "skipped", "failed", "standardOut", "standardError" + outputs.upToDateWhen {false} + showStandardStreams = true + } + } } } From 608665a9e5eff079e3e73565faef876b8f90bf6c Mon Sep 17 00:00:00 2001 From: Kim Dong-Hyun Date: Sat, 8 Jun 2024 19:13:45 +0900 Subject: [PATCH 3/3] Bump Java version in CI --- .github/workflows/example_app.yaml | 2 +- .github/workflows/test_app.yaml | 2 +- .github/workflows/user_app.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/example_app.yaml b/.github/workflows/example_app.yaml index 482471fe..f6083d0e 100644 --- a/.github/workflows/example_app.yaml +++ b/.github/workflows/example_app.yaml @@ -69,7 +69,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Setup Python uses: actions/setup-python@v5 diff --git a/.github/workflows/test_app.yaml b/.github/workflows/test_app.yaml index 97d5668f..d1f8a519 100644 --- a/.github/workflows/test_app.yaml +++ b/.github/workflows/test_app.yaml @@ -70,7 +70,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Setup Python uses: actions/setup-python@v5 diff --git a/.github/workflows/user_app.yaml b/.github/workflows/user_app.yaml index ba023c7d..d2192656 100644 --- a/.github/workflows/user_app.yaml +++ b/.github/workflows/user_app.yaml @@ -53,7 +53,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Setup Python uses: actions/setup-python@v5