From 965745553c5c54b87f3b0a4e828bf8cf44261427 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 4 Nov 2024 13:45:22 -0800 Subject: [PATCH 1/4] migrated seven imperatively applied gradle plugins to be applied declaratively # Conflicts: # packages/flutter_adaptive_scaffold/example/android/build.gradle # packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle # packages/pigeon/platform_tests/test_plugin/example/android/build.gradle --- .../example/android/app/build.gradle | 19 +++----- .../example/android/build.gradle | 13 ------ .../example/android/settings.gradle | 41 ++++++++++-------- .../example/android/app/build.gradle | 14 +++--- .../example/android/build.gradle | 11 ----- .../example/android/settings.gradle | 43 +++++++++---------- .../example/android/app/build.gradle | 14 +++--- .../example/android/build.gradle | 11 ----- .../example/android/settings.gradle | 43 +++++++++---------- .../example/android/settings.gradle | 14 +----- .../example/android/app/build.gradle | 15 +++---- .../example/android/build.gradle | 11 ----- .../example/android/settings.gradle | 42 +++++++++--------- .../example/android/app/build.gradle | 15 +++---- .../example/android/build.gradle | 13 ------ .../example/android/settings.gradle | 41 ++++++++++-------- .../example/android/app/build.gradle | 19 +++----- .../test_plugin/example/android/build.gradle | 13 ------ .../example/android/settings.gradle | 41 ++++++++++-------- 19 files changed, 165 insertions(+), 268 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/example/android/app/build.gradle b/packages/flutter_adaptive_scaffold/example/android/app/build.gradle index ac4a5d1ca35..1eafa2f094d 100644 --- a/packages/flutter_adaptive_scaffold/example/android/app/build.gradle +++ b/packages/flutter_adaptive_scaffold/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,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 { compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion @@ -66,7 +63,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/packages/flutter_adaptive_scaffold/example/android/build.gradle b/packages/flutter_adaptive_scaffold/example/android/build.gradle index 510b513a815..b9db5700753 100644 --- a/packages/flutter_adaptive_scaffold/example/android/build.gradle +++ b/packages/flutter_adaptive_scaffold/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/flutter_adaptive_scaffold/example/android/settings.gradle b/packages/flutter_adaptive_scaffold/example/android/settings.gradle index f246a74091b..2bb2ce92680 100644 --- a/packages/flutter_adaptive_scaffold/example/android/settings.gradle +++ b/packages/flutter_adaptive_scaffold/example/android/settings.gradle @@ -1,24 +1,27 @@ -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) } - -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" - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" + google() + mavenCentral() + gradlePluginPortal() } } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.2" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" +} + +include ":app" diff --git a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle index 0251b4794a2..3d009e4fd4f 100644 --- a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle +++ b/packages/google_sign_in/google_sign_in/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,9 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { namespace 'io.flutter.plugins.googlesigninexample' compileSdk flutter.compileSdkVersion diff --git a/packages/google_sign_in/google_sign_in/example/android/build.gradle b/packages/google_sign_in/google_sign_in/example/android/build.gradle index 0bed8906c09..b9db5700753 100644 --- a/packages/google_sign_in/google_sign_in/example/android/build.gradle +++ b/packages/google_sign_in/google_sign_in/example/android/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/google_sign_in/google_sign_in/example/android/settings.gradle b/packages/google_sign_in/google_sign_in/example/android/settings.gradle index e54a7e1fd6e..a989e8eb35b 100644 --- a/packages/google_sign_in/google_sign_in/example/android/settings.gradle +++ b/packages/google_sign_in/google_sign_in/example/android/settings.gradle @@ -1,28 +1,27 @@ -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.withInputStream { stream -> plugins.load(stream) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" - } +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.2" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +include ":app" diff --git a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle index 867de3fd0ac..36575d65a90 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/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,9 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { namespace 'io.flutter.plugins.googlesigninexample' compileSdk flutter.compileSdkVersion diff --git a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle index ba8a335002e..0b6e9f1672f 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle index e54a7e1fd6e..bb344fb79ff 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle @@ -1,28 +1,27 @@ -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.withInputStream { stream -> plugins.load(stream) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" - } +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.1" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +include ":app" diff --git a/packages/interactive_media_ads/example/android/settings.gradle b/packages/interactive_media_ads/example/android/settings.gradle index b766503aa36..bb344fb79ff 100644 --- a/packages/interactive_media_ads/example/android/settings.gradle +++ b/packages/interactive_media_ads/example/android/settings.gradle @@ -17,23 +17,11 @@ pluginManagement { } // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" - } -} - plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.1" apply false id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } include ":app" - -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" diff --git a/packages/palette_generator/example/android/app/build.gradle b/packages/palette_generator/example/android/app/build.gradle index c03f3db0324..f38935a3e74 100644 --- a/packages/palette_generator/example/android/app/build.gradle +++ b/packages/palette_generator/example/android/app/build.gradle @@ -1,3 +1,8 @@ +plugins { + id "com.android.application" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,19 +11,11 @@ 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 flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { throw new GradleException("versionName not found. Define flutter.versionName in the local.properties file.") } -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { compileSdk flutter.compileSdkVersion @@ -26,7 +23,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "io.flutter.packages.palettegenerator.imagecolors" - minSdkVersion 19 + minSdkVersion flutter.minSdkVersion targetSdkVersion 33 versionCode 1 versionName flutterVersionName diff --git a/packages/palette_generator/example/android/build.gradle b/packages/palette_generator/example/android/build.gradle index 0bed8906c09..b9db5700753 100644 --- a/packages/palette_generator/example/android/build.gradle +++ b/packages/palette_generator/example/android/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/palette_generator/example/android/settings.gradle b/packages/palette_generator/example/android/settings.gradle index 32735a3cfd4..96619e83b20 100644 --- a/packages/palette_generator/example/android/settings.gradle +++ b/packages/palette_generator/example/android/settings.gradle @@ -1,28 +1,26 @@ -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) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" - } +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.2" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +include ":app" diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle index 21beeb8a704..b6364e4df79 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/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,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 { namespace 'com.example.alternate_language_test_plugin_example' compileSdk flutter.compileSdkVersion diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle index 3da67241496..3f78da216a0 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle index f246a74091b..93c30cf9a77 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle @@ -1,24 +1,27 @@ -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) } - -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" - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" + google() + mavenCentral() + gradlePluginPortal() } } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.1" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" +} + +include ":app" diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle index 9f40fc4d232..3cba4a9ea20 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/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,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 { namespace 'com.example.test_plugin_example' compileSdk flutter.compileSdkVersion @@ -66,7 +63,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle index 6daa2e734ae..aa651bee379 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle index f246a74091b..93c30cf9a77 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle +++ b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle @@ -1,24 +1,27 @@ -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) } - -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" - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" + google() + mavenCentral() + gradlePluginPortal() } } -apply plugin: "com.google.cloud.artifactregistry.gradle-plugin" + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.1" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" +} + +include ":app" From 154a5fb77b94bcaee67e26add6b486f986e9eb8a Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 4 Nov 2024 16:11:17 -0800 Subject: [PATCH 2/4] upgraded google sign in sdk version to 35 --- .../google_sign_in/example/android/app/build.gradle | 2 +- .../example/android/app/src/main/AndroidManifest.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle index 3d009e4fd4f..471d8cfed7c 100644 --- a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle +++ b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle @@ -30,7 +30,7 @@ android { defaultConfig { applicationId "io.flutter.plugins.googlesigninexample" minSdkVersion flutter.minSdkVersion - targetSdkVersion 28 + targetSdkVersion 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/packages/google_sign_in/google_sign_in/example/android/app/src/main/AndroidManifest.xml b/packages/google_sign_in/google_sign_in/example/android/app/src/main/AndroidManifest.xml index 22a34d7218f..11d4b694880 100644 --- a/packages/google_sign_in/google_sign_in/example/android/app/src/main/AndroidManifest.xml +++ b/packages/google_sign_in/google_sign_in/example/android/app/src/main/AndroidManifest.xml @@ -8,6 +8,7 @@ android:theme="@android:style/Theme.Black.NoTitleBar" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection" android:hardwareAccelerated="true" + android:exported="true" android:windowSoftInputMode="adjustResize"> From 6d7807135720a488231b567989ac5c1ecbc7ff98 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 4 Nov 2024 17:29:36 -0800 Subject: [PATCH 3/4] fix merge conflict kotlin gradle plugin to 1.9.0 --- .../flutter_adaptive_scaffold/example/android/settings.gradle | 2 +- .../example/android/settings.gradle | 2 +- .../platform_tests/test_plugin/example/android/settings.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/flutter_adaptive_scaffold/example/android/settings.gradle b/packages/flutter_adaptive_scaffold/example/android/settings.gradle index 2bb2ce92680..74d52ff12f4 100644 --- a/packages/flutter_adaptive_scaffold/example/android/settings.gradle +++ b/packages/flutter_adaptive_scaffold/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.2" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle index 93c30cf9a77..d056e4db366 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle index 93c30cf9a77..d056e4db366 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle +++ b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } From 07593c7390b067770fe610f611e989d8a2506574 Mon Sep 17 00:00:00 2001 From: jesswrd Date: Wed, 6 Nov 2024 10:24:31 -0800 Subject: [PATCH 4/4] updated kotlin android plugin to 1.9.0 --- .../google_sign_in/example/android/settings.gradle | 2 +- .../google_sign_in_android/example/android/settings.gradle | 2 +- packages/interactive_media_ads/example/android/settings.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/example/android/settings.gradle b/packages/google_sign_in/google_sign_in/example/android/settings.gradle index a989e8eb35b..0667903d572 100644 --- a/packages/google_sign_in/google_sign_in/example/android/settings.gradle +++ b/packages/google_sign_in/google_sign_in/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.2" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } diff --git a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle index bb344fb79ff..078698fe752 100644 --- a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle +++ b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" } diff --git a/packages/interactive_media_ads/example/android/settings.gradle b/packages/interactive_media_ads/example/android/settings.gradle index bb344fb79ff..078698fe752 100644 --- a/packages/interactive_media_ads/example/android/settings.gradle +++ b/packages/interactive_media_ads/example/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.1" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" }