diff --git a/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt b/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt index 1c2f9d0e0..2ed88a169 100644 --- a/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt +++ b/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt @@ -32,17 +32,20 @@ object BinaryCompatibilityConfigurator { } project.afterEvaluate { - val validatorProject = findProject(project.path + ":validator-${dir.name}") - validatorProject - ?.getTasksByName("apiDump", false) - ?.let { apiDumpAll.dependsOn(it) } + val validatorProject = findProject(getValidatorDir(dir)) + validatorProject?.afterEvaluate { + tasks.getByName("apiDump").let { apiDumpAll.dependsOn(it) } + } + + validatorProject?.afterEvaluate { + tasks.getByName("apiCheck").let { apiCheckAll.dependsOn(it) } + } - validatorProject - ?.getTasksByName("apiCheck", false) - ?.let { apiCheckAll.dependsOn(it) } } } + private fun Project.getValidatorDir(dir: File) = ":validator" + project.path + ":${dir.name}" + /** * @param targetName `null` for JVM projects. */ @@ -59,9 +62,9 @@ object BinaryCompatibilityConfigurator { ) project.afterEvaluate { - findProject(project.path + ":validator-${dir.name}") + findProject(getValidatorDir(dir)) ?.afterEvaluate { - tasks["apiBuild"].dependsOn(project.tasks["build"]) + tasks.findByName("apiBuild")?.dependsOn(project.tasks["build"]) } } } diff --git a/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/validator-jvm.api b/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api similarity index 100% rename from mirai-console/backend/mirai-console/compatibility-validation/jvm/api/validator-jvm.api rename to mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api diff --git a/mirai-core-api/compatibility-validation/android/api/validator-android.api b/mirai-core-api/compatibility-validation/android/api/android.api similarity index 100% rename from mirai-core-api/compatibility-validation/android/api/validator-android.api rename to mirai-core-api/compatibility-validation/android/api/android.api diff --git a/mirai-core-api/compatibility-validation/jvm/api/validator-jvm.api b/mirai-core-api/compatibility-validation/jvm/api/jvm.api similarity index 100% rename from mirai-core-api/compatibility-validation/jvm/api/validator-jvm.api rename to mirai-core-api/compatibility-validation/jvm/api/jvm.api diff --git a/mirai-core/compatibility-validation/android/api/validator-android.api b/mirai-core/compatibility-validation/android/api/android.api similarity index 100% rename from mirai-core/compatibility-validation/android/api/validator-android.api rename to mirai-core/compatibility-validation/android/api/android.api diff --git a/mirai-core/compatibility-validation/jvm/api/validator-jvm.api b/mirai-core/compatibility-validation/jvm/api/jvm.api similarity index 100% rename from mirai-core/compatibility-validation/jvm/api/validator-jvm.api rename to mirai-core/compatibility-validation/jvm/api/jvm.api diff --git a/settings.gradle.kts b/settings.gradle.kts index 663d9a3e6..19535a499 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -106,7 +106,7 @@ for (project in allProjects) { if (!validationDir.exists()) continue validationDir.listFiles().orEmpty().forEach { dir -> if (dir.resolve("build.gradle.kts").isFile) { - val path = project.path + ":validator-${dir.name}" + val path = ":validator" + project.path + ":${dir.name}" include(path) project(path).projectDir = dir // project(path).name = "${project.name}-validator-${dir.name}"