diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-05-20 12:05:26 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-06-15 13:15:30 +0200 |
commit | f3baf10b4c882230d382bfcdd94163d070bd0e25 (patch) | |
tree | 128b63b10f05242cfce88da6714d9e04987b5651 /runners/maven-plugin/src/main | |
parent | 645e02fb42bbf1cd3ee2773a014ea1e553e09229 (diff) | |
download | dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.gz dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.bz2 dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.zip |
Rework dokka configuration and Gradle plugin
Diffstat (limited to 'runners/maven-plugin/src/main')
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 8242d0d1..71fe5b40 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -29,11 +29,9 @@ import org.eclipse.aether.transport.file.FileTransporterFactory import org.eclipse.aether.transport.http.HttpTransporterFactory import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator import org.jetbrains.dokka.* -import org.jetbrains.dokka.utilities.DokkaConsoleLogger import java.io.File import java.net.URL - class SourceLinkMapItem { @Parameter(name = "path", required = true) var path: String = "" @@ -92,8 +90,6 @@ abstract class AbstractDokkaMojo : AbstractMojo() { @Parameter var sourceRoots: List<SourceRoot> = emptyList() - @Parameter - var dependentSourceRoots: List<SourceRoot> = emptyList() @Parameter var dependentSourceSets: List<String> = emptyList() @@ -146,6 +142,12 @@ abstract class AbstractDokkaMojo : AbstractMojo() { @Parameter var cacheRoot: String? = null + @Parameter(defaultValue = "JVM") + var displayName: String = "JVM" + + @Parameter(defaultValue = "false") + var offlineMode: Boolean = false + @Parameter var languageVersion: String? = null @@ -158,25 +160,14 @@ abstract class AbstractDokkaMojo : AbstractMojo() { @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 - - @Parameter var dokkaPlugins: List<Dependency> = emptyList() protected abstract fun getOutDir(): String @@ -209,19 +200,21 @@ abstract class AbstractDokkaMojo : AbstractMojo() { } val passConfiguration = PassConfigurationImpl( + moduleName = moduleName, + displayName = displayName, + sourceSetID = sourceSetName, classpath = classpath, - sourceSetName = sourceSetName, sourceRoots = sourceDirectories.map { SourceRootImpl(it) }, - dependentSourceRoots = dependentSourceRoots.map { SourceRootImpl(path = it.path) }, dependentSourceSets = dependentSourceSets, 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, + includeNonPublic = includeNonPublic, + includeRootPackage = includeRootPackage, reportUndocumented = reportUndocumented, + skipEmptyPackages = skipEmptyPackages, + skipDeprecated = skipDeprecated, + jdkVersion = jdkVersion, + sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) }, perPackageOptions = perPackageOptions.map { PackageOptionsImpl( prefix = it.prefix, @@ -232,18 +225,13 @@ abstract class AbstractDokkaMojo : AbstractMojo() { ) }, externalDocumentationLinks = externalDocumentationLinks.map { it.build() as ExternalDocumentationLinkImpl }, - noStdlibLink = noStdlibLink, - noJdkLink = noJdkLink, languageVersion = languageVersion, apiVersion = apiVersion, - moduleName = moduleName, + noStdlibLink = noStdlibLink, + noJdkLink = noJdkLink, suppressedFiles = suppressedFiles, - sinceKotlin = sinceKotlin, - analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT, - targets = targets, - includeNonPublic = includeNonPublic, - includeRootPackage = includeRootPackage - ).let{ + analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT + ).let { it.copy( externalDocumentationLinks = defaultLinks(it) + it.externalDocumentationLinks ) @@ -254,12 +242,11 @@ abstract class AbstractDokkaMojo : AbstractMojo() { val configuration = DokkaConfigurationImpl( outputDir = getOutDir(), format = getOutFormat(), - impliedPlatforms = impliedPlatforms, + offlineMode = offlineMode, cacheRoot = cacheRoot, passesConfigurations = listOf(passConfiguration).also { - if(passConfiguration.moduleName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module") + if (passConfiguration.moduleName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module") }, - generateIndexPages = generateIndexPages, pluginsClasspath = getArtifactByAether("org.jetbrains.dokka", "dokka-base", dokkaVersion) + dokkaPlugins.map { getArtifactByAether(it.groupId, it.artifactId, it.version) }.flatten(), pluginsConfiguration = mutableMapOf(), //TODO implement as it is in Gradle |