@@ -182,7 +182,7 @@ private fun Project.configureKotlinCompilation(
182182 val apiBuild = task<KotlinApiBuildTask >(targetConfig.apiTaskName(" Build" ), extension) {
183183 // Do not enable task for empty umbrella modules
184184 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() } }
186186 // 'group' is not specified deliberately, so it will be hidden from ./gradlew tasks
187187 description =
188188 " Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -206,8 +206,8 @@ private fun Project.configureKotlinCompilation(
206206val Project .sourceSets: SourceSetContainer
207207 get() = convention.getPlugin(JavaPluginConvention ::class .java).sourceSets
208208
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
211211
212212private fun Project.configureApiTasks (
213213 sourceSet : SourceSet ,
@@ -217,7 +217,7 @@ private fun Project.configureApiTasks(
217217 val projectName = project.name
218218 val apiBuildDir = targetConfig.apiDir.map { buildDir.resolve(it) }
219219 val apiBuild = task<KotlinApiBuildTask >(targetConfig.apiTaskName(" Build" ), extension) {
220- isEnabled = apiCheckEnabled(extension)
220+ isEnabled = apiCheckEnabled(projectName, extension)
221221 // 'group' is not specified deliberately so it will be hidden from ./gradlew tasks
222222 description =
223223 " Builds Kotlin API for 'main' compilations of $projectName . Complementary task and shouldn't be called manually"
@@ -244,7 +244,7 @@ private fun Project.configureCheckTasks(
244244 }
245245 }
246246 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 )
248248 group = " verification"
249249 description = " Checks signatures of public API against the golden value in API folder for $projectName "
250250 run {
@@ -261,15 +261,12 @@ private fun Project.configureCheckTasks(
261261 }
262262
263263 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 )
265265 group = " other"
266266 description = " Syncs API from build dir to ${targetConfig.apiDir} dir for $projectName "
267267 from(apiBuildDir)
268268 into(apiCheckDir)
269269 dependsOn(apiBuild)
270- doFirst {
271- apiCheckDir.get().mkdirs()
272- }
273270 }
274271
275272 commonApiDump?.configure { it.dependsOn(apiDump) }
0 commit comments