Skip to content

Commit bdc16ac

Browse files
committed
Disable apiDump task for projects with empty source-set directories
1 parent dd35269 commit bdc16ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ private fun Project.configureKotlinCompilation(compilation: KotlinCompilation<Ko
7373
val projectName = project.name
7474
val apiBuildDir = file(buildDir.resolve(API_DIR))
7575
val apiBuild = task<KotlinApiBuildTask>("apiBuild") {
76-
onlyIf { apiCheckEnabled }
76+
onlyIf {
77+
apiCheckEnabled && compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } }
78+
}
7779
// 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
7880
description =
7981
"Builds Kotlin API for 'main' compilations of $projectName. Complementary task and shouldn't be called manually"

0 commit comments

Comments
 (0)