aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2019-03-18 22:05:22 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2019-03-18 22:05:22 +0300
commitfd2f36301e95f8d100e1c2b942f1590144d8c6c2 (patch)
treedcbf109f14de5301848c29e9721c8e0af6881b3e /core
parentf2359e05347708e625d5a6b339010cda2adc30de (diff)
parent4b22ebab09ce3b934443d063df6b905e5347c390 (diff)
downloaddokka-fd2f36301e95f8d100e1c2b942f1590144d8c6c2.tar.gz
dokka-fd2f36301e95f8d100e1c2b942f1590144d8c6c2.tar.bz2
dokka-fd2f36301e95f8d100e1c2b942f1590144d8c6c2.zip
Merge branch 'dev'
Diffstat (limited to 'core')
-rw-r--r--core/build.gradle2
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt76
-rw-r--r--core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt4
-rw-r--r--core/src/main/kotlin/Analysis/JavaResolveExtension.kt131
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt38
-rw-r--r--core/src/main/kotlin/Formats/AnalysisComponents.kt14
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt117
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt3
-rw-r--r--core/src/main/kotlin/Formats/OutlineService.kt2
-rw-r--r--core/src/main/kotlin/Formats/StructuredFormatService.kt6
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt20
-rw-r--r--core/src/main/kotlin/Generation/configurationImpl.kt52
-rw-r--r--core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt87
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt353
-rw-r--r--core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt9
-rw-r--r--core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt32
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt377
-rw-r--r--core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt61
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt22
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt5
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinAsJavaElementSignatureProvider.kt25
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinDescriptorSignatureProvider.kt9
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinElementSignatureProvider.kt34
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinLanguageService.kt217
-rw-r--r--core/src/main/kotlin/Languages/CommonLanguageService.kt84
-rw-r--r--core/src/main/kotlin/Languages/NewJavaLanguageService.kt197
-rw-r--r--core/src/main/kotlin/Model/Content.kt38
-rw-r--r--core/src/main/kotlin/Model/DescriptorSignatureProvider.kt7
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt86
-rw-r--r--core/src/main/kotlin/Model/DocumentationReference.kt5
-rw-r--r--core/src/main/kotlin/Model/ElementSignatureProvider.kt9
-rw-r--r--core/src/main/kotlin/Model/PackageDocs.kt74
-rw-r--r--core/src/main/kotlin/Model/SourceLinks.kt38
-rw-r--r--core/src/main/kotlin/Utilities/DokkaModules.kt6
-rw-r--r--core/src/main/kotlin/Utilities/Html.kt4
-rw-r--r--core/src/main/kotlin/Utilities/ServiceLocator.kt16
-rw-r--r--core/src/main/kotlin/Utilities/Uri.kt40
-rw-r--r--core/src/main/kotlin/javadoc/docbase.kt49
-rw-r--r--core/src/main/kotlin/javadoc/tags.kt2
-rw-r--r--core/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties2
-rw-r--r--core/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties2
-rw-r--r--core/src/main/resources/dokka/inbound-link-resolver/javadoc.properties2
-rw-r--r--core/src/test/kotlin/NodeSelect.kt90
-rw-r--r--core/src/test/kotlin/TestAPI.kt95
-rw-r--r--core/src/test/kotlin/format/HtmlFormatTest.kt6
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt1
-rw-r--r--core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt1
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt21
-rw-r--r--core/src/test/kotlin/format/PackageDocsTest.kt33
-rw-r--r--core/src/test/kotlin/javadoc/JavadocTest.kt112
-rw-r--r--core/src/test/kotlin/model/FunctionTest.kt27
-rw-r--r--core/src/test/kotlin/model/JavaTest.kt8
-rw-r--r--core/src/test/kotlin/model/KotlinAsJavaTest.kt20
-rw-r--r--core/src/test/kotlin/model/PackageTest.kt14
-rw-r--r--core/src/test/kotlin/model/PropertyTest.kt2
-rw-r--r--core/src/test/kotlin/model/SourceLinksErrorTest.kt34
-rw-r--r--core/src/test/kotlin/model/SourceLinksTest.kt74
-rw-r--r--core/testdata/format/JavaSupertype.html4
-rw-r--r--core/testdata/format/enumRef.md2
-rw-r--r--core/testdata/format/externalReferenceLink.kt2
-rw-r--r--core/testdata/format/externalReferenceLink.md4
-rw-r--r--core/testdata/format/inheritedLink.md2
-rw-r--r--core/testdata/format/inlineSuspendFunction.kt6
-rw-r--r--core/testdata/format/inlineSuspendFunction.md8
-rw-r--r--core/testdata/format/javaCodeInParam.java10
-rw-r--r--core/testdata/format/javaCodeInParam.md13
-rw-r--r--core/testdata/format/javaCodeLiteralTags.md2
-rw-r--r--core/testdata/format/javadocHtml.java12
-rw-r--r--core/testdata/format/javadocHtml.md22
-rw-r--r--core/testdata/format/jdkLinks.md8
-rw-r--r--core/testdata/format/markdownInLinks.html2
-rw-r--r--core/testdata/format/markdownInLinks.kt2
-rw-r--r--core/testdata/format/nullableTypeParameterFunction.kt8
-rw-r--r--core/testdata/format/nullableTypeParameterFunction.md18
-rw-r--r--core/testdata/format/renderFunctionalTypeInParenthesisWhenItIsReceiver.md4
-rw-r--r--core/testdata/format/suspendInlineFunction.kt6
-rw-r--r--core/testdata/format/suspendInlineFunction.md8
-rw-r--r--core/testdata/functions/inlineSuspendFunction.kt2
-rw-r--r--core/testdata/functions/suspendFunction.kt2
-rw-r--r--core/testdata/functions/suspendInlineFunction.kt2
-rw-r--r--core/testdata/java/constants.java5
-rw-r--r--core/testdata/javadoc/argumentReference.kt4
-rw-r--r--core/testdata/javadoc/constructorParameters.kt14
-rw-r--r--core/testdata/javadoc/defaultNoArgConstructor.kt12
-rw-r--r--core/testdata/javadoc/deprecated.java28
-rw-r--r--core/testdata/javadoc/noArgConstructor.kt12
-rw-r--r--core/testdata/javadoc/vararg.kt3
-rw-r--r--core/testdata/javadoc/visibilityModifiers.kt15
-rw-r--r--core/testdata/markdown/spec.txt52
-rw-r--r--core/testdata/packagedocs/referenceLinks.kotlin.md5
-rw-r--r--core/testdata/packagedocs/referenceLinks.md2
-rw-r--r--core/testdata/packagedocs/referenceLinks.module.md4
-rw-r--r--core/testdata/properties/annotatedProperty.kt2
-rw-r--r--core/testdata/sourceLinks/dummy.kt6
94 files changed, 2570 insertions, 638 deletions
diff --git a/core/build.gradle b/core/build.gradle
index a87d3c97..a4538471 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -29,7 +29,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version"
compile "teamcity:kotlin-ide-common:$bundled_kotlin_compiler_version"
- compile "teamcity:markdown:$markdownVersion"
+ compile "org.jetbrains:markdown:$markdownVersion"
compile intellijCoreAnalysis()
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index 5522d4f0..8ad7b8bb 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -18,8 +18,12 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.util.io.URLUtil
import org.jetbrains.kotlin.analyzer.*
+import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
+import org.jetbrains.kotlin.cli.common.config.ContentRoot
+import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
+import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider
@@ -29,13 +33,13 @@ import org.jetbrains.kotlin.cli.jvm.config.*
import org.jetbrains.kotlin.cli.jvm.index.JavaRoot
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.container.getService
+import org.jetbrains.kotlin.container.tryGetService
import org.jetbrains.kotlin.context.ProjectContext
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
import org.jetbrains.kotlin.name.Name
-import org.jetbrains.kotlin.platform.JvmBuiltIns
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingTrace
@@ -72,7 +76,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
val projectComponentManager = environment.project as MockComponentManager
val projectFileIndex = CoreProjectFileIndex(environment.project,
- environment.configuration.getList(JVMConfigurationKeys.CONTENT_ROOTS))
+ environment.configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS))
val moduleManager = object : CoreModuleManager(environment.project, this) {
override fun getModules(): Array<out Module> = arrayOf(projectFileIndex.module)
@@ -98,7 +102,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
}
- fun createResolutionFacade(environment: KotlinCoreEnvironment): DokkaResolutionFacade {
+ fun createResolutionFacade(environment: KotlinCoreEnvironment): Pair<DokkaResolutionFacade, DokkaResolutionFacade> {
val projectContext = ProjectContext(environment.project)
val sourceFiles = environment.getSourceFiles()
@@ -131,43 +135,49 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
}
val resolverForProject = ResolverForProjectImpl(
- "Dokka",
- projectContext,
- listOf(library, module),
- { JvmAnalyzerFacade },
- {
- when (it) {
- library -> ModuleContent(emptyList(), GlobalSearchScope.notScope(sourcesScope))
- module -> ModuleContent(sourceFiles, sourcesScope)
- else -> throw IllegalArgumentException("Unexpected module info")
+ "Dokka",
+ projectContext,
+ listOf(library, module),
+ {
+ when (it) {
+ library -> ModuleContent(it, emptyList(), GlobalSearchScope.notScope(sourcesScope))
+ module -> ModuleContent(it, emptyList(), sourcesScope)
+ else -> throw IllegalArgumentException("Unexpected module info")
+ }
+ },
+ {
+ JvmPlatform.multiTargetPlatform
+ },
+ LanguageSettingsProvider.Default /* TODO: Fix this */,
+ { JvmAnalyzerFacade },
+ {
+ JvmPlatformParameters ({ content ->
+ JvmPackagePartProvider(configuration.languageVersionSettings, content.moduleContentScope).apply {
+ addRoots(javaRoots, messageCollector)
}
- },
- JvmPlatformParameters {
+ }, {
val file = (it as JavaClassImpl).psi.containingFile.virtualFile
if (file in sourcesScope)
module
else
library
- },
- CompilerEnvironment,
- packagePartProviderFactory = { info, content ->
- JvmPackagePartProvider(configuration.languageVersionSettings, content.moduleContentScope).apply {
- addRoots(javaRoots)
- }
- },
- builtIns = builtIns,
- modulePlatforms = { JvmPlatform.multiTargetPlatform }
+ })
+ },
+ CompilerEnvironment,
+ builtIns = builtIns
)
- resolverForProject.resolverForModule(library) // Required before module to initialize library properly
+ val resolverForLibrary = resolverForProject.resolverForModule(library) // Required before module to initialize library properly
val resolverForModule = resolverForProject.resolverForModule(module)
+ val libraryModuleDescriptor = resolverForProject.descriptorForModule(library)
val moduleDescriptor = resolverForProject.descriptorForModule(module)
builtIns.initialize(moduleDescriptor, true)
+ val libraryResolutionFacade = DokkaResolutionFacade(environment.project, libraryModuleDescriptor, resolverForLibrary)
val created = DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule)
val projectComponentManager = environment.project as MockComponentManager
projectComponentManager.registerService(KotlinCacheService::class.java, CoreKotlinCacheService(created))
- return created
+ return created to libraryResolutionFacade
}
fun loadLanguageVersionSettings(languageVersionString: String?, apiVersionString: String?) {
@@ -202,7 +212,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
* List of source roots for this environment.
*/
val sources: List<String>
- get() = configuration.get(JVMConfigurationKeys.CONTENT_ROOTS)
+ get() = configuration.get(CLIConfigurationKeys.CONTENT_ROOTS)
?.filterIsInstance<KotlinSourceRoot>()
?.map { it.path } ?: emptyList()
@@ -221,7 +231,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
}
fun addRoots(list: List<ContentRoot>) {
- configuration.addAll(JVMConfigurationKeys.CONTENT_ROOTS, list)
+ configuration.addAll(CLIConfigurationKeys.CONTENT_ROOTS, list)
}
/**
@@ -234,15 +244,19 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
fun contentRootFromPath(path: String): ContentRoot {
val file = File(path)
- return if (file.extension == "java") JavaSourceRoot(file, null) else KotlinSourceRoot(path)
+ return if (file.extension == "java") JavaSourceRoot(file, null) else KotlinSourceRoot(path, false)
}
class DokkaResolutionFacade(override val project: Project,
override val moduleDescriptor: ModuleDescriptor,
val resolverForModule: ResolverForModule) : ResolutionFacade {
+ override fun analyzeWithAllCompilerChecks(elements: Collection<KtElement>): AnalysisResult {
+ throw UnsupportedOperationException()
+ }
+
override fun <T : Any> tryGetFrontendService(element: PsiElement, serviceClass: Class<T>): T? {
- return null
+ return resolverForModule.componentProvider.tryGetService(serviceClass)
}
override fun resolveToDescriptor(declaration: KtDeclaration, bodyResolveMode: BodyResolveMode): DeclarationDescriptor {
@@ -295,10 +309,6 @@ class DokkaResolutionFacade(override val project: Project,
throw UnsupportedOperationException()
}
- override fun analyzeFullyAndGetResult(elements: Collection<KtElement>): AnalysisResult {
- throw UnsupportedOperationException()
- }
-
override fun <T : Any> getFrontendService(element: PsiElement, serviceClass: Class<T>): T {
throw UnsupportedOperationException()
}
diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt
index 4f6a7c76..319d85b1 100644
--- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt
+++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt
@@ -20,10 +20,10 @@ import com.intellij.openapi.vfs.VirtualFileFilter
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.util.messages.MessageBus
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
+import org.jetbrains.kotlin.cli.common.config.ContentRoot
+import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRoot
-import org.jetbrains.kotlin.config.ContentRoot
-import org.jetbrains.kotlin.config.KotlinSourceRoot
import org.picocontainer.PicoContainer
import java.io.File
diff --git a/core/src/main/kotlin/Analysis/JavaResolveExtension.kt b/core/s