Unverified Commit 6facb969 authored by Bartek Pacia's avatar Bartek Pacia Committed by GitHub

Reland "Add support for Gradle Kotlin DSL (#140744)" (#142752)

This PR attempts to:
- reland #140744
- reland #141541 (which is also in #142300 - I will close it once this PR is merged)
parent 3280be93
......@@ -3,36 +3,36 @@
// found in the LICENSE file.
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
id("com.android.application")
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace "io.flutter.examples.hello_world"
compileSdk flutter.compileSdkVersion
namespace = "io.flutter.examples.hello_world"
compileSdk = flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "io.flutter.examples.hello_world"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutter.versionCode()
versionName flutter.versionName()
applicationId = "io.flutter.examples.hello_world"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode()
versionName = flutter.versionName()
}
buildTypes {
release {
named("release") {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source '../..'
source = "../.."
}
......@@ -2,25 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto generated.
// To update all the build.gradle files in the Flutter repo,
// See dev/tools/bin/generate_gradle_lockfiles.dart.
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
// Contents of this file should be generated automatically by
// dev/tools/bin/generate_gradle_lockfiles.dart, but currently are not.
// See #141540.
allprojects {
repositories {
......@@ -29,22 +13,22 @@ allprojects {
}
}
rootProject.buildDir = '../build'
rootProject.buildDir = file("../build")
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.buildDir = file("${rootProject.buildDir}/${project.name}")
}
subprojects {
project.evaluationDependsOn(':app')
project.evaluationDependsOn(":app")
dependencyLocking {
ignoredDependencies.add('io.flutter:*')
ignoredDependencies.add("io.flutter:*")
lockFile = file("${rootProject.projectDir}/project-${project.name}.lockfile")
if (!project.hasProperty('local-engine-repo')) {
if (!project.hasProperty("local-engine-repo")) {
lockAllConfigurations()
}
}
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
androidx.databinding:databinding-common:7.4.2=classpath
androidx.databinding:databinding-compiler-common:7.4.2=classpath
com.android.application:com.android.application.gradle.plugin:7.4.2=classpath
com.android.databinding:baseLibrary:7.4.2=classpath
com.android.tools.analytics-library:crash:30.4.2=classpath
com.android.tools.analytics-library:protos:30.4.2=classpath
com.android.tools.analytics-library:shared:30.4.2=classpath
com.android.tools.analytics-library:tracker:30.4.2=classpath
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta10=classpath
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta10=classpath
com.android.tools.build:aapt2-proto:7.4.2-8841542=classpath
com.android.tools.build:aaptcompiler:7.4.2=classpath
com.android.tools.build:apksig:7.4.2=classpath
com.android.tools.build:apkzlib:7.4.2=classpath
com.android.tools.build:builder-model:7.4.2=classpath
com.android.tools.build:builder-test-api:7.4.2=classpath
com.android.tools.build:builder:7.4.2=classpath
com.android.tools.build:bundletool:1.11.4=classpath
com.android.tools.build:gradle-api:7.4.2=classpath
com.android.tools.build:gradle-settings-api:7.4.2=classpath
com.android.tools.build:gradle:7.4.2=classpath
com.android.tools.build:manifest-merger:30.4.2=classpath
com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api=classpath
com.android.tools.ddms:ddmlib:30.4.2=classpath
com.android.tools.layoutlib:layoutlib-api:30.4.2=classpath
com.android.tools.lint:lint-model:30.4.2=classpath
com.android.tools.lint:lint-typedef-remover:30.4.2=classpath
com.android.tools.utp:android-device-provider-ddmlib-proto:30.4.2=classpath
com.android.tools.utp:android-device-provider-gradle-proto:30.4.2=classpath
com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:30.4.2=classpath
com.android.tools.utp:android-test-plugin-host-coverage-proto:30.4.2=classpath
com.android.tools.utp:android-test-plugin-host-retention-proto:30.4.2=classpath
com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.4.2=classpath
com.android.tools:annotations:30.4.2=classpath
com.android.tools:common:30.4.2=classpath
com.android.tools:dvlib:30.4.2=classpath
com.android.tools:repository:30.4.2=classpath
com.android.tools:sdk-common:30.4.2=classpath
com.android.tools:sdklib:30.4.2=classpath
com.android:signflinger:7.4.2=classpath
com.android:zipflinger:7.4.2=classpath
com.github.gundy:semver4j:0.16.4=classpath
com.google.android:annotations:4.1.1.4=classpath
com.google.api.grpc:proto-google-common-protos:2.0.1=classpath
com.google.auto.value:auto-value-annotations:1.6.2=classpath
com.google.code.findbugs:jsr305:3.0.2=classpath
com.google.code.gson:gson:2.8.9=classpath
com.google.crypto.tink:tink:1.3.0-rc2=classpath
com.google.dagger:dagger:2.28.3=classpath
com.google.errorprone:error_prone_annotations:2.4.0=classpath
com.google.flatbuffers:flatbuffers-java:1.12.0=classpath
com.google.guava:failureaccess:1.0.1=classpath
com.google.guava:guava:30.1-jre=classpath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=classpath
com.google.j2objc:j2objc-annotations:1.3=classpath
com.google.jimfs:jimfs:1.1=classpath
com.google.protobuf:protobuf-java-util:3.17.2=classpath
com.google.protobuf:protobuf-java:3.17.2=classpath
com.google.testing.platform:core-proto:0.0.8-alpha08=classpath
com.googlecode.juniversalchardet:juniversalchardet:1.0.3=classpath
com.squareup:javapoet:1.10.0=classpath
com.squareup:javawriter:2.5.0=classpath
com.sun.activation:javax.activation:1.2.0=classpath
com.sun.istack:istack-commons-runtime:3.0.8=classpath
com.sun.xml.fastinfoset:FastInfoset:1.2.16=classpath
commons-codec:commons-codec:1.11=classpath
commons-io:commons-io:2.4=classpath
commons-logging:commons-logging:1.2=classpath
de.undercouch:gradle-download-task:4.1.1=classpath
io.grpc:grpc-api:1.39.0=classpath
io.grpc:grpc-context:1.39.0=classpath
io.grpc:grpc-core:1.39.0=classpath
io.grpc:grpc-netty:1.39.0=classpath
io.grpc:grpc-protobuf-lite:1.39.0=classpath
io.grpc:grpc-protobuf:1.39.0=classpath
io.grpc:grpc-stub:1.39.0=classpath
io.netty:netty-buffer:4.1.52.Final=classpath
io.netty:netty-codec-http2:4.1.52.Final=classpath
io.netty:netty-codec-http:4.1.52.Final=classpath
io.netty:netty-codec-socks:4.1.52.Final=classpath
io.netty:netty-codec:4.1.52.Final=classpath
io.netty:netty-common:4.1.52.Final=classpath
io.netty:netty-handler-proxy:4.1.52.Final=classpath
io.netty:netty-handler:4.1.52.Final=classpath
io.netty:netty-resolver:4.1.52.Final=classpath
io.netty:netty-transport:4.1.52.Final=classpath
io.perfmark:perfmark-api:0.23.0=classpath
jakarta.activation:jakarta.activation-api:1.2.1=classpath
jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=classpath
javax.annotation:javax.annotation-api:1.3.2=classpath
javax.inject:javax.inject:1=classpath
net.java.dev.jna:jna-platform:5.6.0=classpath
net.java.dev.jna:jna:5.6.0=classpath
net.sf.jopt-simple:jopt-simple:4.9=classpath
net.sf.kxml:kxml2:2.3.0=classpath
org.apache.commons:commons-compress:1.20=classpath
org.apache.httpcomponents:httpclient:4.5.13=classpath
org.apache.httpcomponents:httpcore:4.4.13=classpath
org.apache.httpcomponents:httpmime:4.5.6=classpath
org.bitbucket.b_c:jose4j:0.7.0=classpath
org.bouncycastle:bcpkix-jdk15on:1.67=classpath
org.bouncycastle:bcprov-jdk15on:1.67=classpath
org.checkerframework:checker-qual:3.5.0=classpath
org.codehaus.mojo:animal-sniffer-annotations:1.19=classpath
org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
org.glassfish.jaxb:txw2:2.3.2=classpath
org.jdom:jdom2:2.0.6=classpath
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
org.jetbrains.kotlin:kotlin-android-extensions:1.9.0=classpath
org.jetbrains.kotlin:kotlin-build-tools-api:1.9.0=classpath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.0=classpath
org.jetbrains.kotlin:kotlin-compiler-runner:1.9.0=classpath
org.jetbrains.kotlin:kotlin-daemon-client:1.9.0=classpath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0=classpath
org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.0=classpath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.9.0=classpath
org.jetbrains.kotlin:kotlin-native-utils:1.9.0=classpath
org.jetbrains.kotlin:kotlin-project-model:1.9.0=classpath
org.jetbrains.kotlin:kotlin-scripting-common:1.9.0=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.9.0=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.9.0=classpath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.9.0=classpath
org.jetbrains.kotlin:kotlin-tooling-core:1.9.0=classpath
org.jetbrains.kotlin:kotlin-util-io:1.9.0=classpath
org.jetbrains.kotlin:kotlin-util-klib:1.9.0=classpath
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.10=classpath
org.jetbrains.kotlin:kotlin-android-extensions:1.7.10=classpath
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.7.10=classpath
org.jetbrains.kotlin:kotlin-build-common:1.7.10=classpath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-compiler-runner:1.7.10=classpath
org.jetbrains.kotlin:kotlin-daemon-client:1.7.10=classpath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10=classpath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.7.10=classpath
org.jetbrains.kotlin:kotlin-native-utils:1.7.10=classpath
org.jetbrains.kotlin:kotlin-project-model:1.7.10=classpath
org.jetbrains.kotlin:kotlin-reflect:1.8.20=classpath
org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=classpath
org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20=classpath
org.jetbrains.kotlin:kotlin-stdlib:1.8.20=classpath
org.jetbrains.kotlin:kotlin-tooling-core:1.7.10=classpath
org.jetbrains.kotlin:kotlin-tooling-metadata:1.7.10=classpath
org.jetbrains.kotlin:kotlin-util-io:1.7.10=classpath
org.jetbrains.kotlin:kotlin-util-klib:1.7.10=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath
org.jetbrains:annotations:13.0=classpath
org.json:json:20180813=classpath
org.jvnet.staxex:stax-ex:1.8.1=classpath
org.ow2.asm:asm-analysis:9.2=classpath
org.ow2.asm:asm-commons:9.2=classpath
org.ow2.asm:asm-tree:9.2=classpath
org.ow2.asm:asm-util:9.2=classpath
org.ow2.asm:asm:9.2=classpath
org.slf4j:slf4j-api:1.7.30=classpath
org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2=classpath
xerces:xercesImpl:2.12.0=classpath
xml-apis:xml-apis:1.4.01=classpath
empty=
......@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Contents of this file automatically generated by dev/tools/bin/generate_gradle_lockfiles.dart.
// Do not merge changes to this file. See #140115.
// Contents of this file should be generated automatically by
// dev/tools/bin/generate_gradle_lockfiles.dart, but currently are not.
// See #141540.
pluginManagement {
val flutterSdkPath = run {
......@@ -23,9 +24,17 @@ pluginManagement {
}
}
buildscript {
dependencyLocking {
lockFile = file("${rootProject.projectDir}/buildscript-gradle.lockfile")
lockAllConfigurations()
}
}
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")
......@@ -762,11 +762,20 @@ class FlutterPlugin implements Plugin<Project> {
}
/**
* Returns `true` if the given path contains an `android/build.gradle` file.
* Returns `true` if the given path contains an `android` directory
* containing a `build.gradle` or `build.gradle.kts` file.
*/
private Boolean doesSupportAndroidPlatform(String path) {
File editableAndroidProject = new File(path, 'android' + File.separator + 'build.gradle')
return editableAndroidProject.exists()
File buildGradle = new File(path, 'android' + File.separator + 'build.gradle')
File buildGradleKts = new File(path, 'android' + File.separator + 'build.gradle.kts')
if (buildGradle.exists() && buildGradleKts.exists()) {
logger.error(
"Both build.gradle and build.gradle.kts exist, so " +
"build.gradle.kts is ignored. This is likely a mistake."
)
}
return buildGradle.exists() || buildGradleKts.exists()
}
/**
......
......@@ -455,8 +455,8 @@ class AndroidProject extends FlutterProjectPlatform {
@override
String get pluginConfigKey => AndroidPlugin.kConfigKey;
static final RegExp _androidNamespacePattern = RegExp('android {[\\S\\s]+namespace[\\s]+[\'"](.+)[\'"]');
static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'"](.*)[\'"]\\s*\$');
static final RegExp _androidNamespacePattern = RegExp('android {[\\S\\s]+namespace\\s*=?\\s*[\'"](.+)[\'"]');
static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s*=?\\s*[\'"](.*)[\'"]\\s*\$');
static final RegExp _imperativeKotlinPluginPattern = RegExp('^\\s*apply plugin\\:\\s+[\'"]kotlin-android[\'"]\\s*\$');
static final RegExp _declarativeKotlinPluginPattern = RegExp('^\\s*id\\s+[\'"]kotlin-android[\'"]\\s*\$');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment