diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8be5946..8aadcbb 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -212,7 +212,7 @@ jobs: needs: setup_matrix # Per requirements: macOS-26 runner is required to access the iPhone 17 simulator environment runs-on: macos-26 - timeout-minutes: 60 + timeout-minutes: 75 strategy: matrix: flutter_version: ${{ fromJson(needs.setup_matrix.outputs.flutter_versions_json) }} @@ -227,6 +227,7 @@ jobs: cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - name: Start iOS simulator + id: ios_simulator # Using standard simulator-action to handle the simulator lifecycle on macOS-26 uses: futureware-tech/simulator-action@v5 with: @@ -240,6 +241,7 @@ jobs: cd wakelock_plus/example flutter pub get flutter drive \ + -d ${{ steps.ios_simulator.outputs.udid }} \ --driver=test_driver/integration_test.dart \ --target=integration_test/wakelock_plus_test.dart diff --git a/wakelock_plus/android/build.gradle b/wakelock_plus/android/build.gradle index d2a1ffe..a6391b9 100644 --- a/wakelock_plus/android/build.gradle +++ b/wakelock_plus/android/build.gradle @@ -1,27 +1,15 @@ -group 'dev.fluttercommunity.plus.wakelock' -version '1.0-SNAPSHOT' - -buildscript { - ext.kotlin_version = '2.2.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.12.1' - } +plugins { + id 'com.android.library' } -rootProject.allprojects { - repositories { - google() - mavenCentral() - } +// Conditionally apply KGP only if AGP version is earlier than 9. +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int +if (agpMajor < 9) { + project.pluginManager.apply('org.jetbrains.kotlin.android') } -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +group 'dev.fluttercommunity.plus.wakelock' +version '1.0-SNAPSHOT' android { namespace 'dev.fluttercommunity.plus.wakelock' @@ -32,9 +20,6 @@ android { targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } lintOptions { disable 'InvalidPackage' } @@ -51,7 +36,6 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.mockito:mockito-core:5.0.0' } @@ -69,3 +53,11 @@ android { } } } + + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + diff --git a/wakelock_plus/example/android/app/build.gradle b/wakelock_plus/example/android/app/build.gradle index c53cd6c..22e9976 100644 --- a/wakelock_plus/example/android/app/build.gradle +++ b/wakelock_plus/example/android/app/build.gradle @@ -1,8 +1,14 @@ plugins { id 'com.android.application' - id 'kotlin-android' id 'dev.flutter.flutter-gradle-plugin' } + +// Conditionally apply KGP only if AGP version is earlier than 9. +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int +if (agpMajor < 9) { + project.pluginManager.apply('org.jetbrains.kotlin.android') +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -31,9 +37,6 @@ android { targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -59,6 +62,13 @@ android { } } +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + + flutter { source '../..' } diff --git a/wakelock_plus/example/android/gradle.properties b/wakelock_plus/example/android/gradle.properties index bee0af8..6a41485 100644 --- a/wakelock_plus/example/android/gradle.properties +++ b/wakelock_plus/example/android/gradle.properties @@ -1,3 +1,8 @@ org.gradle.jvmargs=-Xmx4g android.useAndroidX=true android.enableJetifier=true + +# This builtInKotlin flag was added automatically by Flutter migrator +android.builtInKotlin=false +# This newDsl flag was added automatically by Flutter migrator +android.newDsl=false