diff options
-rw-r--r-- | core/build.gradle | 7 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 32 | ||||
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 7 | ||||
-rw-r--r-- | core/src/test/kotlin/TestAPI.kt | 3 | ||||
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | lib/kotlin-ide-common.jar | bin | 458483 -> 469425 bytes | |||
-rw-r--r-- | lib/markdown.jar | bin | 388387 -> 393003 bytes |
7 files changed, 32 insertions, 19 deletions
diff --git a/core/build.gradle b/core/build.gradle index 3b156b70..5d9d3fb7 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -11,15 +11,16 @@ apply plugin: 'kotlin' sourceCompatibility = 1.6 dependencies { - compile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: kotlin_version + compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_version compile group: 'com.google.inject', name: 'guice', version: '3.0' compile "org.jsoup:jsoup:1.8.3" compile files("../lib/intellij-core-analysis.jar") - compile files("../lib/kotlin-compiler.jar") - compile files("../lib/kotlin-script-runtime.jar") + + compile group: 'org.jetbrains.kotlin', name: 'kotlin-compiler', version: kotlin_version + compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: kotlin_version compile files("../lib/kotlin-ide-common.jar") compile files("../lib/markdown.jar") compile files("../lib/picocontainer.jar") diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index 1a6ccbd0..be4285c0 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -12,15 +12,20 @@ import com.intellij.openapi.roots.OrderEnumerationHandler import com.intellij.openapi.roots.ProjectFileIndex import com.intellij.openapi.roots.ProjectRootManager import com.intellij.openapi.util.Disposer +import com.intellij.openapi.vfs.StandardFileSystems +import com.intellij.openapi.vfs.VirtualFileManager 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.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM 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.context.ProjectContext @@ -35,10 +40,9 @@ import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.CompilerEnvironment -import org.jetbrains.kotlin.resolve.MultiTargetPlatform import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters -import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM +import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession import java.io.File @@ -109,7 +113,14 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { val builtIns = JvmBuiltIns(projectContext.storageManager) - val resolverForProject = AnalyzerFacade.setupResolverForProject( + + val javaRoots = run { + val jvfs = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JAR_PROTOCOL) + + classpath.map { JavaRoot(jvfs.findFileByPath("${it.absolutePath}${URLUtil.JAR_SEPARATOR}")!!, JavaRoot.RootType.BINARY) } + } + + val resolverForProject = ResolverForProjectImpl( "Dokka", projectContext, listOf(library, module), @@ -129,12 +140,13 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { library }, CompilerEnvironment, - packagePartProviderFactory = { - info, content -> - JvmPackagePartProvider(environment, content.moduleContentScope) + packagePartProviderFactory = { info, content -> + JvmPackagePartProvider(LanguageVersionSettingsImpl.DEFAULT, content.moduleContentScope).apply { + addRoots(javaRoots) + } }, - builtIns = { builtIns }, - modulePlatforms = { MultiTargetPlatform.Specific("JVM") } + builtIns = builtIns, + modulePlatforms = { JvmPlatform.multiTargetPlatform } ) resolverForProject.resolverForModule(library) // Required before module to initialize library properly @@ -209,6 +221,10 @@ fun contentRootFromPath(path: String): ContentRoot { class DokkaResolutionFacade(override val project: Project, override val moduleDescriptor: ModuleDescriptor, val resolverForModule: ResolverForModule) : ResolutionFacade { + override fun <T : Any> tryGetFrontendService(element: PsiElement, serviceClass: Class<T>): T? { + return null + } + override fun resolveToDescriptor(declaration: KtDeclaration, bodyResolveMode: BodyResolveMode): DeclarationDescriptor { return resolveSession.resolveToDescriptor(declaration) } diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 707831ae..fddf0814 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -755,11 +755,10 @@ class DocumentationBuilder return null } val node = DocumentationNode(annotationClass.name.asString(), Content.Empty, NodeKind.Annotation) - val arguments = allValueArguments.toList().sortedBy { it.first.index } - arguments.forEach { - val valueNode = it.second.toDocumentationNode() + allValueArguments.forEach { (name, value) -> + val valueNode = value.toDocumentationNode() if (valueNode != null) { - val paramNode = DocumentationNode(it.first.name.asString(), Content.Empty, NodeKind.Parameter) + val paramNode = DocumentationNode(name.asString(), Content.Empty, NodeKind.Parameter) paramNode.append(valueNode, RefKind.Detail) node.append(paramNode, RefKind.Detail) } diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index 7141b731..a1a98ec7 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -82,9 +82,6 @@ fun appendDocumentation(documentation: DocumentationModule, addClasspath(File(stringRoot)) } if (withKotlinRuntime) { - val kotlinPairRoot = PathManager.getResourceRoot(Pair::class.java, "/kotlin/Pair.class") - addClasspath(File(kotlinPairRoot)) - val kotlinStrictfpRoot = PathManager.getResourceRoot(Strictfp::class.java, "/kotlin/jvm/Strictfp.class") addClasspath(File(kotlinStrictfpRoot)) } diff --git a/gradle.properties b/gradle.properties index 68cfbc1e..44e510d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ dokka_version=0.9.16 dokka_publication_channel=dokka #Kotlin compiler and plugin -kotlin_version=1.1.3 +kotlin_version=1.1.51 kotlin_for_gradle_version=1.0.7 ant_version=1.9.6 diff --git a/lib/kotlin-ide-common.jar b/lib/kotlin-ide-common.jar Binary files differindex 943e221e..98648313 100644 --- a/lib/kotlin-ide-common.jar +++ b/lib/kotlin-ide-common.jar diff --git a/lib/markdown.jar b/lib/markdown.jar Binary files differindex d0b2639b..e61f954c 100644 --- a/lib/markdown.jar +++ b/lib/markdown.jar |