From 3066e72431dc3620b4a848cbe0c2d8070e1e2ff5 Mon Sep 17 00:00:00 2001 From: Anton Borries Date: Tue, 16 Jul 2024 22:16:08 +0200 Subject: [PATCH] chore: Apply plugins declarative for Example App (#274) --- .github/workflows/flutter-beta.yml | 4 +--- .github/workflows/main.yml | 4 +--- example/android/app/build.gradle | 17 ++++++--------- example/android/app/proguard-rules.pro | 7 ++++++ example/android/build.gradle | 13 ----------- example/android/settings.gradle | 30 +++++++++++++++++++------- pubspec.yaml | 6 +++--- 7 files changed, 41 insertions(+), 40 deletions(-) create mode 100644 example/android/app/proguard-rules.pro diff --git a/.github/workflows/flutter-beta.yml b/.github/workflows/flutter-beta.yml index b049c21e..526ad9f8 100644 --- a/.github/workflows/flutter-beta.yml +++ b/.github/workflows/flutter-beta.yml @@ -84,14 +84,12 @@ jobs: device: - "iPhone 14" fail-fast: false - runs-on: macos-13 + runs-on: macos-14 steps: - uses: actions/checkout@v2 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest - - name: Download iOS 17 - run: xcodebuild -downloadPlatform ios - uses: subosito/flutter-action@v1 with: channel: beta diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1280ef8a..1bbcb4e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,14 +86,12 @@ jobs: device: - "iPhone 14" fail-fast: false - runs-on: macos-13 + runs-on: macos-14 steps: - uses: actions/checkout@v2 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest - - name: Download iOS 17 - run: xcodebuild -downloadPlatform ios - uses: subosito/flutter-action@v1 with: channel: stable diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 062e0ba1..9c14b0ab 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "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 FileNotFoundException("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,10 +22,6 @@ 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 { compileSdkVersion 34 @@ -56,6 +53,7 @@ android { buildTypes { debug { minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { // TODO: Add your own signing config for the release build. @@ -71,7 +69,6 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.glance:glance-appwidget:1.0.0' implementation "androidx.work:work-runtime-ktx:2.8.1" implementation "androidx.multidex:multidex:2.0.1" diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro new file mode 100644 index 00000000..b423d1ea --- /dev/null +++ b/example/android/app/proguard-rules.pro @@ -0,0 +1,7 @@ +-dontwarn org.xmlpull.v1.** +-dontwarn org.kxml2.io.** +-dontwarn android.content.res.** +-dontwarn org.slf4j.impl.StaticLoggerBinder + +-keep class org.xmlpull.** { *; } +-keepclassmembers class org.xmlpull.** { *; } \ No newline at end of file diff --git a/example/android/build.gradle b/example/android/build.gradle index c50bc8ec..bc157bd1 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.20' - 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() diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 44e62bcf..e08e624d 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,11 +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 localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.4.2" apply false + id "org.jetbrains.kotlin.android" version "1.9.20" apply false +} + +include ":app" \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 54de7f13..7db57f12 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,14 +4,14 @@ version: 0.6.0 repository: https://github.com/ABausG/home_widget environment: - sdk: '>=2.12.0 <4.0.0' + sdk: '>=3.4.0 <4.0.0' flutter: '>=3.20.0-1.2.pre' dependencies: flutter: sdk: flutter - path_provider: ^2.1.2 - path_provider_foundation: ^2.3.2 + path_provider: ^2.1.3 + path_provider_foundation: ^2.4.0 dev_dependencies: flutter_test: