aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt12
-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
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt9
5 files changed, 32 insertions, 12 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index f0d22aff..0818bd63 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -66,11 +66,12 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
)
override val sourceSetName: String by parser.stringOption(
- listOf("-module"),
+ listOf("-sourceSetName"),
"Name of the source set",
"main"
)
+
override val classpath: List<String> by parser.repeatableOption<String>(
listOf("-classpath"),
"Classpath for symbol resolution"
@@ -82,10 +83,15 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
) { SourceRootImpl(it) }
override val dependentSourceRoots: List<DokkaConfiguration.SourceRoot> by parser.repeatableOption(
- listOf("-src"),
- "Source file or directory (allows many paths separated by the system path separator)"
+ listOf("-dependentRoots"),
+ "Source roots of dependent source sets"
) { SourceRootImpl(it) }
+ override val dependentSourceSets: List<String> by parser.repeatableOption<String>(
+ listOf("-dependentSets"),
+ "Names of dependent source sets"
+ )
+
override val samples: List<String> by parser.repeatableOption<String>(
listOf("-sample"),
"Source root for samples"
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
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index ac22eb57..e00e5f88 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -93,6 +93,12 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
var sourceRoots: List<SourceRoot> = emptyList()
@Parameter
+ var dependentSourceRoots: List<SourceRoot> = emptyList()
+
+ @Parameter
+ var dependentSourceSets: List<String> = emptyList()
+
+ @Parameter
var samples: List<String> = emptyList()
@Parameter
@@ -206,7 +212,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
classpath = classpath,
sourceSetName = sourceSetName,
sourceRoots = sourceDirectories.map { SourceRootImpl(it) },
- dependentSourceRoots = sourceRoots.map { SourceRootImpl(path = it.path) },
+ dependentSourceRoots = dependentSourceRoots.map { SourceRootImpl(path = it.path) },
+ dependentSourceSets = dependentSourceSets,
samples = samples,
includes = includes,
collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries, // TODO: Should we implement this?