aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'runners/maven-plugin/src')
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt125
1 files changed, 87 insertions, 38 deletions
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index 0a5d63e0..5e45af9a 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -4,6 +4,7 @@ import org.apache.maven.archiver.MavenArchiveConfiguration
import org.apache.maven.archiver.MavenArchiver
import org.apache.maven.execution.MavenSession
import org.apache.maven.plugin.AbstractMojo
+import org.apache.maven.plugin.MojoExecutionException
import org.apache.maven.plugins.annotations.*
import org.apache.maven.project.MavenProject
import org.apache.maven.project.MavenProjectHelper
@@ -14,14 +15,14 @@ import java.io.File
import java.net.URL
class SourceLinkMapItem {
- @Parameter(name = "dir", required = true)
- var dir: String = ""
+ @Parameter(name = "path", required = true)
+ var path: String = ""
@Parameter(name = "url", required = true)
var url: String = ""
- @Parameter(name = "urlSuffix")
- var urlSuffix: String? = null
+ @Parameter(name = "lineSuffix")
+ var lineSuffix: String? = null
}
class ExternalDocumentationLinkBuilder : DokkaConfiguration.ExternalDocumentationLink.Builder() {
@@ -36,9 +37,6 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
class SourceRoot : DokkaConfiguration.SourceRoot {
@Parameter(required = true)
override var path: String = ""
-
- @Parameter
- override var platforms: List<String> = emptyList()
}
class PackageOptions : DokkaConfiguration.PackageOptions {
@@ -61,11 +59,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
var sourceRoots: List<SourceRoot> = emptyList()
@Parameter
- var samplesDirs: List<String> = emptyList()
-
- @Parameter
- @Deprecated("Use <includes> instead")
- var includeDirs: List<String> = emptyList()
+ var samples: List<String> = emptyList()
@Parameter
var includes: List<String> = emptyList()
@@ -74,7 +68,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
var classpath: List<String> = emptyList()
@Parameter
- var sourceLinks: Array<SourceLinkMapItem> = emptyArray()
+ var sourceLinks: List<SourceLinkMapItem> = emptyList()
@Parameter(required = true, defaultValue = "\${project.artifactId}")
var moduleName: String = ""
@@ -86,11 +80,11 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
var jdkVersion: Int = 6
@Parameter
- var skipDeprecated = false
+ var skipDeprecated: Boolean = false
@Parameter
- var skipEmptyPackages = true
+ var skipEmptyPackages: Boolean = true
@Parameter
- var reportNotDocumented = true
+ var reportUndocumented: Boolean = true
@Parameter
var impliedPlatforms: List<String> = emptyList()
@@ -104,6 +98,9 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter(defaultValue = "false")
var noStdlibLink: Boolean = false
+ @Parameter(defaultValue = "false")
+ var noJdkLink: Boolean = false
+
@Parameter
var cacheRoot: String? = null
@@ -113,7 +110,32 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var apiVersion: String? = null
+ @Parameter
+ var includeRootPackage: Boolean = false
+
+ @Parameter
+ var suppressedFiles: List<String> = emptyList()
+
+ @Parameter
+ var collectInheritedExtensionsFromLibraries: Boolean = false
+
+ @Parameter
+ var platform: String = ""
+
+ @Parameter
+ var targets: List<String> = emptyList()
+
+ @Parameter
+ var sinceKotlin: String? = null
+
+ @Parameter
+ var includeNonPublic: Boolean = false
+
+ @Parameter
+ var generateIndexPages: Boolean = false
+
protected abstract fun getOutDir(): String
+
protected abstract fun getOutFormat(): String
override fun execute() {
@@ -122,29 +144,56 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
return
}
- val gen = DokkaGenerator(
- MavenDokkaLogger(log),
- classpath,
- sourceDirectories.map { SourceRootImpl(it) } + sourceRoots,
- samplesDirs,
- includeDirs + includes,
- moduleName,
- DocumentationOptions(getOutDir(), getOutFormat(),
- sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.dir, it.url, it.urlSuffix) },
- jdkVersion = jdkVersion,
- skipDeprecated = skipDeprecated,
- skipEmptyPackages = skipEmptyPackages,
- reportUndocumented = reportNotDocumented,
- impliedPlatforms = impliedPlatforms,
- perPackageOptions = perPackageOptions,
- externalDocumentationLinks = externalDocumentationLinks.map { it.build() },
- noStdlibLink = noStdlibLink,
- cacheRoot = cacheRoot,
- languageVersion = languageVersion,
- apiVersion = apiVersion
- )
+ sourceLinks.forEach {
+ if (it.path.contains("\\")) {
+ throw MojoExecutionException("Incorrect path property, only Unix based path allowed.")
+ }
+ }
+
+ val passConfiguration = PassConfigurationImpl(
+ classpath = classpath,
+ sourceRoots = sourceDirectories.map { SourceRootImpl(it) } + sourceRoots.map { SourceRootImpl(path = it.path) },
+ samples = samples,
+ includes = includes,
+ collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries, // TODO: Should we implement this?
+ sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) },
+ jdkVersion = jdkVersion,
+ skipDeprecated = skipDeprecated,
+ skipEmptyPackages = skipEmptyPackages,
+ reportUndocumented = reportUndocumented,
+ perPackageOptions = perPackageOptions.map {
+ PackageOptionsImpl(
+ prefix = it.prefix,
+ includeNonPublic = it.includeNonPublic,
+ reportUndocumented = it.reportUndocumented,
+ skipDeprecated = it.skipDeprecated,
+ suppress = it.suppress
+ )},
+ externalDocumentationLinks = externalDocumentationLinks.map { it.build() as ExternalDocumentationLinkImpl },
+ noStdlibLink = noStdlibLink,
+ noJdkLink = noJdkLink,
+ languageVersion = languageVersion,
+ apiVersion = apiVersion,
+ moduleName = moduleName,
+ suppressedFiles = suppressedFiles, // TODO: Should we implement this?
+ sinceKotlin = sinceKotlin, // TODO: Should we implement this?
+ analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT, // TODO: Should we implement this?
+ targets = targets, // TODO: Should we implement this?
+ includeNonPublic = includeNonPublic, // TODO: Should we implement this?
+ includeRootPackage = includeRootPackage // TODO: Should we implement this?
)
+ val configuration = DokkaConfigurationImpl(
+ outputDir = getOutDir(),
+ format = getOutFormat(),
+ impliedPlatforms = impliedPlatforms,
+ cacheRoot = cacheRoot,
+ passesConfigurations = listOf(passConfiguration),
+ generateIndexPages = generateIndexPages // TODO: Should we implement this?
+ )
+
+ val gen = DokkaGenerator(configuration, MavenDokkaLogger(log))
+
gen.generate()
}
}
@@ -196,7 +245,7 @@ class DokkaJavadocJarMojo : AbstractDokkaMojo() {
/**
* The archive configuration to use.
- * See [Maven Archiver Reference](http://maven.apache.org/shared/maven-archiver/index.html)
+ * See [Maven Archiver Reference](https://maven.apache.org/shared/maven-archiver/index.html)
*/
@Parameter
private val archive = MavenArchiveConfiguration()