-
Notifications
You must be signed in to change notification settings - Fork 461
Update AA to 2.3.20-dev-1838 #4259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a97c862
Update AA to 2.3.0-dev-7984
vmishenev bee3aea
Update AA to 2.3.20-dev-1838
vmishenev 94c1952
Update intellij-platform to 251.27812.49 and kotlin-compiler for K1
vmishenev a36344a
Update intellij-platform to 251.27812.49 and kotlin-compiler in Dokka K1
vmishenev 6d7d0f6
Fix unit tests
vmishenev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,6 @@ import com.intellij.openapi.extensions.Extensions | |
| import com.intellij.openapi.project.Project | ||
| import com.intellij.openapi.util.Disposer | ||
| import com.intellij.openapi.vfs.StandardFileSystems | ||
| import com.intellij.psi.PsiNameHelper | ||
| import com.intellij.psi.impl.PsiNameHelperImpl | ||
| import com.intellij.psi.impl.source.javadoc.JavadocManagerImpl | ||
| import com.intellij.psi.javadoc.CustomJavadocTagProvider | ||
| import com.intellij.psi.javadoc.JavadocManager | ||
|
|
@@ -27,6 +25,7 @@ import org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.AnalysisContextC | |
| import org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.KLibService | ||
| import org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.MockApplicationHack | ||
| import org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.configuration.resolve.* | ||
| import org.jetbrains.kotlin.K1Deprecation | ||
| import org.jetbrains.kotlin.analyzer.* | ||
| import org.jetbrains.kotlin.analyzer.common.CommonAnalysisParameters | ||
| import org.jetbrains.kotlin.analyzer.common.CommonDependenciesContainer | ||
|
|
@@ -112,6 +111,7 @@ public class AnalysisEnvironment( | |
| Platform.js, Platform.wasm -> EnvironmentConfigFiles.JS_CONFIG_FILES | ||
| } | ||
|
|
||
| @OptIn(K1Deprecation::class) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| val environment = KotlinCoreEnvironment.createForProduction(this, configuration, configFiles) | ||
| val projectComponentManager = environment.project as MockComponentManager | ||
|
|
||
|
|
@@ -139,11 +139,6 @@ public class AnalysisEnvironment( | |
| JavadocManagerImpl(environment.project) | ||
| ) | ||
|
|
||
| projectComponentManager.registerService( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already added somewhere |
||
| PsiNameHelper::class.java, | ||
| PsiNameHelperImpl(environment.project) | ||
| ) | ||
|
|
||
| projectComponentManager.registerService( | ||
| CustomJavadocTagProvider::class.java, | ||
| CustomJavadocTagProvider { emptyList() } | ||
|
|
@@ -302,7 +297,9 @@ public class AnalysisEnvironment( | |
|
|
||
| @OptIn(ExperimentalStdlibApi::class) | ||
| private fun resolveKotlinLibraries(): Map<AbsolutePathString, KotlinLibrary> { | ||
| return if (analysisPlatform == Platform.jvm) emptyMap() else buildMap { | ||
| return if (analysisPlatform == Platform.jvm) emptyMap() else { | ||
| val result = mutableMapOf<AbsolutePathString, KotlinLibrary>() | ||
|
|
||
| classpath | ||
| .filter { it.isDirectory || it.extension == KLIB_FILE_EXTENSION } | ||
| .forEach { libraryFile -> | ||
|
|
@@ -313,7 +310,7 @@ public class AnalysisEnvironment( | |
| ) | ||
| if (kLibService.isAnalysisCompatible(kotlinLibrary)) { | ||
| // exists, is KLIB, has compatible format | ||
| put( | ||
| result.put( | ||
| libraryFile.absolutePath, | ||
| kotlinLibrary | ||
| ) | ||
|
|
@@ -323,6 +320,7 @@ public class AnalysisEnvironment( | |
| .report(CompilerMessageSeverity.WARNING, "Can not resolve KLIB. " + e.message) | ||
| } | ||
| } | ||
| result | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...otlin/org/jetbrains/dokka/analysis/kotlin/descriptors/ide/CachingIdeKlibMetadataLoader.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Copyright 2014-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package org.jetbrains.dokka.analysis.kotlin.descriptors.ide | ||
|
|
||
| import com.intellij.openapi.vfs.StandardFileSystems | ||
| import com.intellij.openapi.vfs.VirtualFile | ||
| import org.jetbrains.kotlin.analysis.decompiler.konan.KlibLoadingMetadataCache | ||
| import org.jetbrains.kotlin.library.KotlinLibrary | ||
| import org.jetbrains.kotlin.library.components.KlibMetadataComponentLayout | ||
| import org.jetbrains.kotlin.library.metadata.CustomMetadataProtoLoader | ||
| import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf | ||
| import org.jetbrains.kotlin.metadata.ProtoBuf | ||
| import org.jetbrains.kotlin.konan.file.File as KFile | ||
|
|
||
|
|
||
| internal object CachingIdeKlibMetadataLoader : CustomMetadataProtoLoader { | ||
| override fun loadModuleHeader(library: KotlinLibrary): KlibMetadataProtoBuf.Header { | ||
| val isZipped = library.isZipped | ||
| val moduleHeaderFile: KFile = library.metadataLayout(isZipped).moduleHeaderFile | ||
| val virtualFile: VirtualFile? = getVirtualFile(isZipped, library, moduleHeaderFile) | ||
| return virtualFile?.let { cache.getCachedModuleHeader(virtualFile) } ?: KlibMetadataProtoBuf.Header.getDefaultInstance() | ||
| } | ||
|
|
||
| override fun loadPackageFragment(library: KotlinLibrary, packageFqName: String, partName: String): ProtoBuf.PackageFragment { | ||
| val isZipped = library.isZipped | ||
| val packageFragmentFile: KFile = library.metadataLayout(isZipped).getPackageFragmentFile(packageFqName, partName) | ||
| val virtualFile: VirtualFile? = getVirtualFile(isZipped, library, packageFragmentFile) | ||
| return virtualFile?.let { cache.getCachedPackageFragment(virtualFile) } ?: ProtoBuf.PackageFragment.getDefaultInstance() | ||
| } | ||
|
|
||
| private fun getVirtualFile(isZipped: Boolean, library: KotlinLibrary, file: KFile): VirtualFile? = | ||
| if (isZipped) asJarFileSystemFile(library.libraryFile, file) else asLocalFile(file) | ||
|
|
||
| private fun asJarFileSystemFile(jarFile: KFile, localFile: KFile): VirtualFile? { | ||
| val fullPath = jarFile.absolutePath + "!" + toSystemIndependentName(localFile.path) | ||
| return StandardFileSystems.jar().findFileByPath(fullPath) | ||
| } | ||
|
|
||
| private fun asLocalFile(localFile: KFile): VirtualFile? { | ||
| val fullPath = localFile.absolutePath | ||
| return StandardFileSystems.local().findFileByPath(fullPath) | ||
| } | ||
|
|
||
| private val cache: KlibLoadingMetadataCache | ||
| get() = KlibLoadingMetadataCache.getInstance() | ||
|
|
||
| private val KotlinLibrary.isZipped: Boolean | ||
| get() = this.location.isFile | ||
|
|
||
| private fun KotlinLibrary.metadataLayout(isZipped: Boolean): KlibMetadataComponentLayout = | ||
| if (isZipped) ZIPPED_KLIB_METADATA_LAYOUT else KlibMetadataComponentLayout(this.location) | ||
|
|
||
| private val ZIPPED_KLIB_METADATA_LAYOUT = KlibMetadataComponentLayout(KFile("/")) | ||
| } | ||
|
|
||
| // copy-pasted from com.intellij.util.PathUtil | ||
| internal fun toSystemIndependentName(path: String): String { | ||
| return path.replace('\\', '/') | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.