aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-05-19 19:02:58 +0200
committerBłażej Kardyś <bkardys@virtuslab.com>2020-05-20 13:31:00 +0200
commit6b85bb2ec2764a2c8b14717ef8e013a0f3c6e99f (patch)
treef29b4101c306d824f39787d817bd038fbf740779 /runners/gradle-plugin
parentff450fedb3c8bdc318b55954bc37d93b30b9277c (diff)
downloaddokka-6b85bb2ec2764a2c8b14717ef8e013a0f3c6e99f.tar.gz
dokka-6b85bb2ec2764a2c8b14717ef8e013a0f3c6e99f.tar.bz2
dokka-6b85bb2ec2764a2c8b14717ef8e013a0f3c6e99f.zip
Merging of platform dependent hints in sourceset tree
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt20
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt1
3 files changed, 15 insertions, 8 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
index ca7e4f1e..c69c6f67 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
@@ -47,6 +47,7 @@ class ConfigurationExtractor(private val project: Project) {
classpath,
sourceSet.kotlin.sourceDirectories.filter { it.exists() }.toList(),
dependencies,
+ sourceSet.dependsOn.map { it.name },
compilation.target.targetName
)
}
@@ -54,7 +55,7 @@ class ConfigurationExtractor(private val project: Project) {
fun extractFromJavaPlugin(): PlatformData? =
project.convention.findPlugin(JavaPluginConvention::class.java)
?.run { sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME)?.allSource?.srcDirs }
- ?.let { PlatformData(null, emptyList(), it.toList(), emptyList(), "") }
+ ?.let { PlatformData(null, emptyList(), it.toList(), emptyList(), emptyList(), "") }
fun extractFromKotlinTasks(passName: String, kotlinTasks: List<Task>): PlatformData? =
try {
@@ -84,7 +85,8 @@ class ConfigurationExtractor(private val project: Project) {
task.name,
getClasspath(it),
getSourceSet(it),
- getDependentSourceSet(it),
+ getDependentSourceSetRoots(it),
+ getDependentSourceSet(it).map { it.name },
it?.platformType?.toString() ?: ""
)
}
@@ -126,7 +128,7 @@ class ConfigurationExtractor(private val project: Project) {
}
classpath.addAll(project.files(allClasspath).toList())
- return PlatformData(null, classpath, allSourceRoots.toList(), emptyList(), "")
+ return PlatformData(null, classpath, allSourceRoots.toList(), emptyList(), emptyList(),"")
}
private fun getSourceSet(target: KotlinTarget, variantName: String? = null): List<File> =
@@ -151,11 +153,12 @@ class ConfigurationExtractor(private val project: Project) {
?.filter { it.exists() }
.orEmpty()
- private fun getDependentSourceSet(compilation: KotlinCompilation<*>?): List<File> = compilation
- ?.let { it.allKotlinSourceSets - it.kotlinSourceSets }
- ?.flatMap { it.kotlin.sourceDirectories }
- ?.filter { it.exists() }
- .orEmpty()
+ private fun getDependentSourceSet(compilation: KotlinCompilation<*>?) = compilation
+ ?.let { it.allKotlinSourceSets - it.kotlinSourceSets }.orEmpty()
+
+ private fun getDependentSourceSetRoots(compilation: KotlinCompilation<*>?): List<File> =
+ getDependentSourceSet(compilation)?.flatMap { it.kotlin.sourceDirectories }
+ .filter { it.exists() }
private fun getClasspath(compilation: KotlinCompilation<*>?): List<File> = compilation
?.compileDependencyFiles
@@ -212,6 +215,7 @@ class ConfigurationExtractor(private val project: Project) {
val classpath: List<File>,
val sourceRoots: List<File>,
val dependentSourceRoots: List<File>,
+ val dependentSourceSets: List<String>,
val platform: String
) : Serializable
} \ No newline at end of file
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 109e7838..d72ec0f9 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -268,8 +268,10 @@ open class DokkaTask : DefaultTask(), Configurable {
autoConfig: PlatformData
) =
userConfig.copy().apply {
+ sourceSetName = autoConfig.name ?: ""
sourceRoots.addAll(userConfig.sourceRoots.union(autoConfig.sourceRoots.toSourceRoots()).distinct())
dependentSourceRoots.addAll(userConfig.dependentSourceRoots.union(autoConfig.dependentSourceRoots.toSourceRoots()).distinct())
+ dependentSourceSets.addAll(userConfig.dependentSourceSets.union(autoConfig.dependentSourceSets).distinct())
classpath = userConfig.classpath.union(autoConfig.classpath.map { it.absolutePath }).distinct()
if (userConfig.platform == null && autoConfig.platform != "")
platform = autoConfig.platform
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
index 9719686e..5c300cc3 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
@@ -30,6 +30,7 @@ open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassCo
@Input override var sourceSetName: String = ""
@Input override var sourceRoots: MutableList<SourceRoot> = mutableListOf()
@Input override var dependentSourceRoots: MutableList<SourceRoot> = mutableListOf()
+ @Input override var dependentSourceSets: MutableList<String> = mutableListOf()
@Input override var samples: List<String> = emptyList()
@Input override var includes: List<String> = emptyList()
@Input override var includeNonPublic: Boolean = false