aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-12-18 12:33:01 +0100
committerKamil Doległo <kamilok1965@interia.pl>2019-12-18 12:33:01 +0100
commit29a4cc77cb981265c3a420a47fd35e4f8da18a25 (patch)
treea1ea2180dc648efcef38dba2f7ad0b167598d790 /runners/gradle-plugin/src/main/kotlin
parent2f4d5c5a7ab98409e5474fcd4c95dd144b1d9f8c (diff)
downloaddokka-29a4cc77cb981265c3a420a47fd35e4f8da18a25.tar.gz
dokka-29a4cc77cb981265c3a420a47fd35e4f8da18a25.tar.bz2
dokka-29a4cc77cb981265c3a420a47fd35e4f8da18a25.zip
Make key methods of plugin and task protected open
Addresses https://github.com/Kotlin/dokka/issues/534
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt15
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt2
2 files changed, 8 insertions, 9 deletions
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 97deb100..c5863318 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
@@ -75,7 +75,6 @@ open class DokkaTask : DefaultTask() {
// Configure Dokka with closure in Gradle Kotlin DSL
fun configuration(action: Action<in GradlePassConfigurationImpl>) = action.execute(configuration)
-
private val kotlinTasks: List<Task> by lazy { extractKotlinCompileTasks(configuration.collectKotlinTasks ?: { defaultKotlinTasks() }) }
private val configExtractor = ConfigurationExtractor(project)
@@ -126,7 +125,7 @@ open class DokkaTask : DefaultTask() {
private fun Iterable<File>.toSourceRoots(): List<GradleSourceRootImpl> = this.filter { it.exists() }.map { GradleSourceRootImpl().apply { path = it.path } }
private fun Iterable<String>.toProjects(): List<Project> = project.subprojects.toList().filter { this.contains(it.name) }
- private fun collectSuppressedFiles(sourceRoots: List<SourceRoot>) =
+ protected open fun collectSuppressedFiles(sourceRoots: List<SourceRoot>) =
if(project.isAndroidProject()) {
val generatedRoot = project.buildDir.resolve("generated").absoluteFile
sourceRoots
@@ -188,14 +187,14 @@ open class DokkaTask : DefaultTask() {
}
}
- private fun collectConfigurations() =
+ protected open fun collectConfigurations() =
if (this.isMultiplatformProject()) collectMultiplatform() else listOf(collectSinglePlatform(configuration))
- private fun collectMultiplatform() = multiplatform
+ protected open fun collectMultiplatform() = multiplatform
.filterNot { it.name.toLowerCase() == GLOBAL_PLATFORM_NAME }
.map { collectSinglePlatform(it) }
- private fun collectSinglePlatform(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
+ protected open fun collectSinglePlatform(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
val userConfig = config.let {
if (it.collectKotlinTasks != null) {
configExtractor.extractFromKotlinTasks(extractKotlinCompileTasks(it.collectKotlinTasks!!))
@@ -237,14 +236,14 @@ open class DokkaTask : DefaultTask() {
}
}
- private fun collectFromSinglePlatformOldPlugin() =
+ protected open fun collectFromSinglePlatformOldPlugin() =
configExtractor.extractFromKotlinTasks(kotlinTasks)
?.let { mergeUserConfigurationAndPlatformData(configuration, it) }
?: configExtractor.extractFromJavaPlugin()
?.let { mergeUserConfigurationAndPlatformData(configuration, it) }
?: configuration
- private fun mergeUserConfigurationAndPlatformData(userConfig: GradlePassConfigurationImpl, autoConfig: PlatformData) =
+ protected open fun mergeUserConfigurationAndPlatformData(userConfig: GradlePassConfigurationImpl, autoConfig: PlatformData) =
userConfig.copy().apply {
sourceRoots.addAll(userConfig.sourceRoots.union(autoConfig.sourceRoots.toSourceRoots()).distinct())
classpath = userConfig.classpath.union(autoConfig.classpath.map { it.absolutePath }).distinct()
@@ -252,7 +251,7 @@ open class DokkaTask : DefaultTask() {
platform = autoConfig.platform
}
- private fun defaultPassConfiguration(
+ protected open fun defaultPassConfiguration(
config: GradlePassConfigurationImpl,
globalConfig: GradlePassConfigurationImpl?
): GradlePassConfigurationImpl {
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
index 6f8d55e4..7ed29c58 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
@@ -27,7 +27,7 @@ open class DokkaPlugin : Plugin<Project> {
defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) }
}
- private fun addTasks(project: Project, runtimeConfiguration: Configuration, taskClass: Class<out DokkaTask>) {
+ protected open fun addTasks(project: Project, runtimeConfiguration: Configuration, taskClass: Class<out DokkaTask>) {
if(GradleVersion.current() >= GradleVersion.version("4.10")) {
project.tasks.register(taskName, taskClass)
} else {