diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 8 | ||||
-rw-r--r-- | core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt | 3 | ||||
-rw-r--r-- | core/src/main/kotlin/main.kt | 11 | ||||
-rw-r--r-- | core/src/test/kotlin/TestAPI.kt | 2 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 8 |
5 files changed, 23 insertions, 9 deletions
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") |