allow packages to be excluded and added kotlin-jdbc to the API
This commit is contained in:
@@ -2,10 +2,10 @@ import kotlin.modules.*
|
|||||||
|
|
||||||
fun project() {
|
fun project() {
|
||||||
module("apidocs") {
|
module("apidocs") {
|
||||||
classpath += "kunit/lib/junit-4.9.jar"
|
classpath += "../kunit/lib/junit-4.9.jar"
|
||||||
|
|
||||||
addSourceFiles("../stdlib/ktSrc")
|
|
||||||
addSourceFiles("../stdlib/src")
|
addSourceFiles("../stdlib/src")
|
||||||
addSourceFiles("../kunit/src/main/kotlin")
|
addSourceFiles("../kunit/src/main/kotlin")
|
||||||
|
addSourceFiles("../kotlin-jdbc/src/main/kotlin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package org.jetbrains.kotlin.doc
|
|||||||
import kotlin.*
|
import kotlin.*
|
||||||
import kotlin.util.*
|
import kotlin.util.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import org.jetbrains.kotlin.doc.model.KPackage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration used with KDoc
|
* The configuration used with KDoc
|
||||||
@@ -24,6 +25,11 @@ class KDocConfig() {
|
|||||||
*/
|
*/
|
||||||
public val packagePrefixToUrls: Map<String, String> = TreeMap<String, String>(LongestFirstStringComparator())
|
public val packagePrefixToUrls: Map<String, String> = TreeMap<String, String>(LongestFirstStringComparator())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Set of the package name prefixes to ignore from the KDoc report
|
||||||
|
*/
|
||||||
|
public val ignorePackages: Set<String> = HashSet<String>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a warning should be generated if there are no comments
|
* Returns true if a warning should be generated if there are no comments
|
||||||
* on documented function or property
|
* on documented function or property
|
||||||
@@ -78,6 +84,13 @@ class KDocConfig() {
|
|||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the package should be included in the report
|
||||||
|
*/
|
||||||
|
fun includePackage(pkg: KPackage): Boolean {
|
||||||
|
return !ignorePackages.any{ pkg.name.startsWith(it) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class LongestFirstStringComparator() : Comparator<String> {
|
protected class LongestFirstStringComparator() : Comparator<String> {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class KModel(var context: BindingContext, val config: KDocConfig) {
|
|||||||
|
|
||||||
/** Returns the local packages */
|
/** Returns the local packages */
|
||||||
public val packages: Collection<KPackage>
|
public val packages: Collection<KPackage>
|
||||||
get() = allPackages.filter{ it.local }
|
get() = allPackages.filter{ it.local && config.includePackage(it) }
|
||||||
|
|
||||||
public val classes: Collection<KClass>
|
public val classes: Collection<KClass>
|
||||||
get() = packages.flatMap{ it.classes }
|
get() = packages.flatMap{ it.classes }
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import kotlin.modules.*
|
||||||
|
|
||||||
|
fun project() {
|
||||||
|
module("apidocs") {
|
||||||
|
classpath += "kunit/lib/junit-4.9.jar"
|
||||||
|
|
||||||
|
addSourceFiles("../stdlib/src")
|
||||||
|
addSourceFiles("../kunit/src/main/kotlin")
|
||||||
|
addSourceFiles("../kotlin-jdbc/src/main/kotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,12 +24,15 @@ class GenerateSiteTest : TestCase() {
|
|||||||
|
|
||||||
copyDocResources(outDir)
|
copyDocResources(outDir)
|
||||||
val args = KDocArguments()
|
val args = KDocArguments()
|
||||||
args.setSrc("../stdlib/src")
|
args.setModule("../kdoc/ApiDocsModule.kt")
|
||||||
args.setDocOutputDir(outDir.toString())
|
args.setDocOutputDir(outDir.toString())
|
||||||
args.setOutputDir("target/classes-stdlib")
|
args.setOutputDir("target/classes-stdlib")
|
||||||
|
|
||||||
val config = args.docConfig
|
val config = args.docConfig
|
||||||
config.title = "Kotlin API ($version)"
|
config.title = "Kotlin API ($version)"
|
||||||
config.version = version
|
config.version = version
|
||||||
|
config.ignorePackages.add("org.jetbrains.kotlin")
|
||||||
|
config.ignorePackages.add("kotlin.template.experiment")
|
||||||
|
|
||||||
val compiler = KDocCompiler()
|
val compiler = KDocCompiler()
|
||||||
compiler.exec(System.out, args)
|
compiler.exec(System.out, args)
|
||||||
|
|||||||
Reference in New Issue
Block a user