aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2017-02-23 15:21:03 +0100
committerDmitry Jemerov <yole@jetbrains.com>2017-02-23 15:21:03 +0100
commita39c7a161282d132d08bcf89eed0213374a574e9 (patch)
tree973c36ded09cfd3a92b1fbfef947503b5ee71afe /core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
parent287c8207f6c7534ac9c5dfbc6e2ce10fae9a696b (diff)
downloaddokka-a39c7a161282d132d08bcf89eed0213374a574e9.tar.gz
dokka-a39c7a161282d132d08bcf89eed0213374a574e9.tar.bz2
dokka-a39c7a161282d132d08bcf89eed0213374a574e9.zip
Allow specifying implicit platforms for each source root
Diffstat (limited to 'core/src/main/kotlin/Kotlin/DocumentationBuilder.kt')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index bcbdf5f4..e165a2b5 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.resolve.source.getPsi
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
import org.jetbrains.kotlin.types.typeUtil.supertypes
+import com.google.inject.name.Named as GuiceNamed
data class DocumentationOptions(val outputDir: String,
val outputFormat: String,
@@ -57,6 +58,8 @@ interface PackageDocumentationBuilder {
allFqNames: Collection<FqName>)
}
+const val implicitPlatformName = "implicitPlatform"
+
class DocumentationBuilder
@Inject constructor(val resolutionFacade: DokkaResolutionFacade,
val descriptorDocumentationParser: DescriptorDocumentationParser,
@@ -64,7 +67,8 @@ class DocumentationBuilder
val refGraph: NodeReferenceGraph,
val platformNodeRegistry: PlatformNodeRegistry,
val logger: DokkaLogger,
- val linkResolver: DeclarationLinkResolver) {
+ val linkResolver: DeclarationLinkResolver,
+ @GuiceNamed(implicitPlatformName) val implicitPlatforms: List<String>) {
val boringBuiltinClasses = setOf(
"kotlin.Unit", "kotlin.Byte", "kotlin.Short", "kotlin.Int", "kotlin.Long", "kotlin.Char", "kotlin.Boolean",
"kotlin.Float", "kotlin.Double", "kotlin.String", "kotlin.Array", "kotlin.Any")
@@ -237,6 +241,12 @@ class DocumentationBuilder
}
}
+ fun DocumentationNode.appendImplicitPlatforms() {
+ for (platform in implicitPlatforms) {
+ append(platformNodeRegistry[platform], RefKind.Platform)
+ }
+ }
+
fun DocumentationNode.isDeprecation() = name == "Deprecated" || name == "deprecated"
fun DocumentationNode.isSinceKotlin() = name == "SinceKotlin" && kind == NodeKind.Annotation
@@ -412,6 +422,7 @@ class DocumentationBuilder
node.appendType(underlyingType, NodeKind.TypeAliasUnderlyingType)
node.appendSourceLink(source)
+ node.appendImplicitPlatforms()
register(this, node)
return node
@@ -453,6 +464,7 @@ class DocumentationBuilder
node.appendAnnotations(this)
node.appendModifiers(this)
node.appendSourceLink(source)
+ node.appendImplicitPlatforms()
register(this, node)
return node
}
@@ -469,6 +481,7 @@ class DocumentationBuilder
fun ConstructorDescriptor.build(): DocumentationNode {
val node = nodeForDescriptor(this, NodeKind.Constructor)
node.appendInPageChildren(valueParameters, RefKind.Detail)
+ node.appendImplicitPlatforms()
register(this, node)
return node
}
@@ -497,6 +510,7 @@ class DocumentationBuilder
node.appendModifiers(this)
node.appendSourceLink(source)
node.appendSignature(this)
+ node.appendImplicitPlatforms()
overriddenDescriptors.forEach {
addOverrideLink(it, this)
@@ -543,6 +557,7 @@ class DocumentationBuilder
overriddenDescriptors.forEach {
addOverrideLink(it, this)
}
+ node.appendImplicitPlatforms()
register(this, node)
return node