diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-02 18:34:05 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-02 18:34:05 +0100 |
commit | feed2016cea8650626ba53306251a3c42da63dfd (patch) | |
tree | f12d50f477243a4191a56235f6f50ef32534c57e /src | |
parent | 0427adc6d074caeb5644358096be149de6eb48dc (diff) | |
download | dokka-feed2016cea8650626ba53306251a3c42da63dfd.tar.gz dokka-feed2016cea8650626ba53306251a3c42da63dfd.tar.bz2 dokka-feed2016cea8650626ba53306251a3c42da63dfd.zip |
option to exclude deprecated members from generated documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 5 | ||||
-rw-r--r-- | src/main.kt | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index ddea6d6e..60f03f14 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -28,6 +28,7 @@ import org.jetbrains.kotlin.types.expressions.OperatorConventions public data class DocumentationOptions(val includeNonPublic: Boolean = false, val reportUndocumented: Boolean = true, val skipEmptyPackages: Boolean = true, + val skipDeprecated: Boolean = false, val sourceLinks: List<SourceLinkDefinition>) private fun isSamePackage(descriptor1: DeclarationDescriptor, descriptor2: DeclarationDescriptor): Boolean { @@ -289,7 +290,9 @@ class DocumentationBuilder(val session: ResolveSession, private fun DeclarationDescriptor.isDocumented(): Boolean { return (options.includeNonPublic || this !is MemberDescriptor - || this.getVisibility() in visibleToDocumentation) && !isDocumentationSuppressed() + || this.getVisibility() in visibleToDocumentation) && + !isDocumentationSuppressed() && + (!options.skipDeprecated || !isDeprecated()) } fun DeclarationDescriptor.isDocumentationSuppressed(): Boolean { diff --git a/src/main.kt b/src/main.kt index 8fa0a97e..bcd129b4 100644 --- a/src/main.kt +++ b/src/main.kt @@ -46,6 +46,9 @@ class DokkaArguments { ValueDescription("<path>") public var classpath: String = "" + Argument(value = "nodeprecated", description = "Exclude deprecated members from documentation") + public var nodeprecated: Boolean = false + } private fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition { @@ -81,7 +84,8 @@ public fun main(args: Array<String>) { arguments.moduleName, arguments.outputDir, arguments.outputFormat, - sourceLinks) + sourceLinks, + arguments.nodeprecated) generator.generate() } @@ -112,7 +116,8 @@ class DokkaGenerator(val logger: DokkaLogger, val moduleName: String, val outputDir: String, val outputFormat: String, - val sourceLinks: List<SourceLinkDefinition>) { + val sourceLinks: List<SourceLinkDefinition>, + val skipDeprecated: Boolean = false) { fun generate() { val environment = createAnalysisEnvironment() @@ -124,7 +129,7 @@ class DokkaGenerator(val logger: DokkaLogger, logger.info("Analysing sources and libraries... ") val startAnalyse = System.currentTimeMillis() - val options = DocumentationOptions(false, sourceLinks = sourceLinks) + val options = DocumentationOptions(false, sourceLinks = sourceLinks, skipDeprecated = skipDeprecated) val documentation = buildDocumentationModule(environment, moduleName, options, includes, { isSample(it) }, logger) val timeAnalyse = System.currentTimeMillis() - startAnalyse |