aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-10-04 12:42:43 +0200
committerGitHub <noreply@github.com>2021-10-04 13:42:43 +0300
commit120e1fb21076afc814cc84b2b691b6946d28f7c0 (patch)
treed7250209bc88058a7315b7358db16c4884ebe612
parent8f97b049f23b8a6950fc41badc544ad1b636636a (diff)
downloaddokka-120e1fb21076afc814cc84b2b691b6946d28f7c0.tar.gz
dokka-120e1fb21076afc814cc84b2b691b6946d28f7c0.tar.bz2
dokka-120e1fb21076afc814cc84b2b691b6946d28f7c0.zip
Bump to Kotlin 1.5.31 (#2164)
* Bump to Kotlin 1.5.31 * Mark todo-s as unsupported * Add PsiNameHelper * Try disabling ProjectFileIndex * Remove CoreProjectFileIndex * Update JDKs to 17, kotlin to 1.5.31 in integration tests * Update Kotlin to 1.5.31 in JS IR integration test Co-authored-by: vmishenev <vad-mishenev@yandex.ru>
-rw-r--r--.github/workflows/gradle-test.pr.yml4
-rw-r--r--gradle.properties6
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt2
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt2
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt5
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt2
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt2
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt45
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreProjectFileIndex.kt559
9 files changed, 19 insertions, 608 deletions
diff --git a/.github/workflows/gradle-test.pr.yml b/.github/workflows/gradle-test.pr.yml
index 4bba5ce6..657e2494 100644
--- a/.github/workflows/gradle-test.pr.yml
+++ b/.github/workflows/gradle-test.pr.yml
@@ -6,7 +6,7 @@ jobs:
test-ubuntu:
strategy:
matrix:
- version: [ 8, 11, 15, 16 ]
+ version: [ 8, 11, 17 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -19,7 +19,7 @@ jobs:
test-windows:
strategy:
matrix:
- version: [ 11, 15, 16 ]
+ version: [ 11, 15, 17 ]
fail-fast: false
runs-on: windows-latest
steps:
diff --git a/gradle.properties b/gradle.properties
index f1a25a51..b68463cd 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,12 +3,12 @@ dokka_version_base=1.6.0
dokka_publication_channels=maven-central-snapshot&space-dokka-dev
dokka_integration_test_parallelism=2
# Versions
-kotlin_version=1.5.30
+kotlin_version=1.5.31
coroutines_version=1.5.1
kotlinx_html_version=0.7.3
-kotlin_plugin_version=202-1.5.30-release-412-IJ8194.7
+kotlin_plugin_version=211-1.5.31-release-551-IJ7442.40
jsoup_version=1.13.1
-idea_version=202.8194.7
+idea_version=211.7442.40
language_version=1.4
jackson_version=2.12.4
# Code style
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
index ea4d2edd..b8cf5097 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
@@ -21,7 +21,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst
androidGradlePluginVersions = listOf("4.0.0")
) + BuildVersions.permutations(
gradleVersions = listOf("7.0"),
- kotlinVersions = listOf("1.5.30", *ifExhaustive("1.4.0", "1.3.72")),
+ kotlinVersions = listOf("1.5.31", *ifExhaustive("1.4.0", "1.3.72")),
androidGradlePluginVersions = listOf("4.2.0")
)
}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
index 297a1618..e6fa87ff 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
@@ -12,7 +12,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac
@get:Parameters(name = "{0}")
val versions = BuildVersions.permutations(
gradleVersions = listOf("7.2", *ifExhaustive("7.0", "6.6", "6.3", "6.2.2", "6.1.1")),
- kotlinVersions = listOf("1.3.30", *ifExhaustive("1.3.72", "1.4.32"), "1.5.0", "1.5.30")
+ kotlinVersions = listOf("1.3.30", *ifExhaustive("1.3.72", "1.4.32"), "1.5.0", "1.5.31")
) + BuildVersions.permutations(
gradleVersions = listOf("5.6.4", "6.0"),
kotlinVersions = listOf("1.3.30", *ifExhaustive("1.3.72", "1.4.32"))
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt
index 81beccee..c0d9bc93 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt
@@ -12,13 +12,14 @@ class JsIRGradleIntegrationTest(override val versions: BuildVersions) : Abstract
@get:Parameters(name = "{0}")
val versions = BuildVersions.permutations(
gradleVersions = listOf("7.2", *ifExhaustive("7.0")),
- kotlinVersions = listOf("1.5.0", "1.5.30")
+ kotlinVersions = listOf("1.5.0", "1.5.30", "1.5.31")
)
}
val reactVersionArg = mapOf(
"1.5.0" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.202-kotlin-1.5.0",
- "1.5.30" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.246-kotlin-1.5.30"
+ "1.5.30" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.246-kotlin-1.5.30",
+ "1.5.31" to "-Pdokka_it_react_kotlin_version=5.2.0-pre.251-kotlin-1.5.31"
)
@BeforeTest
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
index cb4a2ec1..8c1d157b 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
@@ -11,7 +11,7 @@ class MultiModule0IntegrationTest(override val versions: BuildVersions) : Abstra
@get:Parameterized.Parameters(name = "{0}")
val versions = BuildVersions.permutations(
gradleVersions = listOf("7.2", "7.0", "6.6", "6.1.1"),
- kotlinVersions = listOf("1.5.30", "1.5.0", "1.4.0")
+ kotlinVersions = listOf("1.5.31", "1.5.0", "1.4.0")
)
}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt
index 6e594edd..bb83cf3d 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt
@@ -12,7 +12,7 @@ class Versioning0IntegrationTest(override val versions: BuildVersions) : Abstrac
@get:Parameterized.Parameters(name = "{0}")
val versions = BuildVersions.permutations(
gradleVersions = listOf("7.0", "7.2"),
- kotlinVersions = listOf("1.5.30", "1.5.0")
+ kotlinVersions = listOf("1.5.31", "1.5.0")
)
}
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
index c9aa3b07..e8db48a2 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
@@ -1,20 +1,16 @@
package org.jetbrains.dokka.analysis
import com.intellij.core.CoreApplicationEnvironment
-import com.intellij.core.CoreModuleManager
import com.intellij.mock.MockApplication
import com.intellij.mock.MockComponentManager
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.extensions.Extensions
-import com.intellij.openapi.module.Module
-import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.Project
-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.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
@@ -39,10 +35,7 @@ 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.addJavaSourceRoot
-import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoot
-import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
-import org.jetbrains.kotlin.cli.jvm.config.jvmClasspathRoots
+import org.jetbrains.kotlin.cli.jvm.config.*
import org.jetbrains.kotlin.cli.jvm.index.JavaRoot
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.context.ProjectContext
@@ -113,25 +106,6 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
val environment = KotlinCoreEnvironment.createForProduction(this, configuration, configFiles)
val projectComponentManager = environment.project as MockComponentManager
- val projectFileIndex = CoreProjectFileIndex(
- environment.project,
- environment.configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS)
- )
-
- val moduleManager = object : CoreModuleManager(environment.project, this) {
- override fun getModules(): Array<out Module> = arrayOf(projectFileIndex.module)
- }
-
- CoreApplicationEnvironment.registerComponentInstance(
- projectComponentManager.picoContainer,
- ModuleManager::class.java, moduleManager
- )
-
- CoreApplicationEnvironment.registerExtensionPoint(
- Extensions.getRootArea(),
- OrderEnumerationHandler.EP_NAME, OrderEnumerationHandler.Factory::class.java
- )
-
CoreApplicationEnvironment.registerExtensionPoint(
environment.project.extensionArea,
JavadocTagInfo.EP_NAME, JavadocTagInfo::class.java
@@ -150,18 +124,13 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
}
projectComponentManager.registerService(
- ProjectFileIndex::class.java,
- projectFileIndex
- )
-
- projectComponentManager.registerService(
- ProjectRootManager::class.java,
- CoreProjectRootManager(projectFileIndex)
+ JavadocManager::class.java,
+ JavadocManagerImpl(environment.project)
)
projectComponentManager.registerService(
- JavadocManager::class.java,
- JavadocManagerImpl(environment.project)
+ PsiNameHelper::class.java,
+ PsiNameHelperImpl(environment.project)
)
projectComponentManager.registerService(
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreProjectFileIndex.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreProjectFileIndex.kt
deleted file mode 100644
index 179f5e52..00000000
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreProjectFileIndex.kt
+++ /dev/null
@@ -1,559 +0,0 @@
-package org.jetbrains.dokka.analysis
-
-import com.intellij.openapi.Disposable
-import com.intellij.openapi.extensions.ExtensionPointName
-import com.intellij.openapi.module.Module
-import com.intellij.openapi.project.Project
-import com.intellij.openapi.projectRoots.Sdk
-import com.intellij.openapi.projectRoots.SdkAdditionalData
-import com.intellij.openapi.projectRoots.SdkModificator
-import com.intellij.openapi.projectRoots.SdkTypeId
-import com.intellij.openapi.roots.*
-import com.intellij.openapi.roots.impl.ProjectRootManagerImpl
-import com.intellij.openapi.util.Condition
-import com.intellij.openapi.util.Key
-import com.intellij.openapi.util.UserDataHolderBase
-import com.intellij.openapi.vfs.StandardFileSystems
-import com.intellij.openapi.vfs.VfsUtilCore.getVirtualFileForJar
-import com.intellij.openapi.vfs.VirtualFile
-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.picocontainer.PicoContainer
-import java.io.File
-
-/**
- * Workaround for the lack of ability to create a ProjectFileIndex implementation using only
- * classes from projectModel-{api,impl}.
- */
-class CoreProjectFileIndex(private val project: Project, contentRoots: List<ContentRoot>) : ProjectFileIndex,
- ModuleFileIndex {
- override fun iterateContent(p0: ContentIterator, p1: VirtualFileFilter?): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun iterateContentUnderDirectory(p0: VirtualFile, p1: ContentIterator, p2: VirtualFileFilter?): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isInLibrary(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- val sourceRoots = contentRoots.filter { it !is JvmClasspathRoot }
- val classpathRoots = contentRoots.filterIsInstance<JvmClasspathRoot>()
-
- val module: Module = object : UserDataHolderBase(), Module {
- override fun isDisposed(): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getName(): String = "<Dokka module>"
- override fun isLoaded(): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun setOption(p0: String, p1: String?) {
- throw UnsupportedOperationException()
- }
-
- override fun getOptionValue(p0: String): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleWithLibrariesScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleWithDependentsScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleWithDependenciesScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleContentScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleContentWithDependenciesScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleWithDependenciesAndLibrariesScope(p0: Boolean): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleTestsWithDependentsScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleScope(): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleScope(p0: Boolean): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleRuntimeScope(p0: Boolean): GlobalSearchScope {
- throw UnsupportedOperationException()
- }
-
- override fun <T : Any?> getExtensions(p0: ExtensionPointName<T>): Array<out T> {
- throw UnsupportedOperationException()
- }
-
- override fun <T : Any?> getComponent(interfaceClass: Class<T>): T? {
- if (interfaceClass == ModuleRootManager::class.java) {
- return moduleRootManager as T
- }
- throw UnsupportedOperationException()
- }
-
- override fun getDisposed(): Condition<*> {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleFile(): VirtualFile? {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleFilePath(): String {
- throw UnsupportedOperationException()
- }
-
- override fun getProject(): Project {
- throw UnsupportedOperationException()
- }
-
- override fun getPicoContainer(): PicoContainer {
- throw UnsupportedOperationException()
- }
-
- override fun getMessageBus(): MessageBus {
- throw UnsupportedOperationException()
- }
-
- override fun dispose() {
- throw UnsupportedOperationException()
- }
- }
-
- private val sdk: Sdk = object : Sdk, RootProvider {
- override fun getFiles(rootType: OrderRootType): Array<out VirtualFile> = classpathRoots
- .mapNotNull { StandardFileSystems.local().findFileByPath(it.file.path) }
- .toTypedArray()
-
- override fun addRootSetChangedListener(p0: RootProvider.RootSetChangedListener) {
- throw UnsupportedOperationException()
- }
-
- override fun addRootSetChangedListener(p0: RootProvider.RootSetChangedListener, p1: Disposable) {
- throw UnsupportedOperationException()
- }
-
- override fun getUrls(p0: OrderRootType): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun removeRootSetChangedListener(p0: RootProvider.RootSetChangedListener) {
- throw UnsupportedOperationException()
- }
-
- override fun getSdkModificator(): SdkModificator {
- throw UnsupportedOperationException()
- }
-
- override fun getName(): String = "<dokka SDK>"
-
- override fun getRootProvider(): RootProvider = this
-
- override fun getHomePath(): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getVersionString(): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getSdkAdditionalData(): SdkAdditionalData? {
- throw UnsupportedOperationException()
- }
-
- override fun clone(): Any {
- throw UnsupportedOperationException()
- }
-
- override fun getSdkType(): SdkTypeId {
- throw UnsupportedOperationException()
- }
-
- override fun getHomeDirectory(): VirtualFile? {
- throw UnsupportedOperationException()
- }
-
- override fun <T : Any?> getUserData(p0: Key<T>): T? {
- throw UnsupportedOperationException()
- }
-
- override fun <T : Any?> putUserData(p0: Key<T>, p1: T?) {
- throw UnsupportedOperationException()
- }
- }
-
- private val moduleSourceOrderEntry = object : ModuleSourceOrderEntry {
- override fun getFiles(p0: OrderRootType): Array<VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getUrls(p0: OrderRootType): Array<String> {
- throw UnsupportedOperationException()
- }
-
- override fun <R : Any?> accept(p0: RootPolicy<R>, p1: R?): R {
- throw UnsupportedOperationException()
- }
-
-
- override fun getPresentableName(): String {
- throw UnsupportedOperationException()
- }
-
- override fun getOwnerModule(): Module = module
-
-
- override fun isValid(): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun compareTo(other: OrderEntry?): Int {
- throw UnsupportedOperationException()
- }
-
- override fun getRootModel(): ModuleRootModel = moduleRootManager
-
- override fun isSynthetic(): Boolean {
- throw UnsupportedOperationException()
- }
- }
-
- private val sdkOrderEntry = object : JdkOrderEntry {
- override fun getFiles(p0: OrderRootType): Array<VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getUrls(p0: OrderRootType): Array<String> {
- throw UnsupportedOperationException()
- }
-
- override fun <R : Any?> accept(p0: RootPolicy<R>, p1: R?): R {
- throw UnsupportedOperationException()
- }
-
- override fun getJdkName(): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getJdk(): Sdk = sdk
-
- override fun getPresentableName(): String {
- throw UnsupportedOperationException()
- }
-
- override fun getOwnerModule(): Module {
- throw UnsupportedOperationException()
- }
-
- override fun isValid(): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getRootFiles(p0: OrderRootType): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getRootUrls(p0: OrderRootType): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun compareTo(other: OrderEntry?): Int {
- throw UnsupportedOperationException()
- }
-
- override fun isSynthetic(): Boolean {
- throw UnsupportedOperationException()
- }
-
- }
-
- inner class MyModuleRootManager : ModuleRootManager() {
- override fun getExternalSource(): ProjectModelExternalSource? {
- throw UnsupportedOperationException()
- }
-
- override fun getExcludeRoots(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getContentEntries(): Array<out ContentEntry> {
- throw UnsupportedOperationException()
- }
-
- override fun getExcludeRootUrls(): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun <R : Any?> processOrder(p0: RootPolicy<R>, p1: R): R {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRoots(p0: Boolean): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRoots(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRoots(p0: JpsModuleSourceRootType<*>): MutableList<VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRoots(p0: MutableSet<out JpsModuleSourceRootType<*>>): MutableList<VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRoots(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun orderEntries(): OrderEnumerator =
- ProjectRootManagerImpl(project).orderEntries().using(object : RootModelProvider {
- override fun getModules(): Array<out Module> = arrayOf(module)
-
- override fun getRootModel(p0: Module): ModuleRootModel = this@MyModuleRootManager
- })
-
- override fun <T : Any?> getModuleExtension(p0: Class<T>): T {
- throw UnsupportedOperationException()
- }
-
- override fun getDependencyModuleNames(): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun getModule(): Module = this@CoreProjectFileIndex.module
-
- override fun isSdkInherited(): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getOrderEntries(): Array<out OrderEntry> = arrayOf(moduleSourceOrderEntry, sdkOrderEntry)
-
- override fun getSourceRootUrls(): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRootUrls(p0: Boolean): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun getSdk(): Sdk? {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRootUrls(): Array<out String> {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleDependencies(): Array<out Module> {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleDependencies(p0: Boolean): Array<out Module> {
- throw UnsupportedOperationException()
- }
-
- override fun getModifiableModel(): ModifiableRootModel {
- throw UnsupportedOperationException()
- }
-
- override fun isDependsOn(p0: Module): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getFileIndex(): ModuleFileIndex {
- return this@CoreProjectFileIndex
- }
-
- override fun getDependencies(): Array<out Module> {
- throw UnsupportedOperationException()
- }
-
- override fun getDependencies(p0: Boolean): Array<out Module> {
- throw UnsupportedOperationException()
- }
- }
-
- val moduleRootManager = MyModuleRootManager()
-
- override fun getContentRootForFile(p0: VirtualFile): VirtualFile? {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRootForFile(p0: VirtualFile, p1: Boolean): VirtualFile? {
- throw UnsupportedOperationException()
- }
-
- override fun getPackageNameByDirectory(p0: VirtualFile): String? {
- throw UnsupportedOperationException()
- }
-
- override fun isInLibrarySource(file: VirtualFile): Boolean = false
-
- override fun getClassRootForFile(file: VirtualFile): VirtualFile? =
- classpathRoots.firstOrNull { it.contains(file) }
- ?.let { StandardFileSystems.local().findFileByPath(it.file.path) }
-
- override fun getOrderEntriesForFile(file: VirtualFile): List<OrderEntry> =
- if (classpathRoots.contains(file)) listOf(sdkOrderEntry) else emptyList()
-
- override fun isInLibraryClasses(file: VirtualFile): Boolean = classpathRoots.contains(file)
-
- override fun isExcluded(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getSourceRootForFile(p0: VirtualFile): VirtualFile? {
- throw UnsupportedOperationException()
- }
-
- override fun isUnderIgnored(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isLibraryClassFile(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleForFile(file: VirtualFile): Module? =
- if (sourceRoots.contains(file)) module else null
-
- private fun List<ContentRoot>.contains(file: VirtualFile): Boolean = any { it.contains(file) }
-
- override fun getModuleForFile(p0: VirtualFile, p1: Boolean): Module? {
- throw UnsupportedOperationException()
- }
-
- override fun isInSource(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isIgnored(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isContentSourceFile(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isInSourceContent(file: VirtualFile): Boolean = sourceRoots.contains(file)
-
- override fun iterateContent(p0: ContentIterator): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isInContent(p0: VirtualFile): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun iterateContentUnderDirectory(p0: VirtualFile, p1: ContentIterator): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun isInTestSourceContent(file: VirtualFile): Boolean = false
-
- override fun isUnderSourceRootOfType(p0: VirtualFile, p1: MutableSet<out JpsModuleSourceRootType<*>>): Boolean {
- throw UnsupportedOperationException()
- }
-
- override fun getOrderEntryForFile(p0: VirtualFile): OrderEntry? {
- throw UnsupportedOperationException()
- }
-}
-
-class CoreProjectRootManager(val projectFileIndex: CoreProjectFileIndex) : ProjectRootManager() {
- override fun orderEntries(): OrderEnumerator {
- throw UnsupportedOperationException()
- }
-
- override fun orderEntries(p0: MutableCollection<out Module>): OrderEnumerator {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRootsFromAllModules(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun setProjectSdk(p0: Sdk?) {
- throw UnsupportedOperationException()
- }
-
- override fun setProjectSdkName(p0: String) {
- throw UnsupportedOperationException()
- }
-
- override fun setProjectSdkName(p0: String, p1: String) {
- throw UnsupportedOperationException()
- }
-
- override fun getModuleSourceRoots(p0: MutableSet<out JpsModuleSourceRootType<*>>): MutableList<VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getContentSourceRoots(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getFileIndex(): ProjectFileIndex = projectFileIndex
-
- override fun getProjectSdkName(): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getProjectSdkTypeName(): String? {
- throw UnsupportedOperationException()
- }
-
- override fun getProjectSdk(): Sdk? {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRoots(): Array<out VirtualFile> {
- throw UnsupportedOperationException()
- }
-
- override fun getContentRootUrls(): MutableList<String> {
- throw UnsupportedOperationException()
- }
-
-}
-
-fun ContentRoot.contains(file: VirtualFile) = when (this) {
- is JvmContentRoot -> {
- val path = if (file.fileSystem.protocol == StandardFileSystems.JAR_PROTOCOL)
- getVirtualFileForJar(file)?.path ?: file.path
- else
- file.path
- File(path).startsWith(this.file.absoluteFile)
- }
- is KotlinSourceRoot -> File(file.path).startsWith(File(this.path).absoluteFile)
- else -> false
-}