@@ -73,9 +73,8 @@ 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 {
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() } }
7978 // 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
8079 description =
8180 " 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) {
105104 val projectName = project.name
106105 val apiBuildDir = file(buildDir.resolve(API_DIR ))
107106 val apiBuild = task<KotlinApiBuildTask >(" apiBuild" ) {
108- onlyIf { apiCheckEnabled }
107+ isEnabled = apiCheckEnabled
109108 // 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
110109 description =
111110 " Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -125,7 +124,7 @@ private fun Project.configureCheckTasks(
125124 val projectName = project.name
126125 val apiCheckDir = file(projectDir.resolve(API_DIR ))
127126 val apiCheck = task<ApiCompareCompareTask >(" apiCheck" ) {
128- onlyIf { apiCheckEnabled }
127+ isEnabled = apiCheckEnabled && apiBuild.map { it.enabled }.getOrElse( true )
129128 group = " verification"
130129 description = " Checks signatures of public API against the golden value in API folder for $projectName "
131130 projectApiDir = apiCheckDir
@@ -134,7 +133,7 @@ private fun Project.configureCheckTasks(
134133 }
135134
136135 task<Sync >(" apiDump" ) {
137- onlyIf { apiCheckEnabled }
136+ isEnabled = apiCheckEnabled && apiBuild.map { it.enabled }.getOrElse( true )
138137 group = " other"
139138 description = " Syncs API from build dir to $API_DIR dir for $projectName "
140139 from(apiBuildDir)
0 commit comments