aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/build.gradle17
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt8
-rw-r--r--core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt3
-rw-r--r--core/src/main/kotlin/main.kt11
-rw-r--r--core/src/test/kotlin/TestAPI.kt2
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt8
-rw-r--r--core/testdata/format/qualifiedNameLink.kt6
-rw-r--r--core/testdata/format/qualifiedNameLink.md8
8 files changed, 39 insertions, 24 deletions
diff --git a/core/build.gradle b/core/build.gradle
index d3ba259f..c66fc5a1 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -14,12 +14,6 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
- repositories {
- jcenter()
- maven {
- url "https://dl.bintray.com/kotlin/kotlin-eap"
- }
- }
}
apply plugin: 'java'
@@ -30,19 +24,12 @@ apply plugin: 'com.jfrog.bintray'
sourceCompatibility = 1.5
-repositories {
- mavenCentral()
- maven {
- url "https://dl.bintray.com/kotlin/kotlin-eap"
- }
-}
-
configurations {
provided
}
dependencies {
- compile "com.google.inject:guice:4.0"
+ compile "com.google.inject:guice:4.1.0"
compile "com.github.spullara.cli-parser:cli-parser:1.1.1"
compile "org.jsoup:jsoup:1.8.3"
compile "org.apache.ant:ant:1.9.6"
@@ -66,7 +53,7 @@ dependencies {
runtime files("../lib/asm-all.jar")
runtime files("../lib/jps-model.jar")
- testCompile group: 'junit', name: 'junit', version: '4.11'
+ testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version
}
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index 791c5380..c6fb0b5c 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -60,7 +60,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
val projectComponentManager = environment.project as MockComponentManager
val projectFileIndex = CoreProjectFileIndex(environment.project,
- environment.configuration.getList(CommonConfigurationKeys.CONTENT_ROOTS))
+ environment.configuration.getList(JVMConfigurationKeys.CONTENT_ROOTS))
val moduleManager = object : CoreModuleManager(environment.project, this) {
override fun getModules(): Array<out Module> = arrayOf(projectFileIndex.module)
@@ -127,7 +127,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
* List of source roots for this environment.
*/
val sources: List<String>
- get() = configuration.get(CommonConfigurationKeys.CONTENT_ROOTS)
+ get() = configuration.get(JVMConfigurationKeys.CONTENT_ROOTS)
?.filterIsInstance<KotlinSourceRoot>()
?.map { it.path } ?: emptyList()
@@ -146,7 +146,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
}
fun addRoots(list: List<ContentRoot>) {
- configuration.addAll(CommonConfigurationKeys.CONTENT_ROOTS, list)
+ configuration.addAll(JVMConfigurationKeys.CONTENT_ROOTS, list)
}
/**
@@ -186,7 +186,7 @@ class DokkaResolutionFacade(override val project: Project,
}
override fun <T : Any> getFrontendService(moduleDescriptor: ModuleDescriptor, serviceClass: Class<T>): T {
- throw UnsupportedOperationException()
+ return resolverForModule.componentProvider.getService(serviceClass)
}
override fun <T : Any> getIdeService(serviceClass: Class<T>): T {
diff --git a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
index 3834dbf8..4c46f7d6 100644
--- a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
+++ b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
@@ -17,7 +17,8 @@ class DeclarationLinkResolver
val options: DocumentationOptions) {
fun resolveContentLink(fromDescriptor: DeclarationDescriptor, href: String): ContentBlock {
val symbol = try {
- val symbols = resolveKDocLink(resolutionFacade, fromDescriptor, null, href.split('.').toList())
+ val symbols = resolveKDocLink(resolutionFacade.resolveSession.bindingContext,
+ resolutionFacade, fromDescriptor, null, href.split('.').toList())
findTargetSymbol(symbols)
} catch(e: Exception) {
null
diff --git a/core/src/main/kotlin/main.kt b/core/src/main/kotlin/main.kt
index 30a33a96..22859187 100644
--- a/core/src/main/kotlin/main.kt
+++ b/core/src/main/kotlin/main.kt
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
-import org.jetbrains.kotlin.config.CommonConfigurationKeys
+import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzerForTopLevel
import org.jetbrains.kotlin.resolve.TopDownAnalysisMode
import org.jetbrains.kotlin.utils.PathUtil
@@ -136,9 +136,16 @@ object DokkaConsoleLogger: DokkaLogger {
}
class DokkaMessageCollector(val logger: DokkaLogger): MessageCollector {
+ private var seenErrors = false
+
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
+ if (severity == CompilerMessageSeverity.ERROR) {
+ seenErrors = true
+ }
logger.error(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location))
}
+
+ override fun hasErrors() = seenErrors
}
class DokkaGenerator(val logger: DokkaLogger,
@@ -242,7 +249,7 @@ fun buildDocumentationModule(injector: Injector,
fun KotlinCoreEnvironment.getJavaSourceFiles(): List<PsiJavaFile> {
- val sourceRoots = configuration.get(CommonConfigurationKeys.CONTENT_ROOTS)
+ val sourceRoots = configuration.get(JVMConfigurationKeys.CONTENT_ROOTS)
?.filterIsInstance<JavaSourceRoot>()
?.map { it.file }
?: listOf()
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt
index 508b490a..e13a61f8 100644
--- a/core/src/test/kotlin/TestAPI.kt
+++ b/core/src/test/kotlin/TestAPI.kt
@@ -37,6 +37,8 @@ fun verifyModel(vararg roots: ContentRoot,
}
}
}
+
+ override fun hasErrors() = false
}
val environment = AnalysisEnvironment(messageCollector)
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index 864fb9d1..496972a6 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -218,6 +218,10 @@ class MarkdownFormatTest {
verifyMarkdownNodeByName("backtickInCodeBlock", "foo")
}
+ @Test fun qualifiedNameLink() {
+ verifyMarkdownNodeByName("qualifiedNameLink", "foo", withKotlinRuntime = true)
+ }
+
private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) {
verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output ->
markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members)
@@ -244,8 +248,8 @@ class MarkdownFormatTest {
}
}
- private fun verifyMarkdownNodeByName(fileName: String, name: String) {
- verifyMarkdownNodes(fileName) { model->
+ private fun verifyMarkdownNodeByName(fileName: String, name: String, withKotlinRuntime: Boolean = false) {
+ verifyMarkdownNodes(fileName, withKotlinRuntime) { model->
val nodesWithName = model.members.single().members.filter { it.name == name }
if (nodesWithName.isEmpty()) {
throw IllegalArgumentException("Found no nodes named $name")
diff --git a/core/testdata/format/qualifiedNameLink.kt b/core/testdata/format/qualifiedNameLink.kt
new file mode 100644
index 00000000..be82a990
--- /dev/null
+++ b/core/testdata/format/qualifiedNameLink.kt
@@ -0,0 +1,6 @@
+/**
+ * See [kotlin.apply] for the docs
+ */
+fun foo() {
+
+} \ No newline at end of file
diff --git a/core/testdata/format/qualifiedNameLink.md b/core/testdata/format/qualifiedNameLink.md
new file mode 100644
index 00000000..590bb435
--- /dev/null
+++ b/core/testdata/format/qualifiedNameLink.md
@@ -0,0 +1,8 @@
+[test](test/index) / [foo](test/foo)
+
+# foo
+
+`fun foo(): Unit`
+
+See [kotlin.apply](#) for the docs
+