diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index f0ff3a07b4d..df144c5159c 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -107,26 +107,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -135,26 +119,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -231,20 +199,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -253,20 +211,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -281,36 +229,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -319,36 +241,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -357,46 +253,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -405,46 +265,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -465,36 +289,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -503,46 +301,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -551,46 +313,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -599,26 +325,10 @@
-
-
-
-
-
-
-
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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -1151,46 +547,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -1215,90 +575,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -1307,52 +599,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -1361,26 +617,16 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -2155,6 +1401,12 @@
+
+
+
+
+
+
@@ -4063,6 +3315,12 @@
+
+
+
+
+
+
@@ -6886,6 +6144,12 @@
+
+
+
+
+
+
diff --git a/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
index 3c869596282..525f745875d 100644
--- a/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
+++ b/libraries/tools/kotlin-gradle-plugin-api/build.gradle.kts
@@ -17,7 +17,7 @@ dependencies {
commonImplementation(project(":kotlin-tooling-core"))
commonCompileOnly(project(":kotlin-gradle-compiler-types"))
- commonCompileOnly("com.android.tools.build:gradle:3.6.4") {
+ commonCompileOnly("com.android.tools.build:gradle-api:4.2.2") {
// Without it - Gradle dependency resolution fails with unexpected error
// Caused by: java.lang.IllegalStateException: Unexpected parent dependency id 131. Seen ids: [129, 2, 130, 9, 10, 138, 11, 139, 140, 14, 153, 154, 155, 156, 157, 158, 161, 164, 177, 178, 51, 179, 52, 180, 53, 54, 55, 183, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 195, 68, 200, 201, 202, 203, 206, 211, 212, 215, 222, 223, 224, 231, 232, 105, 233, 106, 107, 108, 109, 110, 111, 112, 113, 114, 242, 115, 243, 116, 244, 117, 118, 119, 120, 121, 122]
// at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder.deserialize(TransientConfigurationResultsBuilder.java:171)
diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts
index cdff0ffe044..81b17e785d1 100644
--- a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts
+++ b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts
@@ -47,10 +47,10 @@ dependencies {
commonCompileOnly(project(":kotlin-scripting-compiler"))
commonCompileOnly(project(":kotlin-gradle-statistics"))
commonCompileOnly(project(":kotlin-gradle-build-metrics"))
- commonCompileOnly("com.android.tools.build:gradle:3.6.4")
- commonCompileOnly("com.android.tools.build:gradle-api:3.6.4")
- commonCompileOnly("com.android.tools.build:builder:3.6.4")
- commonCompileOnly("com.android.tools.build:builder-model:3.6.4")
+ commonCompileOnly("com.android.tools.build:gradle:4.2.2")
+ commonCompileOnly("com.android.tools.build:gradle-api:4.2.2")
+ commonCompileOnly("com.android.tools.build:builder:4.2.2")
+ commonCompileOnly("com.android.tools.build:builder-model:4.2.2")
commonCompileOnly("org.codehaus.groovy:groovy-all:2.4.12")
commonCompileOnly(intellijCore())
commonCompileOnly(commonDependency("org.jetbrains.teamcity:serviceMessages"))
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
index a71e76bd4a8..edd9bc8f169 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
@@ -117,7 +117,7 @@ class AndroidSubplugin : KotlinCompilerPluginSupportPlugin {
)
kotlinCompilation.compileKotlinTaskProvider.configure {
it.androidLayoutResourceFiles.from(
- sourceSet.res.sourceDirectoryTrees.layoutDirectories
+ sourceSet.res.getSourceDirectoryTrees().layoutDirectories
)
}
}
@@ -189,7 +189,7 @@ class AndroidSubplugin : KotlinCompilerPluginSupportPlugin {
fun addSourceSetAsVariant(name: String) {
val sourceSet = androidExtension.sourceSets.findByName(name) ?: return
- val srcDirs = sourceSet.res.sourceDirectoryTrees
+ val srcDirs = sourceSet.res.getSourceDirectoryTrees()
if (srcDirs.isNotEmpty()) {
addVariant(sourceSet.name, srcDirs)
}
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/utils/forEachAndroidVariant.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/utils/forEachAndroidVariant.kt
index 89307777540..871be70d5bc 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/utils/forEachAndroidVariant.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/utils/forEachAndroidVariant.kt
@@ -15,9 +15,6 @@ internal fun Project.forAllAndroidVariants(action: (BaseVariant) -> Unit) {
is AppExtension -> androidExtension.applicationVariants.all(action)
is LibraryExtension -> {
androidExtension.libraryVariants.all(action)
- if (androidExtension is FeatureExtension) {
- androidExtension.featureVariants.all(action)
- }
}
is TestExtension -> androidExtension.applicationVariants.all(action)