From 60f30a65b46871cebcb67b7ec35931b9a6fdee79 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Fri, 9 Feb 2024 19:07:56 +0100 Subject: [PATCH] Migrate integration_test plugin to Gradle Kotlin DSL (#142008) We already have a simple app in this repo that fully uses Gradle Kotlin DSL (see #141541). The next small step is to have at least one plugin that also uses Gradle Kotlin DSL. Let's use `integration_test` for that, since it's versioned with Flutter SDK. --- .../integration_test/android/build.gradle | 64 ------------------- .../integration_test/android/build.gradle.kts | 63 ++++++++++++++++++ .../{settings.gradle => settings.gradle.kts} | 2 +- 3 files changed, 64 insertions(+), 65 deletions(-) delete mode 100644 packages/integration_test/android/build.gradle create mode 100644 packages/integration_test/android/build.gradle.kts rename packages/integration_test/android/{settings.gradle => settings.gradle.kts} (81%) diff --git a/packages/integration_test/android/build.gradle b/packages/integration_test/android/build.gradle deleted file mode 100644 index c31e0fb81b..0000000000 --- a/packages/integration_test/android/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -group 'dev.flutter.plugins.integration_test' -version '1.0-SNAPSHOT' - -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - } -} - -rootProject.allprojects { - repositories { - google() - mavenCentral() - } -} - -// project.getTasks().withType(JavaCompile){ -// options.compilerArgs << "-Xlint:all" << "-Werror" -// } - -apply plugin: 'com.android.library' - -android { - // Conditional for compatibility with AGP <4.2. - if (project.android.hasProperty("namespace")) { - namespace 'dev.flutter.integration_test' - } - - compileSdk 34 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - minSdkVersion 21 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'lib-proguard-rules.txt' - } - - dependencies { - // TODO(egarciad): These dependencies should not be added to release builds. - // https://github.com/flutter/flutter/issues/56591 - testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-inline:5.0.0' - - // https://developer.android.com/jetpack/androidx/releases/test/#1.2.0 - api 'androidx.test:runner:1.2.0' - api 'androidx.test:rules:1.2.0' - api 'androidx.test.espresso:espresso-core:3.2.0' - - implementation 'com.google.guava:guava:28.1-android' - } -} diff --git a/packages/integration_test/android/build.gradle.kts b/packages/integration_test/android/build.gradle.kts new file mode 100644 index 0000000000..6a671ade5c --- /dev/null +++ b/packages/integration_test/android/build.gradle.kts @@ -0,0 +1,63 @@ +// 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. + +group = "dev.flutter.plugins.integration_test" +version = "1.0-SNAPSHOT" + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath("com.android.tools.build:gradle:7.3.1") + } +} + +plugins { + id("com.android.library") +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +android { + // Conditional for compatibility with AGP <4.2. + if (project.findProject("android")?.hasProperty("namespace") == true) { + namespace = "dev.flutter.integration_test" + } + + namespace = "dev.flutter.integration_test" + compileSdk = 34 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdk = 21 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("lib-proguard-rules.txt") + } + + dependencies { + // TODO(egarciad): These dependencies should not be added to release builds. + // https://github.com/flutter/flutter/issues/56591 + testImplementation("junit:junit:4.12") + testImplementation("org.mockito:mockito-inline:5.0.0") + + // https://developer.android.com/jetpack/androidx/releases/test/#1.2.0 + api("androidx.test:runner:1.2.0") + api("androidx.test:rules:1.2.0") + api("androidx.test.espresso:espresso-core:3.2.0") + + implementation("com.google.guava:guava:28.1-android") + } +} diff --git a/packages/integration_test/android/settings.gradle b/packages/integration_test/android/settings.gradle.kts similarity index 81% rename from packages/integration_test/android/settings.gradle rename to packages/integration_test/android/settings.gradle.kts index 29941fd33e..af6ddb50da 100644 --- a/packages/integration_test/android/settings.gradle +++ b/packages/integration_test/android/settings.gradle.kts @@ -2,4 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -rootProject.name = 'integrationTest' +rootProject.name = "integrationTest"