@@ -73,9 +73,8 @@ private fun Project.configureKotlinCompilation(compilation: KotlinCompilation<Ko
73
73
val projectName = project.name
74
74
val apiBuildDir = file(buildDir.resolve(API_DIR ))
75
75
val apiBuild = task<KotlinApiBuildTask >(" apiBuild" ) {
76
- onlyIf {
77
- apiCheckEnabled && compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } }
78
- }
76
+ // Do not enable task for empty umbrella modules
77
+ isEnabled = apiCheckEnabled && compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } }
79
78
// 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
80
79
description =
81
80
" Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -105,7 +104,7 @@ private fun Project.configureApiTasks(sourceSet: SourceSet) {
105
104
val projectName = project.name
106
105
val apiBuildDir = file(buildDir.resolve(API_DIR ))
107
106
val apiBuild = task<KotlinApiBuildTask >(" apiBuild" ) {
108
- onlyIf { apiCheckEnabled }
107
+ isEnabled = apiCheckEnabled
109
108
// 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
110
109
description =
111
110
" Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -125,7 +124,7 @@ private fun Project.configureCheckTasks(
125
124
val projectName = project.name
126
125
val apiCheckDir = file(projectDir.resolve(API_DIR ))
127
126
val apiCheck = task<ApiCompareCompareTask >(" apiCheck" ) {
128
- onlyIf { apiCheckEnabled }
127
+ isEnabled = apiCheckEnabled && apiBuild.map { it.enabled }.getOrElse( true )
129
128
group = " verification"
130
129
description = " Checks signatures of public API against the golden value in API folder for $projectName "
131
130
projectApiDir = apiCheckDir
@@ -134,7 +133,7 @@ private fun Project.configureCheckTasks(
134
133
}
135
134
136
135
task<Sync >(" apiDump" ) {
137
- onlyIf { apiCheckEnabled }
136
+ isEnabled = apiCheckEnabled && apiBuild.map { it.enabled }.getOrElse( true )
138
137
group = " other"
139
138
description = " Syncs API from build dir to $API_DIR dir for $projectName "
140
139
from(apiBuildDir)
0 commit comments