aboutsummaryrefslogtreecommitdiff
path: root/plugins/versioning
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/versioning')
-rw-r--r--plugins/versioning/api/versioning.api2
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/DefaultPreviousDocumentationCopyPostAction.kt4
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionCommandConsumer.kt4
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionsCommand.kt4
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningConfiguration.kt18
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningPlugin.kt40
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningStorage.kt19
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsNavigationCreator.kt8
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsOrdering.kt10
-rw-r--r--plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/htmlPreprocessors.kt8
10 files changed, 69 insertions, 48 deletions
diff --git a/plugins/versioning/api/versioning.api b/plugins/versioning/api/versioning.api
index b163fd4a..6ba2c822 100644
--- a/plugins/versioning/api/versioning.api
+++ b/plugins/versioning/api/versioning.api
@@ -114,7 +114,7 @@ public final class org/jetbrains/dokka/versioning/VersioningConfiguration$Compan
public final fun getDefaultOlderVersions ()Ljava/util/List;
public final fun getDefaultOlderVersionsDir ()Ljava/io/File;
public final fun getDefaultRenderVersionsNavigationOnAllPages ()Z
- public final fun getDefaultVersion ()Ljava/lang/Void;
+ public final fun getDefaultVersion ()Ljava/lang/String;
public final fun getDefaultVersionsOrdering ()Ljava/util/List;
}
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/DefaultPreviousDocumentationCopyPostAction.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/DefaultPreviousDocumentationCopyPostAction.kt
index 037e0e47..7e03f59c 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/DefaultPreviousDocumentationCopyPostAction.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/DefaultPreviousDocumentationCopyPostAction.kt
@@ -17,7 +17,9 @@ import org.jetbrains.dokka.templates.TemplateProcessingStrategy
import org.jetbrains.dokka.templates.TemplatingPlugin
import java.io.File
-class DefaultPreviousDocumentationCopyPostAction(private val context: DokkaContext) : PostAction {
+public class DefaultPreviousDocumentationCopyPostAction(
+ private val context: DokkaContext
+) : PostAction {
private val versioningStorage by lazy { context.plugin<VersioningPlugin>().querySingle { versioningStorage } }
private val processingStrategies: List<TemplateProcessingStrategy> =
context.plugin<TemplatingPlugin>().query { templateProcessingStrategy }
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionCommandConsumer.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionCommandConsumer.kt
index 39e089b8..b31afb9a 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionCommandConsumer.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionCommandConsumer.kt
@@ -17,14 +17,14 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.querySingle
-class ReplaceVersionCommandConsumer(context: DokkaContext) : ImmediateHtmlCommandConsumer {
+public class ReplaceVersionCommandConsumer(context: DokkaContext) : ImmediateHtmlCommandConsumer {
private val versionsNavigationCreator =
context.plugin<VersioningPlugin>().querySingle { versionsNavigationCreator }
private val versioningStorage =
context.plugin<VersioningPlugin>().querySingle { versioningStorage }
- override fun canProcess(command: Command) = command is ReplaceVersionsCommand
+ override fun canProcess(command: Command): Boolean = command is ReplaceVersionsCommand
override fun <R> processCommand(
command: Command,
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionsCommand.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionsCommand.kt
index 065bdc58..c9bc57b2 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionsCommand.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/ReplaceVersionsCommand.kt
@@ -14,9 +14,9 @@ import org.jetbrains.dokka.templates.CommandHandler
import org.jsoup.nodes.Element
import java.io.File
-class ReplaceVersionCommandHandler(context: DokkaContext) : CommandHandler {
+public class ReplaceVersionCommandHandler(context: DokkaContext) : CommandHandler {
- val versionsNavigationCreator by lazy {
+ public val versionsNavigationCreator: VersionsNavigationCreator by lazy {
context.plugin<VersioningPlugin>().querySingle { versionsNavigationCreator }
}
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningConfiguration.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningConfiguration.kt
index 2d8cc987..91b1117d 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningConfiguration.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningConfiguration.kt
@@ -8,7 +8,7 @@ import org.jetbrains.dokka.plugability.ConfigurableBlock
import org.jetbrains.dokka.plugability.DokkaContext
import java.io.File
-data class VersioningConfiguration(
+public data class VersioningConfiguration(
var olderVersionsDir: File? = defaultOlderVersionsDir,
var olderVersions: List<File>? = defaultOlderVersions,
var versionsOrdering: List<String>? = defaultVersionsOrdering,
@@ -25,14 +25,14 @@ data class VersioningConfiguration(
return olderVersionsDir?.listFiles()?.toList().orEmpty() + olderVersions.orEmpty()
}
- companion object {
- val defaultOlderVersionsDir: File? = null
- val defaultOlderVersions: List<File>? = null
- val defaultVersionsOrdering: List<String>? = null
- val defaultVersion = null
- val defaultRenderVersionsNavigationOnAllPages = true
+ public companion object {
+ public val defaultOlderVersionsDir: File? = null
+ public val defaultOlderVersions: List<File>? = null
+ public val defaultVersionsOrdering: List<String>? = null
+ public val defaultVersion: String? = null
+ public val defaultRenderVersionsNavigationOnAllPages: Boolean = true
- const val OLDER_VERSIONS_DIR = "older"
- const val VERSIONS_FILE = "version.json"
+ public const val OLDER_VERSIONS_DIR: String = "older"
+ public const val VERSIONS_FILE: String = "version.json"
}
}
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningPlugin.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningPlugin.kt
index 652d5ff2..2e1fde8d 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningPlugin.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningPlugin.kt
@@ -6,53 +6,61 @@ package org.jetbrains.dokka.versioning
import org.jetbrains.dokka.CoreExtensions.postActions
import org.jetbrains.dokka.base.DokkaBase
-import org.jetbrains.dokka.plugability.DokkaPlugin
-import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
-import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
-import org.jetbrains.dokka.plugability.configuration
+import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer
+import org.jetbrains.dokka.plugability.*
+import org.jetbrains.dokka.renderers.PostAction
+import org.jetbrains.dokka.templates.CommandHandler
import org.jetbrains.dokka.templates.TemplatingPlugin
+import org.jetbrains.dokka.transformers.pages.PageTransformer
-class VersioningPlugin : DokkaPlugin() {
+public class VersioningPlugin : DokkaPlugin() {
- val versioningStorage by extensionPoint<VersioningStorage>()
- val versionsNavigationCreator by extensionPoint<VersionsNavigationCreator>()
- val versionsOrdering by extensionPoint<VersionsOrdering>()
+ public val versioningStorage: ExtensionPoint<VersioningStorage> by extensionPoint()
+ public val versionsNavigationCreator: ExtensionPoint<VersionsNavigationCreator> by extensionPoint()
+ public val versionsOrdering: ExtensionPoint<VersionsOrdering> by extensionPoint()
private val dokkaBase by lazy { plugin<DokkaBase>() }
private val templatingPlugin by lazy { plugin<TemplatingPlugin>() }
- val defaultVersioningStorage by extending {
+ public val defaultVersioningStorage: Extension<VersioningStorage, *, *> by extending {
versioningStorage providing ::DefaultVersioningStorage
}
- val defaultVersioningNavigationCreator by extending {
+
+ public val defaultVersioningNavigationCreator: Extension<VersionsNavigationCreator, *, *> by extending {
versionsNavigationCreator providing ::HtmlVersionsNavigationCreator
}
- val replaceVersionCommandHandler by extending {
+
+ public val replaceVersionCommandHandler: Extension<CommandHandler, *, *> by extending {
templatingPlugin.directiveBasedCommandHandlers providing ::ReplaceVersionCommandHandler override templatingPlugin.replaceVersionCommandHandler
}
- val resolveLinkConsumer by extending {
+
+ public val resolveLinkConsumer: Extension<ImmediateHtmlCommandConsumer, *, *> by extending {
dokkaBase.immediateHtmlCommandConsumer providing ::ReplaceVersionCommandConsumer override dokkaBase.replaceVersionConsumer
}
- val cssStyleInstaller by extending {
+
+ public val cssStyleInstaller: Extension<PageTransformer, *, *> by extending {
dokkaBase.htmlPreprocessors providing ::MultiModuleStylesInstaller order {
after(dokkaBase.assetsInstaller)
before(dokkaBase.customResourceInstaller)
}
}
- val notFoundPageInstaller by extending {
+
+ public val notFoundPageInstaller: Extension<PageTransformer, *, *> by extending {
dokkaBase.htmlPreprocessors providing ::NotFoundPageInstaller order {
after(dokkaBase.assetsInstaller)
before(dokkaBase.customResourceInstaller)
} applyIf { !delayTemplateSubstitution }
}
- val versionsDefaultOrdering by extending {
+
+ public val versionsDefaultOrdering: Extension<VersionsOrdering, *, *> by extending {
versionsOrdering providing { ctx ->
configuration<VersioningPlugin, VersioningConfiguration>(ctx)?.versionsOrdering?.let {
ByConfigurationVersionOrdering(ctx)
} ?: SemVerVersionOrdering()
}
}
- val previousDocumentationCopyPostAction by extending {
+
+ public val previousDocumentationCopyPostAction: Extension<PostAction, *, *> by extending {
postActions providing ::DefaultPreviousDocumentationCopyPostAction applyIf { !delayTemplateSubstitution }
}
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningStorage.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningStorage.kt
index d748ba9b..7c9d1da0 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningStorage.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersioningStorage.kt
@@ -11,18 +11,21 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.configuration
import java.io.File
-data class VersionDirs(val src: File, val dst: File)
-data class CurrentVersion(val name: String, val dir: File)
+public data class VersionDirs(val src: File, val dst: File)
+public data class CurrentVersion(val name: String, val dir: File)
-interface VersioningStorage {
- val previousVersions: Map<VersionId, VersionDirs>
- val currentVersion: CurrentVersion
- fun createVersionFile()
+public interface VersioningStorage {
+ public val previousVersions: Map<VersionId, VersionDirs>
+ public val currentVersion: CurrentVersion
+
+ public fun createVersionFile()
}
-typealias VersionId = String
+public typealias VersionId = String
-class DefaultVersioningStorage(val context: DokkaContext) : VersioningStorage {
+public class DefaultVersioningStorage(
+ public val context: DokkaContext
+) : VersioningStorage {
private val mapper = ObjectMapper()
private val configuration = configuration<VersioningPlugin, VersioningConfiguration>(context)
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsNavigationCreator.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsNavigationCreator.kt
index 95b58380..59ce93e2 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsNavigationCreator.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsNavigationCreator.kt
@@ -14,11 +14,13 @@ import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.utilities.urlEncoded
import java.io.File
-fun interface VersionsNavigationCreator {
- operator fun invoke(output: File): String
+public fun interface VersionsNavigationCreator {
+ public operator fun invoke(output: File): String
}
-class HtmlVersionsNavigationCreator(private val context: DokkaContext) : VersionsNavigationCreator {
+public class HtmlVersionsNavigationCreator(
+ private val context: DokkaContext
+) : VersionsNavigationCreator {
private val versioningStorage by lazy { context.plugin<VersioningPlugin>().querySingle { versioningStorage } }
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsOrdering.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsOrdering.kt
index a2cea789..3d1fbe3d 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsOrdering.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/VersionsOrdering.kt
@@ -8,17 +8,19 @@ import org.apache.maven.artifact.versioning.ComparableVersion
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.configuration
-fun interface VersionsOrdering {
- fun order(records: List<VersionId>): List<VersionId>
+public fun interface VersionsOrdering {
+ public fun order(records: List<VersionId>): List<VersionId>
}
-class ByConfigurationVersionOrdering(val dokkaContext: DokkaContext) : VersionsOrdering {
+public class ByConfigurationVersionOrdering(
+ public val dokkaContext: DokkaContext
+) : VersionsOrdering {
override fun order(records: List<VersionId>): List<VersionId> =
configuration<VersioningPlugin, VersioningConfiguration>(dokkaContext)?.versionsOrdering
?: throw IllegalStateException("Attempted to use a configuration ordering without providing configuration")
}
-class SemVerVersionOrdering : VersionsOrdering {
+public class SemVerVersionOrdering : VersionsOrdering {
override fun order(records: List<VersionId>): List<VersionId> =
records.map { it to ComparableVersion(it) }.sortedByDescending { it.second }.map { it.first }
}
diff --git a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/htmlPreprocessors.kt b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/htmlPreprocessors.kt
index c245d8bb..9bdaf7d5 100644
--- a/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/htmlPreprocessors.kt
+++ b/plugins/versioning/src/main/kotlin/org/jetbrains/dokka/versioning/htmlPreprocessors.kt
@@ -10,7 +10,9 @@ import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.pages.PageTransformer
-class MultiModuleStylesInstaller(private val dokkaContext: DokkaContext) : PageTransformer {
+public class MultiModuleStylesInstaller(
+ private val dokkaContext: DokkaContext
+) : PageTransformer {
private val stylesPages = listOf(
"styles/multimodule.css",
)
@@ -26,7 +28,9 @@ class MultiModuleStylesInstaller(private val dokkaContext: DokkaContext) : PageT
}
}
-class NotFoundPageInstaller(private val dokkaContext: DokkaContext) : PageTransformer {
+public class NotFoundPageInstaller(
+ private val dokkaContext: DokkaContext
+) : PageTransformer {
private val notFoundPage = listOf(
"not-found-version.html",
)