diff options
Diffstat (limited to 'runners/maven-plugin/src/main/kotlin/DokkaMojo.kt')
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 122 |
1 files changed, 80 insertions, 42 deletions
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 324703a0..fb11ecac 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -15,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() { @@ -37,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 { @@ -62,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() @@ -75,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 = "" @@ -87,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() @@ -117,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() { @@ -127,35 +145,55 @@ abstract class AbstractDokkaMojo : AbstractMojo() { } sourceLinks.forEach { - if (it.dir.contains("\\")) { - throw MojoExecutionException("Incorrect dir property, only Unix based path allowed.") + if (it.path.contains("\\")) { + throw MojoExecutionException("Incorrect path property, only Unix based path allowed.") } } - 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, - noJdkLink = noJdkLink, - cacheRoot = cacheRoot, - languageVersion = languageVersion, - apiVersion = apiVersion - ) + 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, + sinceKotlin = sinceKotlin, + analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT, + targets = targets, + includeNonPublic = includeNonPublic, + includeRootPackage = includeRootPackage ) + val configuration = DokkaConfigurationImpl( + outputDir = getOutDir(), + format = getOutFormat(), + impliedPlatforms = impliedPlatforms, + cacheRoot = cacheRoot, + passesConfigurations = listOf(passConfiguration), + generateIndexPages = generateIndexPages + ) + + val gen = DokkaGenerator(configuration, MavenDokkaLogger(log)) + gen.generate() } } @@ -246,11 +284,11 @@ class DokkaJavadocJarMojo : AbstractDokkaMojo() { val javadocJar = File(jarOutputDirectory, jarFileName) val archiver = MavenArchiver() - archiver.setArchiver(jarArchiver) + archiver.archiver = jarArchiver archiver.setOutputFile(javadocJar) archiver.archiver.addDirectory(File(outputDir), arrayOf("**/**"), arrayOf()) - archive.setAddMavenDescriptor(false) + archive.isAddMavenDescriptor = false archiver.createArchive(session, project, archive) return javadocJar |