From c8a5552c9e9f8bae6a5a38ea890a44459f85985a Mon Sep 17 00:00:00 2001 From: Gabryel Monteiro Date: Mon, 19 Oct 2020 00:40:24 -0300 Subject: [PATCH] Adding projects --- docs/build.gradle | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/docs/build.gradle b/docs/build.gradle index e12704fedd..11bf16b8fb 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -46,24 +46,14 @@ kotlin { } } -private Closure includeSourcesInDokka(String... approximateNames) { - return { - parent.subprojects.forEach { - if (it != project) { - File srcDir = new File(it.projectDir.absolutePath, "src") - if (srcDir.exists() && srcDir.isDirectory()) { - srcDir.eachFile { file -> - if (approximateNames.any { file.name.contains(it) } && file.isDirectory()) { - String pathToSrc = file.absolutePath - sourceRoot { - path = pathToSrc - } - } - } - } +private List findSourcesWithName(String... approximateNames) { + return parent.subprojects + .findAll { it != project } + .collectMany { it.kotlin.sourceSets } + .findAll { sourceSet -> approximateNames.any { + nameToFilter -> sourceSet.name.contains(nameToFilter) } - } - } + }.collect { it.kotlin } } tasks.dokkaHtml { @@ -88,15 +78,15 @@ tasks.dokkaHtml { } named("commonMain") { - includeSourcesInDokka("commonMain") + sourceRoots.setFrom(findSourcesWithName("commonMain")) } named("jsMain") { - includeSourcesInDokka("jsMain/*", "commonMain/*") + sourceRoots.setFrom(findSourcesWithName("jsMain", "commonMain")) } named("jvmMain") { - includeSourcesInDokka("jvmMain/*", "commonMain/*") + sourceRoots.setFrom(findSourcesWithName("jvmMain", "commonMain")) } } }