MicroUtils/dokka/build.gradle

135 lines
4.0 KiB
Groovy
Raw Normal View History

2020-10-28 08:47:12 +00:00
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
2020-11-10 11:09:14 +00:00
id "com.android.library"
2020-11-23 12:46:52 +00:00
id "org.jetbrains.dokka"
2020-10-28 08:47:12 +00:00
}
repositories {
mavenLocal()
jcenter()
2020-11-10 11:09:14 +00:00
google()
2020-10-28 08:47:12 +00:00
mavenCentral()
}
kotlin {
jvm()
js(BOTH) {
browser()
nodejs()
}
2020-11-10 11:09:14 +00:00
android {}
2020-10-28 08:47:12 +00:00
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
project.parent.subprojects.forEach {
if (
it != project
&& it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") }
2020-11-10 11:09:14 +00:00
&& it.kotlin.sourceSets.any { it.name.contains("jsMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jvmMain") }
&& it.kotlin.sourceSets.any { it.name.contains("androidMain") }
) {
api it
}
}
}
}
jsMain {
dependencies {
implementation kotlin('stdlib')
project.parent.subprojects.forEach {
if (
it != project
&& it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jsMain") }
) {
api it
}
}
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib')
project.parent.subprojects.forEach {
if (
it != project
&& it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") }
&& it.kotlin.sourceSets.any { it.name.contains("jvmMain") }
) {
api it
}
}
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
project.parent.subprojects.forEach {
if (
it != project
&& it.hasProperty("kotlin")
&& it.kotlin.sourceSets.any { it.name.contains("commonMain") }
&& it.kotlin.sourceSets.any { it.name.contains("androidMain") }
2020-10-28 08:47:12 +00:00
) {
api it
}
}
}
}
}
}
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
return parent.subprojects
.findAll { it != project && it.hasProperty("kotlin") }
.collectMany { it.kotlin.sourceSets }
.findAll { sourceSet ->
approximateNames.any { nameToFilter ->
sourceSet.name.contains(nameToFilter)
}
}.collect { it.kotlin }
}
tasks.dokkaHtml {
dokkaSourceSets {
configureEach {
skipDeprecated.set(true)
sourceLink {
localDirectory.set(file("./"))
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/MicroUtils/blob/master/"))
remoteLineSuffix.set("#L")
}
}
named("commonMain") {
sourceRoots.setFrom(findSourcesWithName("commonMain"))
}
named("jsMain") {
sourceRoots.setFrom(findSourcesWithName("jsMain", "commonMain"))
}
named("jvmMain") {
sourceRoots.setFrom(findSourcesWithName("jvmMain", "commonMain"))
}
2020-11-10 11:09:14 +00:00
named("androidMain") {
sourceRoots.setFrom(findSourcesWithName("androidMain", "commonMain"))
}
2020-10-28 08:47:12 +00:00
}
}
2020-11-10 11:09:14 +00:00
apply from: "$defaultAndroidSettingsPresetPath"