Skip to content

Commit

Permalink
chore: Apply plugins declarative for Example App (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABausG authored Jul 16, 2024
1 parent bb4895c commit 3066e72
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 40 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/flutter-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 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 "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 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'
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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.** { *; }
13 changes: 0 additions & 13 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
30 changes: 22 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3066e72

Please sign in to comment.