From 5ee6a6037db1531247b0262bcd0e49aab3bdc1db Mon Sep 17 00:00:00 2001 From: Sergey Igushkin Date: Tue, 23 Oct 2018 16:06:38 +0300 Subject: [PATCH] (minor) Move the unused source sets check to the taskGraph.whenReady This is a workaround for Android compilations being configured in an afterEvaluate callback. Issue #KT-26963 Fixed --- .../kotlin/gradle/plugin/mpp/UnusedSourceSetsChecker.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/UnusedSourceSetsChecker.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/UnusedSourceSetsChecker.kt index 9504b222b3c..ce2168dcb15 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/UnusedSourceSetsChecker.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/UnusedSourceSetsChecker.kt @@ -35,7 +35,8 @@ object UnusedSourceSetsChecker { } fun checkSourceSets(project: Project) { - project.afterEvaluate { + // TODO once Android compilations are configured eagerly, move this to afterEvaluate { ... } instead of taskGraph.whenReady { ... } + project.gradle.taskGraph.whenReady { _ -> val compilationsBySourceSet = compilationsBySourceSet(project) val unusedSourceSets = project.kotlinExtension.sourceSets.filter { compilationsBySourceSet[it]?.isEmpty() ?: true