From 17db6d06d981e5260e2943b4d60199c7c06b8078 Mon Sep 17 00:00:00 2001 From: Timm Preetz Date: Thu, 13 Jun 2024 10:46:24 +0200 Subject: [PATCH] [sign_in_with_apple] Fix gradle warning / deprecation https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply ``` You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply ``` --- .../sign_in_with_apple/CHANGELOG.md | 6 +++- .../example/android/app/build.gradle | 19 ++++-------- .../example/android/build.gradle | 13 -------- .../example/android/settings.gradle | 30 ++++++++++++++----- .../sign_in_with_apple/pubspec.yaml | 2 +- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md b/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md index 4b8031a7..82262787 100644 --- a/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md +++ b/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md @@ -1,6 +1,10 @@ +## 6.1.2 + +- Switch to modern Gradle setup (https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) for the example app + ## 6.1.1 -- Removes references to Flutter v1 android embedding classes. +- Removes references to Flutter v1 Android embedding classes. ## 6.1.0 diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle index d472ef83..84cda3d1 100644 --- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle +++ b/packages/sign_in_with_apple/sign_in_with_apple/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 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 { compileSdkVersion flutter.compileSdkVersion @@ -62,7 +59,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle index 3109eed1..bc157bd1 100644 --- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle +++ b/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.6.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle index 44e62bcf..599ca9d6 100644 --- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle +++ b/packages/sign_in_with_apple/sign_in_with_apple/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.7.10" apply false +} + +include ":app" \ No newline at end of file diff --git a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml b/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml index 8089be2e..e79deeee 100644 --- a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml +++ b/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml @@ -1,6 +1,6 @@ name: sign_in_with_apple description: Flutter bridge to initiate Sign in with Apple (on iOS, macOS, and Android). Includes support for keychain entries as well as signing in with an Apple ID. -version: 6.1.1 +version: 6.1.2 homepage: https://github.com/aboutyou/dart_packages/tree/master/packages/sign_in_with_apple repository: https://github.com/aboutyou/dart_packages