Fix project structure for Dokka

Co-authored-by: 微莹·纤绫 <karlatemp@vip.qq.com>
This commit is contained in:
Him188 2021-12-28 15:58:22 +00:00
parent 25910dbe0c
commit 1ab48748ab
7 changed files with 13 additions and 10 deletions

View File

@ -32,17 +32,20 @@ object BinaryCompatibilityConfigurator {
} }
project.afterEvaluate { project.afterEvaluate {
val validatorProject = findProject(project.path + ":validator-${dir.name}") val validatorProject = findProject(getValidatorDir(dir))
validatorProject validatorProject?.afterEvaluate {
?.getTasksByName("apiDump", false) tasks.getByName("apiDump").let { apiDumpAll.dependsOn(it) }
?.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. * @param targetName `null` for JVM projects.
*/ */
@ -59,9 +62,9 @@ object BinaryCompatibilityConfigurator {
) )
project.afterEvaluate { project.afterEvaluate {
findProject(project.path + ":validator-${dir.name}") findProject(getValidatorDir(dir))
?.afterEvaluate { ?.afterEvaluate {
tasks["apiBuild"].dependsOn(project.tasks["build"]) tasks.findByName("apiBuild")?.dependsOn(project.tasks["build"])
} }
} }
} }

View File

@ -106,7 +106,7 @@ for (project in allProjects) {
if (!validationDir.exists()) continue if (!validationDir.exists()) continue
validationDir.listFiles().orEmpty<File>().forEach { dir -> validationDir.listFiles().orEmpty<File>().forEach { dir ->
if (dir.resolve("build.gradle.kts").isFile) { if (dir.resolve("build.gradle.kts").isFile) {
val path = project.path + ":validator-${dir.name}" val path = ":validator" + project.path + ":${dir.name}"
include(path) include(path)
project(path).projectDir = dir project(path).projectDir = dir
// project(path).name = "${project.name}-validator-${dir.name}" // project(path).name = "${project.name}-validator-${dir.name}"