@@ -182,7 +182,7 @@ private fun Project.configureKotlinCompilation(
182
182
val apiBuild = task<KotlinApiBuildTask >(targetConfig.apiTaskName(" Build" ), extension) {
183
183
// Do not enable task for empty umbrella modules
184
184
isEnabled =
185
- apiCheckEnabled(extension) && compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } }
185
+ apiCheckEnabled(projectName, extension) && compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } }
186
186
// 'group' is not specified deliberately, so it will be hidden from ./gradlew tasks
187
187
description =
188
188
" Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -206,8 +206,8 @@ private fun Project.configureKotlinCompilation(
206
206
val Project .sourceSets: SourceSetContainer
207
207
get() = convention.getPlugin(JavaPluginConvention ::class .java).sourceSets
208
208
209
- fun Project. apiCheckEnabled (extension : ApiValidationExtension ): Boolean =
210
- name !in extension.ignoredProjects && ! extension.validationDisabled
209
+ fun apiCheckEnabled (projectName : String , extension : ApiValidationExtension ): Boolean =
210
+ projectName !in extension.ignoredProjects && ! extension.validationDisabled
211
211
212
212
private fun Project.configureApiTasks (
213
213
sourceSet : SourceSet ,
@@ -217,7 +217,7 @@ private fun Project.configureApiTasks(
217
217
val projectName = project.name
218
218
val apiBuildDir = targetConfig.apiDir.map { buildDir.resolve(it) }
219
219
val apiBuild = task<KotlinApiBuildTask >(targetConfig.apiTaskName(" Build" ), extension) {
220
- isEnabled = apiCheckEnabled(extension)
220
+ isEnabled = apiCheckEnabled(projectName, extension)
221
221
// 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
222
222
description =
223
223
" Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -244,7 +244,7 @@ private fun Project.configureCheckTasks(
244
244
}
245
245
}
246
246
val apiCheck = task<KotlinApiCompareTask >(targetConfig.apiTaskName(" Check" )) {
247
- isEnabled = apiCheckEnabled(extension) && apiBuild.map { it.enabled }.getOrElse(true )
247
+ isEnabled = apiCheckEnabled(projectName, extension) && apiBuild.map { it.enabled }.getOrElse(true )
248
248
group = " verification"
249
249
description = " Checks signatures of public API against the golden value in API folder for $projectName "
250
250
run {
@@ -261,15 +261,12 @@ private fun Project.configureCheckTasks(
261
261
}
262
262
263
263
val apiDump = task<Sync >(targetConfig.apiTaskName(" Dump" )) {
264
- isEnabled = apiCheckEnabled(extension) && apiBuild.map { it.enabled }.getOrElse(true )
264
+ isEnabled = apiCheckEnabled(projectName, extension) && apiBuild.map { it.enabled }.getOrElse(true )
265
265
group = " other"
266
266
description = " Syncs API from build dir to ${targetConfig.apiDir} dir for $projectName "
267
267
from(apiBuildDir)
268
268
into(apiCheckDir)
269
269
dependsOn(apiBuild)
270
- doFirst {
271
- apiCheckDir.get().mkdirs()
272
- }
273
270
}
274
271
275
272
commonApiDump?.configure { it.dependsOn(apiDump) }
0 commit comments