aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/build.gradle72
-rw-r--r--core/build.gradle.kts49
-rw-r--r--core/src/main/kotlin/DokkaBootstrap.kt10
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt4
-rw-r--r--core/src/main/kotlin/configuration.kt98
-rw-r--r--core/src/main/kotlin/defaultConfiguration.kt74
-rw-r--r--core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt2
7 files changed, 232 insertions, 77 deletions
diff --git a/core/build.gradle b/core/build.gradle
deleted file mode 100644
index a7379595..00000000
--- a/core/build.gradle
+++ /dev/null
@@ -1,72 +0,0 @@
-import javax.tools.ToolProvider
-
-buildscript {
- dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- }
-}
-
-allprojects {
- apply plugin: 'kotlin'
-
- sourceCompatibility = 1.8
-
- tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
- kotlinOptions {
- languageVersion = language_version
- apiVersion = language_version
- jvmTarget = "1.8"
- }
- }
-}
-
-dependencies {
- testCompile project(':testApi')
- compile project(":integration")
- compile project(path: ":coreDependencies", configuration: "shadow")
-
- compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version"
- compile "org.jetbrains.kotlin:kotlin-reflect:$bundled_kotlin_compiler_version"
-
- compile group: 'com.google.inject', name: 'guice', version: '3.0'
- implementation "org.jsoup:jsoup:1.12.1"
-
- compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version"
- compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version"
-
- compile "org.jetbrains:markdown:0.1.41"
-
- compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10'
-
-
- //tools.jar
-// def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") })
-// compileOnly toolsJar
-// testCompile toolsJar
-
-
- testCompile group: 'junit', name: 'junit', version: '4.12'
- testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version
- testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0"
- implementation "com.google.code.gson:gson:$gson_version"
-
- testImplementation "org.jetbrains.kotlin:kotlin-stdlib-js:$bundled_kotlin_compiler_version"
- testImplementation "org.jetbrains.kotlin:kotlin-stdlib-common:$bundled_kotlin_compiler_version"
-// testImplementation project(":core:testApi")
-
- testCompile ideaRT()
-}
-
-apply plugin: 'maven-publish'
-
-publishing {
- publications {
- dokkaCore(MavenPublication) { publication ->
- artifactId = 'dokka-core'
-
- from components.java
- }
- }
-}
-
-bintrayPublication(project, ["dokkaCore"])
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
new file mode 100644
index 00000000..06610a38
--- /dev/null
+++ b/core/build.gradle.kts
@@ -0,0 +1,49 @@
+import org.jetbrains.configureBintrayPublication
+
+plugins {
+ id("com.github.johnrengelman.shadow")
+ `maven-publish`
+ id("com.jfrog.bintray")
+}
+
+dependencies {
+ implementation(project(":coreDependencies", configuration = "shadow"))
+
+ val kotlin_version: String by project
+ implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlin_version")
+ implementation("org.jetbrains.kotlin:kotlin-script-runtime:$kotlin_version")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
+ implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
+ implementation("org.jsoup:jsoup:1.12.1")
+ implementation("com.google.code.gson:gson:2.8.5")
+ implementation("org.jetbrains:markdown:0.1.40")
+ implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10")
+
+ testImplementation(project(":testApi"))
+ testImplementation("junit:junit:4.13")
+}
+
+tasks {
+ shadowJar {
+ val dokka_version: String by project
+ archiveFileName.set("dokka-core-$dokka_version.jar")
+ archiveClassifier.set("")
+ }
+}
+
+val sourceJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(sourceSets["main"].allSource)
+}
+
+publishing {
+ publications {
+ register<MavenPublication>("dokkaCore") {
+ artifactId = "dokka-core"
+ project.shadow.component(this)
+ artifact(sourceJar.get())
+ }
+ }
+}
+
+configureBintrayPublication("dokkaCore")
diff --git a/core/src/main/kotlin/DokkaBootstrap.kt b/core/src/main/kotlin/DokkaBootstrap.kt
new file mode 100644
index 00000000..b78eb9c6
--- /dev/null
+++ b/core/src/main/kotlin/DokkaBootstrap.kt
@@ -0,0 +1,10 @@
+package org.jetbrains.dokka
+
+import java.util.function.BiConsumer
+
+interface DokkaBootstrap {
+
+ fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String)
+
+ fun generate()
+} \ No newline at end of file
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index 5058634a..856cfa04 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -4,16 +4,12 @@ import com.intellij.psi.*
import com.intellij.psi.impl.source.tree.JavaDocElementType
import com.intellij.psi.javadoc.*
import com.intellij.psi.util.PsiTreeUtil
-import com.intellij.util.containers.isNullOrEmpty
-import kotlinx.html.P
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.utilities.DokkaLogger
-import org.jetbrains.kotlin.utils.keysToMap
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import org.jsoup.nodes.Node
import org.jsoup.nodes.TextNode
-import java.net.URI
interface JavaDocumentationParser {
fun parseDocumentation(element: PsiNamedElement): DocumentationNode
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt
new file mode 100644
index 00000000..8c6d35e8
--- /dev/null
+++ b/core/src/main/kotlin/configuration.kt
@@ -0,0 +1,98 @@
+package org.jetbrains.dokka
+
+import java.io.File
+import java.net.URL
+
+enum class Platform(val key: String) {
+ jvm("jvm"),
+ js("js"),
+ native("native"),
+ common("common");
+
+ companion object {
+ val DEFAULT = jvm
+
+ fun fromString(key: String): Platform {
+ return when (key.toLowerCase()) {
+ jvm.key -> jvm
+ js.key -> js
+ native.key -> native
+ common.key -> common
+ else -> throw IllegalArgumentException("Unrecognized platform: $key")
+ }
+ }
+ }
+}
+
+interface DokkaConfiguration {
+ val outputDir: String
+ val format: String
+ val generateIndexPages: Boolean
+ val cacheRoot: String?
+ val passesConfigurations: List<PassConfiguration>
+ val impliedPlatforms: List<String>
+ var pluginsClasspath: List<File>
+
+ interface PassConfiguration {
+ val moduleName: String
+ val classpath: List<String>
+ val sourceRoots: List<SourceRoot>
+ val samples: List<String>
+ val includes: List<String>
+ val includeNonPublic: Boolean
+ val includeRootPackage: Boolean
+ val reportUndocumented: Boolean
+ val skipEmptyPackages: Boolean
+ val skipDeprecated: Boolean
+ val jdkVersion: Int
+ val sourceLinks: List<SourceLinkDefinition>
+ val perPackageOptions: List<PackageOptions>
+ val externalDocumentationLinks: List<ExternalDocumentationLink>
+ val languageVersion: String?
+ val apiVersion: String?
+ val noStdlibLink: Boolean
+ val noJdkLink: Boolean
+ val suppressedFiles: List<String>
+ val collectInheritedExtensionsFromLibraries: Boolean
+ val analysisPlatform: Platform
+ val targets: List<String>
+ val sinceKotlin: String?
+ }
+
+ interface SourceRoot {
+ val path: String
+ }
+
+ interface SourceLinkDefinition {
+ val path: String
+ val url: String
+ val lineSuffix: String?
+ }
+
+ interface PackageOptions {
+ val prefix: String
+ val includeNonPublic: Boolean
+ val reportUndocumented: Boolean
+ val skipDeprecated: Boolean
+ val suppress: Boolean
+ }
+
+ interface ExternalDocumentationLink {
+ val url: URL
+ val packageListUrl: URL
+
+ open class Builder(open var url: URL? = null,
+ open var packageListUrl: URL? = null) {
+
+ constructor(root: String, packageList: String? = null) : this(URL(root), packageList?.let { URL(it) })
+
+ fun build(): ExternalDocumentationLink =
+ if (packageListUrl != null && url != null)
+ ExternalDocumentationLinkImpl(url!!, packageListUrl!!)
+ else if (url != null)
+ ExternalDocumentationLinkImpl(url!!, URL(url!!, "package-list"))
+ else
+ throw IllegalArgumentException("url or url && packageListUrl must not be null for external documentation link")
+ }
+ }
+}
diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt
new file mode 100644
index 00000000..6c797fcd
--- /dev/null
+++ b/core/src/main/kotlin/defaultConfiguration.kt
@@ -0,0 +1,74 @@
+package org.jetbrains.dokka
+
+import java.io.File
+import java.net.URL
+
+data class DokkaConfigurationImpl(
+ override val outputDir: String,
+ override val format: String,
+ override val generateIndexPages: Boolean,
+ override val cacheRoot: String?,
+ override val impliedPlatforms: List<String>,
+ override val passesConfigurations: List<PassConfigurationImpl>,
+ override var pluginsClasspath: List<File>
+) : DokkaConfiguration
+
+data class PassConfigurationImpl (
+ override val moduleName: String,
+ override val classpath: List<String>,
+ override val sourceRoots: List<SourceRootImpl>,
+ override val samples: List<String>,
+ override val includes: List<String>,
+ override val includeNonPublic: Boolean,
+ override val includeRootPackage: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipEmptyPackages: Boolean,
+ override val skipDeprecated: Boolean,
+ override val jdkVersion: Int,
+ override val sourceLinks: List<SourceLinkDefinitionImpl>,
+ override val perPackageOptions: List<PackageOptionsImpl>,
+ override var externalDocumentationLinks: List<ExternalDocumentationLinkImpl>,
+ override val languageVersion: String?,
+ override val apiVersion: String?,
+ override val noStdlibLink: Boolean,
+ override val noJdkLink: Boolean,
+ override val suppressedFiles: List<String>,
+ override val collectInheritedExtensionsFromLibraries: Boolean,
+ override val analysisPlatform: Platform,
+ override val targets: List<String>,
+ override val sinceKotlin: String?
+) : DokkaConfiguration.PassConfiguration
+
+
+data class SourceRootImpl(
+ override val path: String
+): DokkaConfiguration.SourceRoot
+
+data class SourceLinkDefinitionImpl(
+ override val path: String,
+ override val url: String,
+ override val lineSuffix: String?
+): DokkaConfiguration.SourceLinkDefinition {
+ companion object {
+ fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinitionImpl {
+ val (path, urlAndLine) = srcLink.split('=')
+ return SourceLinkDefinitionImpl(
+ File(path).canonicalPath,
+ urlAndLine.substringBefore("#"),
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#$it" })
+ }
+ }
+}
+
+data class PackageOptionsImpl(
+ override val prefix: String,
+ override val includeNonPublic: Boolean,
+ override val reportUndocumented: Boolean,
+ override val skipDeprecated: Boolean,
+ override val suppress: Boolean
+): DokkaConfiguration.PackageOptions
+
+
+data class ExternalDocumentationLinkImpl(override val url: URL,
+ override val packageListUrl: URL
+) : DokkaConfiguration.ExternalDocumentationLink \ No newline at end of file
diff --git a/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt b/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt
index ad165cdb..f9431bbb 100644
--- a/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt
+++ b/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt
@@ -1,8 +1,8 @@
package multiplatform
+import org.junit.Assert.assertEquals
import org.junit.Test
import testApi.testRunner.AbstractCoreTest
-import kotlin.test.assertEquals
class BasicMultiplatformTest : AbstractCoreTest() {