Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Gradle dependencies #952

Merged
merged 10 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,9 +25,19 @@ 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

- name: Build example app
working-directory: example
run: flutter build apk --debug

- name: dart format
run: dart format --set-exit-if-changed .

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
39 changes: 19 additions & 20 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
group = "vn.hunghd.flutterdownloader"
version = "1.0-SNAPSHOT"

buildscript {
ext.kotlin_version = "1.9.0"
repositories {
google()
mavenCentral()
Expand All @@ -8,50 +10,47 @@ 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
targetCompatibility JavaVersion.VERSION_1_8
}

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.6.0"
implementation "androidx.core:core-ktx:1.13.1"
implementation "androidx.work:work-runtime:2.9.0"
}
38 changes: 22 additions & 16 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -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()) {
Expand All @@ -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"
Expand All @@ -21,21 +22,26 @@ 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
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="vn.hunghd.flutter_downloader_example">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>
Expand Down
22 changes: 1 addition & 21 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -27,5 +7,5 @@ subprojects {
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
delete(rootProject.buildDir)
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
30 changes: 20 additions & 10 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 6 additions & 7 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ 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:
android_path_provider: ^0.3.0
device_info_plus: ^8.0.0
device_info_plus: ^10.1.0
flutter:
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
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -25,4 +25,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
leancode_lint: ^4.0.0+2
leancode_lint: ^12.1.0