From 6b38184a9edfa43703979a427428dfe4da875a50 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:14:38 +0100 Subject: [PATCH 01/10] bump Gradle dependencies --- android/build.gradle | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 8382a960..993561c0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,7 @@ +group "vn.hunghd.flutterdownloader" +version "1.0-SNAPSHOT" + buildscript { - ext.kotlin_version = "1.9.0" repositories { google() mavenCentral() @@ -8,28 +10,23 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:7.4.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0" classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.0" } } +repositories { + google() + mavenCentral() +} + apply plugin: "com.android.library" apply plugin: "kotlin-android" apply plugin: "org.jlleitschuh.gradle.ktlint" -group "vn.hunghd.flutterdownloader" -version "1.0-SNAPSHOT" - -rootProject.allprojects { - repositories { - google() - mavenCentral() - } -} - android { - namespace "vn.hunghd.flutterdownloader" - compileSdk 34 + namespace = "vn.hunghd.flutterdownloader" + compileSdk = 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -37,21 +34,23 @@ android { } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = JavaVersion.VERSION_1_8 + // allWarningsAsErrors = true // TODO(bartekpacia): Re-enable } sourceSets { main.java.srcDirs += "src/main/kotlin" + test.java.srcDirs += "src/test/kotlin" } defaultConfig { - minSdk 19 - targetSdk 33 + minSdk = 21 + targetSdk = 34 } } dependencies { - implementation "androidx.work:work-runtime:2.7.1" - implementation "androidx.annotation:annotation:1.5.0" - implementation "androidx.core:core-ktx:1.9.0" + compileOnly("androidx.annotation:annotation:1.7.1") + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.work:work-runtime:2.9.0") } From f0146d72aec9a3ce8e19c71b14ce1d003b11ed01 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:21:44 +0100 Subject: [PATCH 02/10] example: upgrade to declarative Gradle buildfiles --- example/android/app/build.gradle | 29 +++++++++++++---------------- example/android/build.gradle | 22 +--------------------- example/android/settings.gradle | 30 ++++++++++++++++++++---------- 3 files changed, 34 insertions(+), 47 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index a46c965a..dfe16c87 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "org.jetbrains.kotlin.android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file("local.properties") if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty("flutter.sdk") -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty("flutter.versionCode") if (flutterVersionCode == null) { flutterVersionCode = "1" @@ -21,21 +22,17 @@ if (flutterVersionName == null) { flutterVersionName = "1.0" } -apply plugin: "com.android.application" -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdk 34 - - namespace "vn.hunghd.example" + namespace = "vn.hunghd.example" + compileSdk = 34 + ndkVersion = flutter.ndkVersion defaultConfig { applicationId "vn.hunghd.example" - minSdk 19 - targetSdk 33 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdk = 21 + targetSdk = 34 + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName } buildTypes { diff --git a/example/android/build.gradle b/example/android/build.gradle index 80bb3e10..2b1df4ec 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,23 +1,3 @@ -buildscript { - ext.kotlin_version = "1.7.22" - repositories { - google() - mavenCentral() - } - - dependencies { - classpath "com.android.tools.build:gradle:7.4.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" @@ -27,5 +7,5 @@ subprojects { } tasks.register("clean", Delete) { - delete rootProject.buildDir + delete(rootProject.buildDir) } diff --git a/example/android/settings.gradle b/example/android/settings.gradle index f29f78b3..3c239623 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,25 @@ -include ":app" +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), ".flutter-plugins") -if (pluginsFile.exists()) { - pluginsFile.withReader("UTF-8") { reader -> plugins.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve("android").toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory +plugins { + id("dev.flutter.flutter-plugin-loader") + id("com.android.application") version ("8.3.1") apply false + id("org.jetbrains.kotlin.android") version ("1.9.23") apply false } + +include(":app") From 750d3e99fdc42e952ed9c7c0131433d93b7cc81c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:25:48 +0100 Subject: [PATCH 03/10] bump to Gradle 8.7 --- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index ec915a81..d951fac2 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip From 46a126c02987f5ec41830b665745d20b221b9659 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:31:17 +0100 Subject: [PATCH 04/10] more bumps --- .github/workflows/prepare.yaml | 6 ++++++ android/build.gradle | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml index c180a99d..b58a9b34 100644 --- a/.github/workflows/prepare.yaml +++ b/.github/workflows/prepare.yaml @@ -25,6 +25,12 @@ jobs: channel: stable flutter-version: ${{ matrix.flutter-version }} + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + - name: flutter pub get run: flutter pub get diff --git a/android/build.gradle b/android/build.gradle index 993561c0..9d4ffae8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ -group "vn.hunghd.flutterdownloader" -version "1.0-SNAPSHOT" +group = "vn.hunghd.flutterdownloader" +version = "1.0-SNAPSHOT" buildscript { repositories { From a00b8bdb5741f50cb3d58a4bafb3828a3d732a57 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:36:29 +0100 Subject: [PATCH 05/10] example: remove dependency on android_path_provider --- example/pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 51aa73a6..2c2cae78 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,7 +8,6 @@ environment: flutter: ">=3.10.0" dependencies: - android_path_provider: ^0.3.0 device_info_plus: ^8.0.0 flutter: sdk: flutter From 1afdcd36c3c642b7ca549dde1a390a42cfc94a73 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:39:01 +0100 Subject: [PATCH 06/10] downgrade androidx.annotation:annotation to 1.6.0 --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 9d4ffae8..38ff2bd9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -50,7 +50,7 @@ android { } dependencies { - compileOnly("androidx.annotation:annotation:1.7.1") + compileOnly("androidx.annotation:annotation:1.6.0") implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.work:work-runtime:2.9.0") } From b5f413d5b5a71f63dfa4f854d847f3c777c796d6 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 6 May 2024 22:44:25 +0100 Subject: [PATCH 07/10] example app: make to build to Gradle/AGP 8, set java bytecode to 8 --- android/build.gradle | 6 +++--- example/android/app/build.gradle | 9 +++++++++ example/android/app/src/main/AndroidManifest.xml | 2 +- example/pubspec.yaml | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 38ff2bd9..78f9b70b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -50,7 +50,7 @@ android { } dependencies { - compileOnly("androidx.annotation:annotation:1.6.0") - implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.work:work-runtime:2.9.0") + compileOnly "androidx.annotation:annotation:1.6.0" + implementation "androidx.core:core-ktx:1.13.1" + implementation "androidx.work:work-runtime:2.9.0" } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index dfe16c87..a4d5275e 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -35,6 +35,15 @@ android { versionName = flutterVersionName } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } + buildTypes { release { // Signing with the debug keys for now, so `flutter run --release` works. diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 7796dc82..d5e3a033 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2c2cae78..71146098 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=3.10.0" dependencies: - device_info_plus: ^8.0.0 + device_info_plus: ^10.1.0 flutter: sdk: flutter flutter_downloader: From 4c21e1c51ac414a304bb86a0e98f575ef42eafad Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 7 May 2024 19:34:33 +0100 Subject: [PATCH 08/10] bump min Flutter to 3.19 --- .github/workflows/prepare.yaml | 2 +- CHANGELOG.md | 7 +++++++ example/pubspec.yaml | 4 ++-- pubspec.yaml | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml index b58a9b34..cb837868 100644 --- a/.github/workflows/prepare.yaml +++ b/.github/workflows/prepare.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - flutter-version: ["3.10.x", "3.13.x", "3.16.x", "3.19.x"] + flutter-version: ["3.19.x"] steps: - name: Clone repository diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a016a85..2151c4cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.11.8 + +- Dependencies update (#952) + - Gradle buildscripts on Android + - Bump minimum Android SDK to 21 + - Bump minimum Flutter to 3.19 + ## 1.11.7 - Update dependencies (#946) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 71146098..ebcd084a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.0+1 publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" dependencies: device_info_plus: ^10.1.0 diff --git a/pubspec.yaml b/pubspec.yaml index 91b351d5..c2107227 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,8 +15,8 @@ flutter: pluginClass: FlutterDownloaderPlugin environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" dependencies: flutter: From 648d8e2c78da3edf28ee17df203e394c8ad4081e Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 7 May 2024 19:35:25 +0100 Subject: [PATCH 09/10] bump Dart deps --- example/pubspec.yaml | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ebcd084a..a81cae34 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -13,13 +13,13 @@ dependencies: sdk: flutter flutter_downloader: path: ../ - path_provider: ^2.1.2 - permission_handler: ^10.0.0 + path_provider: ^2.1.3 + permission_handler: ^11.3.1 dev_dependencies: flutter_test: sdk: flutter - leancode_lint: ^4.0.0+2 + leancode_lint: ^12.1.0 flutter: uses-material-design: true diff --git a/pubspec.yaml b/pubspec.yaml index c2107227..efba9663 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,4 +25,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - leancode_lint: ^4.0.0+2 + leancode_lint: ^12.1.0 From d617668b22396fb1ad66383e585eb954819eba54 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 7 May 2024 19:36:50 +0100 Subject: [PATCH 10/10] add build example app step --- .github/workflows/prepare.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml index cb837868..b477d381 100644 --- a/.github/workflows/prepare.yaml +++ b/.github/workflows/prepare.yaml @@ -34,6 +34,10 @@ jobs: - name: flutter pub get run: flutter pub get + - name: Build example app + working-directory: example + run: flutter build apk --debug + - name: dart format run: dart format --set-exit-if-changed .