Skip to content

Commit

Permalink
🚚 Migrate Gradle Plugin DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
iqfareez committed Mar 2, 2024
1 parent 8b24c14 commit 585c21e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
17 changes: 9 additions & 8 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -21,13 +29,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
Expand Down Expand Up @@ -83,7 +84,7 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
// https://github.com/flutter/flutter/issues/110658
implementation "androidx.window:window:1.0.0"
Expand Down
15 changes: 0 additions & 15 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
buildscript {
ext.kotlin_version = '1.8.22'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}

allprojects {
repositories {
google()
Expand Down
34 changes: 23 additions & 11 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
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
}()

include ':app'
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.1.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "com.google.gms.google-services" version "4.3.4" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false
}

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"
include ":app"

0 comments on commit 585c21e

Please sign in to comment.