mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[kotlin] introduce kotlin.base.scripting.k1 module
#KTIJ-33202 GitOrigin-RevId: 7b1976b68b02be8aa8ccfe42641416c04b947b02
This commit is contained in:
committed by
intellij-monorepo-bot
parent
791282fbe7
commit
df322c2719
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -1244,6 +1244,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/psi/kotlin.base.psi.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/psi/kotlin.base.psi.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/resources/kotlin.base.resources.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/resources/kotlin.base.resources.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/scripting/kotlin.base.scripting.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/scripting/kotlin.base.scripting.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/scripting.k1/kotlin.base.scripting.k1.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/scripting.k1/kotlin.base.scripting.k1.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/scripting.k2/kotlin.base.scripting.k2.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/scripting.k2/kotlin.base.scripting.k2.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/statistics/kotlin.base.statistics.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/statistics/kotlin.base.statistics.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/base/test/kotlin.base.test.iml" filepath="$PROJECT_DIR$/plugins/kotlin/base/test/kotlin.base.test.iml" />
|
||||
|
||||
@@ -40,6 +40,7 @@ object KotlinPluginBuilder {
|
||||
"kotlin.base.project-structure",
|
||||
"kotlin.base.external-build-system",
|
||||
"kotlin.base.scripting",
|
||||
"kotlin.base.scripting.k1",
|
||||
"kotlin.base.scripting.k2",
|
||||
"kotlin.base.analysis-api-platform",
|
||||
"kotlin.base.analysis",
|
||||
|
||||
@@ -22,6 +22,7 @@ java_library(
|
||||
"//plugins/kotlin/base/analysis-api-platform",
|
||||
"//plugins/kotlin/base/project-structure",
|
||||
"//plugins/kotlin/base/scripting",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
"//plugins/kotlin/base/scripting.k2",
|
||||
"//plugins/kotlin/base/analysis-api/analysis-api-utils:kotlin-base-analysis-api-utils",
|
||||
"//plugins/kotlin/base/facet",
|
||||
@@ -232,6 +233,7 @@ java_library(
|
||||
"//plugins/kotlin/base/analysis-api-platform",
|
||||
"//plugins/kotlin/base/project-structure",
|
||||
"//plugins/kotlin/base/scripting",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
"//plugins/kotlin/base/scripting.k2",
|
||||
"//plugins/kotlin/base/analysis-api/analysis-api-utils:kotlin-base-analysis-api-utils",
|
||||
"//plugins/kotlin/base/facet",
|
||||
|
||||
@@ -49,6 +49,7 @@ jvm_library(
|
||||
"@lib//:kotlinc-analysis-api-impl-base",
|
||||
"//plugins/kotlin/base/plugin",
|
||||
"@lib//:kotlinc-analysis-api-platform-interface",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.base.fe10.analysis` end
|
||||
@@ -55,5 +55,6 @@
|
||||
<orderEntry type="library" name="kotlinc.analysis-api-impl-base" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.base.plugin" />
|
||||
<orderEntry type="library" name="kotlinc.analysis-api-platform-interface" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -38,9 +38,6 @@ import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.LibrarySourceI
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.NotUnderContentRootModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.psi.KotlinPsiHeuristics
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.getDependentModules
|
||||
import org.jetbrains.kotlin.idea.caches.project.isLibraryClasses
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.util.GlobalFacadeModuleFilters
|
||||
@@ -48,6 +45,9 @@ import org.jetbrains.kotlin.idea.caches.resolve.util.contextWithCompositeExcepti
|
||||
import org.jetbrains.kotlin.idea.caches.trackers.outOfBlockModificationCount
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesModificationTracker
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesSourceInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
@@ -27,9 +27,9 @@ import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.IdeaModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.NotUnderContentRootModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.checkValidity
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.getModuleInfosFromIdeaModel
|
||||
import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.js.resolve.diagnostics.ErrorsJs
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
@@ -6,11 +6,11 @@ package org.jetbrains.kotlin.idea.core.util
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.KotlinResolveScopeEnlarger
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.SourceForBinaryModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.scope.KotlinSourceFilterScope
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ import org.jetbrains.kotlin.fileClasses.fileClassInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.*
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.BinaryModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.LibraryInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.binariesScope
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.decompiler.navigation.MemberMatching.receiverAndParametersShortTypesMatch
|
||||
import org.jetbrains.kotlin.idea.decompiler.navigation.MemberMatching.sameReceiverPresenceAndParametersCount
|
||||
import org.jetbrains.kotlin.idea.stubindex.*
|
||||
|
||||
@@ -19,9 +19,9 @@ import org.jetbrains.kotlin.idea.base.projectStructure.toKaSourceModuleForProduc
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.toKaSourceModuleForTest
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getLanguageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getPlatform
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.scriptModuleEntity
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider
|
||||
import org.jetbrains.kotlin.idea.core.script.k2.modules.K2IdeScriptAdditionalIdeaDependenciesProvider
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
|
||||
64
plugins/kotlin/base/scripting.k1/BUILD.bazel
Normal file
64
plugins/kotlin/base/scripting.k1/BUILD.bazel
Normal file
@@ -0,0 +1,64 @@
|
||||
### auto-generated section `build kotlin.base.scripting.k1` start
|
||||
load("@rules_jvm//:jvm.bzl", "jvm_library", "jvm_resources")
|
||||
|
||||
jvm_resources(
|
||||
name = "scripting.k1_resources",
|
||||
files = glob(["resources/**/*"]),
|
||||
strip_prefix = "resources"
|
||||
)
|
||||
|
||||
jvm_library(
|
||||
name = "scripting.k1",
|
||||
module_name = "kotlin.base.scripting.k1",
|
||||
visibility = ["//visibility:public"],
|
||||
srcs = glob(["src/**/*.kt", "src/**/*.java"], allow_empty = True),
|
||||
deps = [
|
||||
"//plugins/kotlin/base/scripting",
|
||||
"@lib//:kotlin-stdlib",
|
||||
"@lib//:kotlinc-kotlin-compiler-common",
|
||||
"@lib//:kotlinc-kotlin-jps-common",
|
||||
"@lib//:kotlinc-analysis-api",
|
||||
"@lib//:kotlinc-analysis-api-platform-interface",
|
||||
"@lib//:kotlinc-kotlin-script-runtime",
|
||||
"@lib//:kotlinc-kotlin-scripting-common",
|
||||
"@lib//:kotlinc-kotlin-scripting-jvm",
|
||||
"@lib//:kotlinc-kotlin-scripting-compiler-impl",
|
||||
"@lib//:kotlinx-coroutines-core",
|
||||
"//platform/indexing-api:indexing",
|
||||
"//jps/model-api:model",
|
||||
"//platform/workspace/storage",
|
||||
"//plugins/kotlin/base/compiler-configuration",
|
||||
"//platform/util/progress",
|
||||
"//plugins/kotlin/base/util",
|
||||
"//plugins/kotlin/base/psi",
|
||||
"//platform/platform-impl:ide-impl",
|
||||
"//plugins/kotlin/base/plugin",
|
||||
"//plugins/kotlin/base/resources:kotlin-base-resources",
|
||||
"//plugins/kotlin/base/platforms",
|
||||
"//plugins/kotlin/base/facet",
|
||||
"//plugins/kotlin/base/project-structure",
|
||||
"//platform/core-ui",
|
||||
"//platform/util/jdom",
|
||||
"//platform/util-class-loader:util-classLoader",
|
||||
"//platform/projectModel-impl",
|
||||
"//platform/analysis-api:analysis",
|
||||
"//platform/editor-ui-api:editor-ui",
|
||||
"//platform/lang-impl",
|
||||
"//platform/diff-impl",
|
||||
"//platform/ide-core",
|
||||
"//platform/ide-core-impl",
|
||||
"//java/openapi:java",
|
||||
"//java/java-indexing-impl:indexing-impl",
|
||||
"//platform/collaboration-tools",
|
||||
"//java/java-impl:impl",
|
||||
"//platform/backend/workspace",
|
||||
"//plugins/kotlin/code-insight/utils",
|
||||
"//platform/workspace/jps",
|
||||
"//platform/external-system-impl:externalSystem-impl",
|
||||
"//java/idea-ui:ui",
|
||||
"@lib//:kotlinc-kotlin-scripting-dependencies",
|
||||
"//plugins/kotlin/scripting",
|
||||
],
|
||||
runtime_deps = [":scripting.k1_resources"]
|
||||
)
|
||||
### auto-generated section `build kotlin.base.scripting.k1` end
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-compiler-common" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-jps-common" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.analysis-api" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.analysis-api-platform-interface" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-script-runtime" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-scripting-common" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-scripting-jvm" level="project" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-scripting-compiler-impl" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit5" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.indexing" />
|
||||
<orderEntry type="module" module-name="intellij.platform.jps.model" />
|
||||
<orderEntry type="module" module-name="intellij.platform.workspace.storage" />
|
||||
<orderEntry type="module" module-name="kotlin.base.compiler-configuration" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.progress" />
|
||||
<orderEntry type="module" module-name="kotlin.base.util" />
|
||||
<orderEntry type="module" module-name="kotlin.base.psi" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="kotlin.base.plugin" />
|
||||
<orderEntry type="module" module-name="kotlin.base.resources" />
|
||||
<orderEntry type="module" module-name="kotlin.base.platforms" />
|
||||
<orderEntry type="module" module-name="kotlin.base.facet" />
|
||||
<orderEntry type="module" module-name="kotlin.base.project-structure" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.jdom" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.classLoader" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.diff.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java" />
|
||||
<orderEntry type="module" module-name="intellij.java.indexing.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.collaborationTools" />
|
||||
<orderEntry type="module" module-name="intellij.java.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.backend.workspace" />
|
||||
<orderEntry type="module" module-name="kotlin.code-insight.utils" />
|
||||
<orderEntry type="module" module-name="intellij.platform.workspace.jps" />
|
||||
<orderEntry type="module" module-name="intellij.platform.externalSystem.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.ui" />
|
||||
<orderEntry type="library" name="kotlinc.kotlin-scripting-dependencies" level="project" />
|
||||
<orderEntry type="module" module-name="kotlin.scripting" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,11 @@
|
||||
<idea-plugin package="org.jetbrains.kotlin.idea.core.script.k1">
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.k1.dependencies.KotlinScriptResolveScopeProvider"/>
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.k1.dependencies.ScriptDependenciesResolveScopeProvider"/>
|
||||
</extensions>
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<ktModuleFactory implementation="org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptingKaModuleFactory"/>
|
||||
<idea.base.projectStructure.moduleInfoProviderExtension
|
||||
implementation="org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptingModuleInfoProviderExtension"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.script.dependencies
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.dependencies
|
||||
|
||||
import com.intellij.codeInsight.multiverse.CodeInsightContext
|
||||
import com.intellij.codeInsight.multiverse.defaultContext
|
||||
@@ -8,29 +8,27 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.ResolveScopeProvider
|
||||
import com.intellij.psi.search.DelegatingGlobalSearchScope
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfoOrNull
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.base.util.isUnderKotlinSourceRootTypes
|
||||
import org.jetbrains.kotlin.idea.base.util.module
|
||||
import org.jetbrains.kotlin.idea.compilerAllowsAnyScriptsInSourceRoots
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.scriptingDebugLog
|
||||
import org.jetbrains.kotlin.idea.hasNoExceptionsToBeUnderSourceRoot
|
||||
import org.jetbrains.kotlin.idea.isEnabled
|
||||
import org.jetbrains.kotlin.idea.util.isKotlinFileType
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptConfigurationsProvider
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.findScriptDefinition
|
||||
import kotlin.script.experimental.api.ScriptCompilationConfiguration
|
||||
import kotlin.script.experimental.api.isStandalone
|
||||
|
||||
class KotlinScriptSearchScope(project: Project, baseScope: GlobalSearchScope) : DelegatingGlobalSearchScope(project, baseScope)
|
||||
|
||||
class KotlinScriptResolveScopeProvider : ResolveScopeProvider() {
|
||||
|
||||
override fun getResolveScope(file: VirtualFile, project: Project): GlobalSearchScope? =
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.script.dependencies
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.dependencies
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -8,9 +8,10 @@ import com.intellij.psi.ResolveScopeProvider
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.RootKindFilter
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.RootKindMatcher
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
|
||||
/**
|
||||
* @see KotlinScriptResolveScopeProvider
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.modules
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
@@ -14,9 +14,9 @@ import org.jetbrains.kotlin.idea.base.projectStructure.scope.KotlinSourceFilterS
|
||||
import org.jetbrains.kotlin.idea.base.scripting.KotlinBaseScriptingBundle
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getLanguageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getTargetPlatformVersion
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.modules
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.modules
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -24,9 +24,10 @@ import org.jetbrains.kotlin.idea.base.projectStructure.sourceModuleInfos
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getLanguageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getPlatform
|
||||
import org.jetbrains.kotlin.idea.base.scripting.getTargetPlatformVersion
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.scriptModuleEntity
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
@@ -59,7 +60,7 @@ data class ScriptModuleInfo(
|
||||
val snapshot = WorkspaceModel.getInstance(project).currentSnapshot
|
||||
|
||||
scriptFile.workspaceEntities(project, snapshot).filterIsInstance<ModuleEntity>().firstOrNull()
|
||||
?.let<ModuleEntity, GlobalSearchScope?> {
|
||||
?.let {
|
||||
it.findModule(snapshot)?.let<ModuleBridge, GlobalSearchScope> { module ->
|
||||
val scope = KotlinResolveScopeEnlarger.enlargeScope(
|
||||
module.getModuleWithDependenciesAndLibrariesScope(false),
|
||||
@@ -141,13 +142,6 @@ fun VirtualFile.workspaceEntities(project: Project, snapshot: EntityStorage): Se
|
||||
return snapshot.getVirtualFileUrlIndex().findEntitiesByUrl(virtualFileUrl)
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun VirtualFile.scriptModuleEntity(project: Project, snapshot: EntityStorage): ModuleEntity? {
|
||||
val virtualFileUrlManager = WorkspaceModel.getInstance(project).getVirtualFileUrlManager()
|
||||
val virtualFileUrl = toVirtualFileUrl(virtualFileUrlManager)
|
||||
return snapshot.getVirtualFileUrlIndex().findEntitiesByUrl(virtualFileUrl).firstNotNullOfOrNull { it as? ModuleEntity }
|
||||
}
|
||||
|
||||
@K1ModeProjectStructureApi
|
||||
internal fun VirtualFile.scriptLibraryDependencies(project: Project): Sequence<LibraryInfo> {
|
||||
val storage = WorkspaceModel.getInstance(project).currentSnapshot
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:OptIn(K1ModeProjectStructureApi::class)
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:OptIn(K1ModeProjectStructureApi::class, KaPlatformInterface::class)
|
||||
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.modules
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
|
||||
import org.jetbrains.kotlin.analysis.api.platform.projectStructure.KaContentScopeProvider
|
||||
import org.jetbrains.kotlin.analysis.api.KaPlatformInterface
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.*
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySource
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import java.nio.file.Path
|
||||
|
||||
internal class ScriptingKaModuleFactory : KaModuleFactory {
|
||||
@@ -29,10 +28,10 @@ internal class ScriptingKaModuleFactory : KaModuleFactory {
|
||||
is ScriptModuleInfo -> KtScriptModuleByModuleInfo(moduleInfo)
|
||||
is ScriptDependenciesInfo -> KtScriptDependencyModuleByModuleInfo(moduleInfo)
|
||||
is ScriptDependenciesSourceInfo -> KtScriptDependencySourceModuleByModuleInfo(moduleInfo)
|
||||
is JvmLibraryInfo -> moduleInfo.source?.safeAs<KotlinScriptEntitySource>()?.let {
|
||||
is JvmLibraryInfo -> (moduleInfo.source as? KotlinScriptEntitySource)?.let {
|
||||
KtScriptLibraryModuleByModuleInfo(moduleInfo)
|
||||
}
|
||||
is LibrarySourceInfo -> moduleInfo.source?.safeAs<KotlinScriptEntitySource>()?.let {
|
||||
is LibrarySourceInfo -> (moduleInfo.source as? KotlinScriptEntitySource)?.let {
|
||||
KtScriptLibrarySourceModuleByModuleInfo(moduleInfo)
|
||||
}
|
||||
else -> null
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.k1.modules
|
||||
|
||||
import com.intellij.ide.scratch.ScratchFileService
|
||||
import com.intellij.ide.scratch.ScratchRootType
|
||||
@@ -15,9 +15,6 @@ import org.jetbrains.kotlin.idea.base.projectStructure.ModuleInfoProviderExtensi
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.isKotlinBinary
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.IdeaModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.register
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptRelatedModuleNameFile
|
||||
@@ -29,9 +26,9 @@ import org.jetbrains.kotlin.utils.yieldIfNotNull
|
||||
@OptIn(K1ModeProjectStructureApi::class)
|
||||
internal class ScriptingModuleInfoProviderExtension : ModuleInfoProviderExtension {
|
||||
override suspend fun SequenceScope<Result<IdeaModuleInfo>>.collectByElement(
|
||||
element: PsiElement,
|
||||
file: PsiFile,
|
||||
virtualFile: VirtualFile
|
||||
element: PsiElement,
|
||||
file: PsiFile,
|
||||
virtualFile: VirtualFile
|
||||
) {
|
||||
val ktFile = file as? KtFile ?: return
|
||||
val isScript = runReadAction { ktFile.isValid && ktFile.isScript() }
|
||||
@@ -45,10 +42,10 @@ internal class ScriptingModuleInfoProviderExtension : ModuleInfoProviderExtensio
|
||||
}
|
||||
|
||||
override suspend fun SequenceScope<Result<IdeaModuleInfo>>.collectByFile(
|
||||
project: Project,
|
||||
virtualFile: VirtualFile,
|
||||
isLibrarySource: Boolean,
|
||||
config: ModuleInfoProvider.Configuration,
|
||||
project: Project,
|
||||
virtualFile: VirtualFile,
|
||||
isLibrarySource: Boolean,
|
||||
config: ModuleInfoProvider.Configuration,
|
||||
) {
|
||||
val isBinary = virtualFile.fileType.isKotlinBinary
|
||||
|
||||
@@ -89,7 +86,7 @@ internal class ScriptingModuleInfoProviderExtension : ModuleInfoProviderExtensio
|
||||
|
||||
override suspend fun SequenceScope<Module>.findContainingModules(project: Project, virtualFile: VirtualFile) {
|
||||
if (ScratchFileService.getInstance().getRootType(virtualFile) is ScratchRootType) {
|
||||
ScriptRelatedModuleNameFile[project, virtualFile]?.let { scratchModuleName ->
|
||||
ScriptRelatedModuleNameFile.Companion[project, virtualFile]?.let { scratchModuleName ->
|
||||
val moduleManager = ModuleManager.getInstance(project)
|
||||
yieldIfNotNull(moduleManager.findModuleByName(scratchModuleName))
|
||||
}
|
||||
@@ -18,6 +18,9 @@
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.k2.dependencies.KotlinScriptResolveScopeProvider"/>
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.k2.dependencies.ScriptDependenciesResolveScopeProvider"/>
|
||||
|
||||
<statusBarWidgetFactory id="kotlin.script.definition"
|
||||
implementation="org.jetbrains.kotlin.idea.core.script.k2.definitions.KotlinScriptDefinitionStatusBarWidgetFactory"
|
||||
order="first"/>
|
||||
@@ -61,6 +64,7 @@
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<ktModuleFactory implementation="org.jetbrains.kotlin.idea.core.script.k2.modules.ScriptingKaModuleFactory"/>
|
||||
<scriptDefinitionsSource
|
||||
id="StandardScriptDefinitionContributor"
|
||||
order="last"
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.script.k2.dependencies
|
||||
|
||||
import com.intellij.codeInsight.multiverse.CodeInsightContext
|
||||
import com.intellij.codeInsight.multiverse.defaultContext
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.ResolveScopeProvider
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.util.isUnderKotlinSourceRootTypes
|
||||
import org.jetbrains.kotlin.idea.base.util.module
|
||||
import org.jetbrains.kotlin.idea.compilerAllowsAnyScriptsInSourceRoots
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
import org.jetbrains.kotlin.idea.core.script.scriptingDebugLog
|
||||
import org.jetbrains.kotlin.idea.hasNoExceptionsToBeUnderSourceRoot
|
||||
import org.jetbrains.kotlin.idea.isEnabled
|
||||
import org.jetbrains.kotlin.idea.util.isKotlinFileType
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptConfigurationsProvider
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.findScriptDefinition
|
||||
import kotlin.script.experimental.api.ScriptCompilationConfiguration
|
||||
import kotlin.script.experimental.api.isStandalone
|
||||
|
||||
class KotlinScriptResolveScopeProvider : ResolveScopeProvider() {
|
||||
|
||||
override fun getResolveScope(file: VirtualFile, project: Project): GlobalSearchScope? =
|
||||
getResolveScope(file, defaultContext(), project)
|
||||
|
||||
override fun getResolveScope(file: VirtualFile, context: CodeInsightContext, project: Project): GlobalSearchScope? {
|
||||
if (!file.isKotlinFileType()) return null
|
||||
|
||||
val ktFile = PsiManager.getInstance(project).findFile(file, context) as? KtFile ?: return null
|
||||
val scriptDefinition = ktFile.findScriptDefinition() ?: return null
|
||||
|
||||
// This is a workaround for completion in REPL to provide module dependencies
|
||||
if (scriptDefinition.baseClassType.fromClass == Any::class) return null
|
||||
|
||||
val featureEnabled = LanguageFeature.SkipStandaloneScriptsInSourceRoots.isEnabled(ktFile.module, project)
|
||||
val backwardCompatibilityIsOn = compilerAllowsAnyScriptsInSourceRoots(project)
|
||||
|
||||
ktFile.debugLog { "language-feature: ${featureEnabled}, backward-compatibility-flag: ${backwardCompatibilityIsOn}" }
|
||||
|
||||
if (featureEnabled && !backwardCompatibilityIsOn) {
|
||||
return ktFile.getScopeAccordingToLanguageFeature(file, project, scriptDefinition)
|
||||
}
|
||||
|
||||
scriptingDebugLog(ktFile) { "resolving as standalone" }
|
||||
return ktFile.calculateScopeForStandaloneScript(file, project)
|
||||
}
|
||||
|
||||
private fun KtFile.getScopeAccordingToLanguageFeature(
|
||||
file: VirtualFile,
|
||||
project: Project,
|
||||
scriptDefinition: ScriptDefinition
|
||||
): GlobalSearchScope? {
|
||||
assert(LanguageFeature.SkipStandaloneScriptsInSourceRoots.isEnabled(module, project)) { "SkipStandaloneScriptsInSourceRoots is off" }
|
||||
|
||||
return if (isStandaloneScriptByDesign(project, scriptDefinition)) {
|
||||
getScopeForStandaloneScript(file, project)
|
||||
} else {
|
||||
getScopeForNonStandaloneScript(file, project)
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.getScopeForNonStandaloneScript(file: VirtualFile, project: Project): KotlinScriptSearchScope? {
|
||||
val underSourceRoot = isUnderKotlinSourceRootTypes()
|
||||
debugLog { "under-source-root: $underSourceRoot" }
|
||||
|
||||
return if (underSourceRoot) {
|
||||
debugLog { "=> in-module" }
|
||||
null // as designed
|
||||
} else {
|
||||
calculateScopeForStandaloneScript(file, project) // the compiler doesn't forbid this, so do we
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.getScopeForStandaloneScript(file: VirtualFile, project: Project): KotlinScriptSearchScope? {
|
||||
val underSourceRoot = isUnderKotlinSourceRootTypes()
|
||||
debugLog { "under-source-root: $underSourceRoot" }
|
||||
|
||||
return if (underSourceRoot) {
|
||||
getScopeForStandaloneScriptUnderSourceRoot(file, project)
|
||||
} else {
|
||||
calculateScopeForStandaloneScript(file, project) // as designed
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.getScopeForStandaloneScriptUnderSourceRoot(file: VirtualFile, project: Project): KotlinScriptSearchScope? {
|
||||
val hasNoExceptionToBeUnderSourceRoot = file.hasNoExceptionsToBeUnderSourceRoot()
|
||||
debugLog { "exception-to-be-under-source-root: ${!hasNoExceptionToBeUnderSourceRoot}" }
|
||||
|
||||
return if (hasNoExceptionToBeUnderSourceRoot) {
|
||||
// We show the editor notification panel (file will be ignored at compilation), but allow resolution/highlighting work.
|
||||
calculateScopeForStandaloneScript(file, project)
|
||||
} else {
|
||||
debugLog { "=> in-module" }
|
||||
null // scripts not yet supporting "isStandalone" flag
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.isStandaloneScriptByDesign(project: Project, definition: ScriptDefinition): Boolean {
|
||||
val configuration = ScriptConfigurationsProvider.getInstance(project)?.getScriptConfiguration(this)?.configuration
|
||||
?: definition.compilationConfiguration
|
||||
val isStandalone = configuration[ScriptCompilationConfiguration.isStandalone] == true
|
||||
debugLog { "standalone-by-design: $isStandalone" }
|
||||
return isStandalone
|
||||
}
|
||||
|
||||
private fun KtFile.calculateScopeForStandaloneScript(file: VirtualFile, project: Project): KotlinScriptSearchScope {
|
||||
val vFile = virtualFile ?: viewProvider.virtualFile
|
||||
val dependenciesScope =
|
||||
ScriptDependencyAware.getInstance(project).getScriptDependenciesClassFilesScope(vFile)
|
||||
debugLog { "=> standalone" }
|
||||
return KotlinScriptSearchScope(project, GlobalSearchScope.fileScope(project, file).uniteWith(dependenciesScope))
|
||||
}
|
||||
|
||||
private fun KtFile.debugLog(message: () -> String) {
|
||||
scriptingDebugLog(this) { "[resolve-scope] ${message.invoke()}"}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.script.k2.dependencies
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.ResolveScopeProvider
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.RootKindFilter
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.RootKindMatcher
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.KotlinScriptSearchScope
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependencyAware
|
||||
|
||||
/**
|
||||
* @see KotlinScriptResolveScopeProvider
|
||||
*/
|
||||
class ScriptDependenciesResolveScopeProvider : ResolveScopeProvider() {
|
||||
|
||||
/**
|
||||
* @param file is a file belonging to dependencies of a script being analysed
|
||||
*/
|
||||
override fun getResolveScope(file: VirtualFile, project: Project): GlobalSearchScope? {
|
||||
/*
|
||||
Unfortunately, we cannot limit the scope to the concrete script dependencies. There is no way to say, what .kts is being analysed.
|
||||
Some facts to consider:
|
||||
- dependencies are analysed first, .kts file itself goes last
|
||||
- multiple editors can be opened (selected is only one of them)
|
||||
*/
|
||||
|
||||
if (RootKindMatcher.matches(project, file, RootKindFilter.libraryFiles.copy(includeScriptDependencies = false)))
|
||||
return null
|
||||
|
||||
if (ScriptDependencyAware.getInstance(project).getAllScriptsDependenciesClassFiles().isEmpty()) return null
|
||||
|
||||
if (file !in ScriptDependencyAware.getInstance(project).getAllScriptsDependenciesClassFilesScope()
|
||||
&& file !in ScriptDependencyAware.getInstance(project).getAllScriptDependenciesSourcesScope()) {
|
||||
return null
|
||||
}
|
||||
|
||||
return KotlinScriptSearchScope(project, GlobalSearchScope.fileScope(project, file))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:OptIn(K1ModeProjectStructureApi::class, KaPlatformInterface::class)
|
||||
|
||||
package org.jetbrains.kotlin.idea.core.script.k2.modules
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KaPlatformInterface
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.KaModuleFactory
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.KtScriptLibraryModuleByModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.KtScriptLibrarySourceModuleByModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.JvmLibraryInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.LibrarySourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.util.K1ModeProjectStructureApi
|
||||
import org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySource
|
||||
|
||||
internal class ScriptingKaModuleFactory : KaModuleFactory {
|
||||
override fun createModule(moduleInfo: ModuleInfo): KaModule? {
|
||||
return when (moduleInfo) {
|
||||
is JvmLibraryInfo -> (moduleInfo.source as? KotlinScriptEntitySource)?.let {
|
||||
KtScriptLibraryModuleByModuleInfo(moduleInfo)
|
||||
}
|
||||
is LibrarySourceInfo -> (moduleInfo.source as? KotlinScriptEntitySource)?.let {
|
||||
KtScriptLibrarySourceModuleByModuleInfo(moduleInfo)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -76,7 +76,7 @@ jvm_library(
|
||||
jvm_library(
|
||||
name = "scripting_test_lib",
|
||||
visibility = ["//visibility:public"],
|
||||
srcs = glob(["test/**/*.kt", "test/**/*.java"], allow_empty = True),
|
||||
srcs = glob(["test/**/*.kt", "test/**/*.java", "testGen/**/*.kt", "testGen/**/*.java"], allow_empty = True),
|
||||
kotlinc_opts = ":custom",
|
||||
associates = [":scripting"],
|
||||
deps = [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.ucache.impl
|
||||
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
@@ -20,282 +20,282 @@ import org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryId
|
||||
@GeneratedCodeApiVersion(3)
|
||||
@GeneratedCodeImplVersion(6)
|
||||
@OptIn(WorkspaceEntityInternalApi::class)
|
||||
internal class KotlinScriptEntityImpl(private val dataSource: KotlinScriptEntityData) : KotlinScriptEntity,
|
||||
WorkspaceEntityBase(dataSource) {
|
||||
internal class KotlinScriptEntityImpl(private val dataSource: KotlinScriptEntityData) : KotlinScriptEntity, WorkspaceEntityBase(
|
||||
dataSource) {
|
||||
|
||||
private companion object {
|
||||
private companion object {
|
||||
|
||||
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override val symbolicId: KotlinScriptId = super.symbolicId
|
||||
|
||||
override val path: String
|
||||
get() {
|
||||
readField("path")
|
||||
return dataSource.path
|
||||
}
|
||||
|
||||
override val symbolicId: KotlinScriptId = super.symbolicId
|
||||
override val dependencies: Set<KotlinScriptLibraryId>
|
||||
get() {
|
||||
readField("dependencies")
|
||||
return dataSource.dependencies
|
||||
}
|
||||
|
||||
override val path: String
|
||||
get() {
|
||||
readField("path")
|
||||
return dataSource.path
|
||||
}
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override val dependencies: Set<KotlinScriptLibraryId>
|
||||
get() {
|
||||
readField("dependencies")
|
||||
return dataSource.dependencies
|
||||
}
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
|
||||
internal class Builder(result: KotlinScriptEntityData?) : ModifiableWorkspaceEntityBase<KotlinScriptEntity, KotlinScriptEntityData>(
|
||||
result), KotlinScriptEntity.Builder {
|
||||
internal constructor() : this(KotlinScriptEntityData())
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isPathInitialized()) {
|
||||
error("Field KotlinScriptEntity#path should be initialized")
|
||||
}
|
||||
if (!getEntityData().isDependenciesInitialized()) {
|
||||
error("Field KotlinScriptEntity#dependencies should be initialized")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies is MutableWorkspaceSet<*>) {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.path != dataSource.path) this.path = dataSource.path
|
||||
if (this.dependencies != dataSource.dependencies) this.dependencies = dataSource.dependencies.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
internal class Builder(result: KotlinScriptEntityData?) :
|
||||
ModifiableWorkspaceEntityBase<KotlinScriptEntity, KotlinScriptEntityData>(result), KotlinScriptEntity.Builder {
|
||||
internal constructor() : this(KotlinScriptEntityData())
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
override var path: String
|
||||
get() = getEntityData().path
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).path = value
|
||||
changedProperty.add("path")
|
||||
}
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
private val dependenciesUpdater: (value: Set<KotlinScriptLibraryId>) -> Unit = { value ->
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isPathInitialized()) {
|
||||
error("Field KotlinScriptEntity#path should be initialized")
|
||||
}
|
||||
if (!getEntityData().isDependenciesInitialized()) {
|
||||
error("Field KotlinScriptEntity#dependencies should be initialized")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies is MutableWorkspaceSet<*>) {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.path != dataSource.path) this.path = dataSource.path
|
||||
if (this.dependencies != dataSource.dependencies) this.dependencies = dataSource.dependencies.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
}
|
||||
|
||||
override var path: String
|
||||
get() = getEntityData().path
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).path = value
|
||||
changedProperty.add("path")
|
||||
}
|
||||
|
||||
private val dependenciesUpdater: (value: Set<KotlinScriptLibraryId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("dependencies")
|
||||
}
|
||||
override var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
get() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies !is MutableWorkspaceSet) return collection_dependencies
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_dependencies.setModificationUpdateAction(dependenciesUpdater)
|
||||
}
|
||||
else {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_dependencies
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).dependencies = value
|
||||
dependenciesUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptEntity> = KotlinScriptEntity::class.java
|
||||
changedProperty.add("dependencies")
|
||||
}
|
||||
override var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
get() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies !is MutableWorkspaceSet) return collection_dependencies
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_dependencies.setModificationUpdateAction(dependenciesUpdater)
|
||||
}
|
||||
else {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_dependencies
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).dependencies = value
|
||||
dependenciesUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptEntity> = KotlinScriptEntity::class.java
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(WorkspaceEntityInternalApi::class)
|
||||
internal class KotlinScriptEntityData : WorkspaceEntityData<KotlinScriptEntity>(), SoftLinkable {
|
||||
lateinit var path: String
|
||||
lateinit var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
lateinit var path: String
|
||||
lateinit var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
|
||||
internal fun isPathInitialized(): Boolean = ::path.isInitialized
|
||||
internal fun isDependenciesInitialized(): Boolean = ::dependencies.isInitialized
|
||||
internal fun isPathInitialized(): Boolean = ::path.isInitialized
|
||||
internal fun isDependenciesInitialized(): Boolean = ::dependencies.isInitialized
|
||||
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in dependencies) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in dependencies) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in dependencies) {
|
||||
index.index(this, item)
|
||||
}
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in dependencies) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in dependencies) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in dependencies) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val dependencies_data = dependencies.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptLibraryId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
}
|
||||
if (dependencies_data != null) {
|
||||
dependencies = dependencies_data as MutableSet<KotlinScriptLibraryId>
|
||||
}
|
||||
return changed
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
val modifiable = KotlinScriptEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val dependencies_data = dependencies.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptLibraryId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
if (dependencies_data != null) {
|
||||
dependencies = dependencies_data as MutableSet<KotlinScriptLibraryId>
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn("org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptEntity") as EntityMetadata
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
val modifiable = KotlinScriptEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptEntityData
|
||||
clonedEntity.dependencies = clonedEntity.dependencies.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn("org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptEntity") as EntityMetadata
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptEntityData
|
||||
clonedEntity.dependencies = clonedEntity.dependencies.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptEntity::class.java
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptEntity(path, dependencies, entitySource) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptEntity::class.java
|
||||
}
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptEntity(path, dependencies, entitySource) {
|
||||
}
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
other as KotlinScriptEntityData
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
|
||||
other as KotlinScriptEntityData
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
other as KotlinScriptEntityData
|
||||
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
|
||||
other as KotlinScriptEntityData
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.ucache.impl
|
||||
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
@@ -24,353 +24,352 @@ import org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryRoot
|
||||
@GeneratedCodeApiVersion(3)
|
||||
@GeneratedCodeImplVersion(6)
|
||||
@OptIn(WorkspaceEntityInternalApi::class)
|
||||
internal class KotlinScriptLibraryEntityImpl(private val dataSource: KotlinScriptLibraryEntityData) : KotlinScriptLibraryEntity,
|
||||
WorkspaceEntityBase(dataSource) {
|
||||
internal class KotlinScriptLibraryEntityImpl(private val dataSource: KotlinScriptLibraryEntityData) : KotlinScriptLibraryEntity, WorkspaceEntityBase(
|
||||
dataSource) {
|
||||
|
||||
private companion object {
|
||||
private companion object {
|
||||
|
||||
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override val symbolicId: KotlinScriptLibraryId = super.symbolicId
|
||||
|
||||
override val name: String
|
||||
get() {
|
||||
readField("name")
|
||||
return dataSource.name
|
||||
}
|
||||
|
||||
override val symbolicId: KotlinScriptLibraryId = super.symbolicId
|
||||
override val roots: List<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
readField("roots")
|
||||
return dataSource.roots
|
||||
}
|
||||
|
||||
override val name: String
|
||||
get() {
|
||||
readField("name")
|
||||
return dataSource.name
|
||||
}
|
||||
override val indexSourceRoots: Boolean
|
||||
get() {
|
||||
readField("indexSourceRoots")
|
||||
return dataSource.indexSourceRoots
|
||||
}
|
||||
override val usedInScripts: Set<KotlinScriptId>
|
||||
get() {
|
||||
readField("usedInScripts")
|
||||
return dataSource.usedInScripts
|
||||
}
|
||||
|
||||
override val roots: List<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
readField("roots")
|
||||
return dataSource.roots
|
||||
}
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override val indexSourceRoots: Boolean
|
||||
get() {
|
||||
readField("indexSourceRoots")
|
||||
return dataSource.indexSourceRoots
|
||||
}
|
||||
override val usedInScripts: Set<KotlinScriptId>
|
||||
get() {
|
||||
readField("usedInScripts")
|
||||
return dataSource.usedInScripts
|
||||
}
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
|
||||
internal class Builder(result: KotlinScriptLibraryEntityData?) : ModifiableWorkspaceEntityBase<KotlinScriptLibraryEntity, KotlinScriptLibraryEntityData>(
|
||||
result), KotlinScriptLibraryEntity.Builder {
|
||||
internal constructor() : this(KotlinScriptLibraryEntityData())
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptLibraryEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isNameInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#name should be initialized")
|
||||
}
|
||||
if (!getEntityData().isRootsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#roots should be initialized")
|
||||
}
|
||||
if (!getEntityData().isUsedInScriptsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#usedInScripts should be initialized")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots is MutableWorkspaceList<*>) {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts is MutableWorkspaceSet<*>) {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptLibraryEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.name != dataSource.name) this.name = dataSource.name
|
||||
if (this.roots != dataSource.roots) this.roots = dataSource.roots.toMutableList()
|
||||
if (this.indexSourceRoots != dataSource.indexSourceRoots) this.indexSourceRoots = dataSource.indexSourceRoots
|
||||
if (this.usedInScripts != dataSource.usedInScripts) this.usedInScripts = dataSource.usedInScripts.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
internal class Builder(result: KotlinScriptLibraryEntityData?) :
|
||||
ModifiableWorkspaceEntityBase<KotlinScriptLibraryEntity, KotlinScriptLibraryEntityData>(result), KotlinScriptLibraryEntity.Builder {
|
||||
internal constructor() : this(KotlinScriptLibraryEntityData())
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptLibraryEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
override var name: String
|
||||
get() = getEntityData().name
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).name = value
|
||||
changedProperty.add("name")
|
||||
}
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
private val rootsUpdater: (value: List<KotlinScriptLibraryRoot>) -> Unit = { value ->
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isNameInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#name should be initialized")
|
||||
}
|
||||
if (!getEntityData().isRootsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#roots should be initialized")
|
||||
}
|
||||
if (!getEntityData().isUsedInScriptsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#usedInScripts should be initialized")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots is MutableWorkspaceList<*>) {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts is MutableWorkspaceSet<*>) {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptLibraryEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.name != dataSource.name) this.name = dataSource.name
|
||||
if (this.roots != dataSource.roots) this.roots = dataSource.roots.toMutableList()
|
||||
if (this.indexSourceRoots != dataSource.indexSourceRoots) this.indexSourceRoots = dataSource.indexSourceRoots
|
||||
if (this.usedInScripts != dataSource.usedInScripts) this.usedInScripts = dataSource.usedInScripts.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
}
|
||||
|
||||
override var name: String
|
||||
get() = getEntityData().name
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).name = value
|
||||
changedProperty.add("name")
|
||||
}
|
||||
|
||||
private val rootsUpdater: (value: List<KotlinScriptLibraryRoot>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("roots")
|
||||
}
|
||||
override var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots !is MutableWorkspaceList) return collection_roots
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_roots.setModificationUpdateAction(rootsUpdater)
|
||||
}
|
||||
else {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_roots
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).roots = value
|
||||
rootsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override var indexSourceRoots: Boolean
|
||||
get() = getEntityData().indexSourceRoots
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).indexSourceRoots = value
|
||||
changedProperty.add("indexSourceRoots")
|
||||
}
|
||||
|
||||
private val usedInScriptsUpdater: (value: Set<KotlinScriptId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("usedInScripts")
|
||||
}
|
||||
override var usedInScripts: MutableSet<KotlinScriptId>
|
||||
get() {
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts !is MutableWorkspaceSet) return collection_usedInScripts
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_usedInScripts.setModificationUpdateAction(usedInScriptsUpdater)
|
||||
}
|
||||
else {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_usedInScripts
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).usedInScripts = value
|
||||
usedInScriptsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptLibraryEntity> = KotlinScriptLibraryEntity::class.java
|
||||
changedProperty.add("roots")
|
||||
}
|
||||
override var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots !is MutableWorkspaceList) return collection_roots
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_roots.setModificationUpdateAction(rootsUpdater)
|
||||
}
|
||||
else {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_roots
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).roots = value
|
||||
rootsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override var indexSourceRoots: Boolean
|
||||
get() = getEntityData().indexSourceRoots
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).indexSourceRoots = value
|
||||
changedProperty.add("indexSourceRoots")
|
||||
}
|
||||
|
||||
private val usedInScriptsUpdater: (value: Set<KotlinScriptId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("usedInScripts")
|
||||
}
|
||||
override var usedInScripts: MutableSet<KotlinScriptId>
|
||||
get() {
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts !is MutableWorkspaceSet) return collection_usedInScripts
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_usedInScripts.setModificationUpdateAction(usedInScriptsUpdater)
|
||||
}
|
||||
else {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_usedInScripts
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).usedInScripts = value
|
||||
usedInScriptsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptLibraryEntity> = KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(WorkspaceEntityInternalApi::class)
|
||||
internal class KotlinScriptLibraryEntityData : WorkspaceEntityData<KotlinScriptLibraryEntity>(), SoftLinkable {
|
||||
lateinit var name: String
|
||||
lateinit var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean = false
|
||||
lateinit var usedInScripts: MutableSet<KotlinScriptId>
|
||||
lateinit var name: String
|
||||
lateinit var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean = false
|
||||
lateinit var usedInScripts: MutableSet<KotlinScriptId>
|
||||
|
||||
internal fun isNameInitialized(): Boolean = ::name.isInitialized
|
||||
internal fun isRootsInitialized(): Boolean = ::roots.isInitialized
|
||||
internal fun isNameInitialized(): Boolean = ::name.isInitialized
|
||||
internal fun isRootsInitialized(): Boolean = ::roots.isInitialized
|
||||
|
||||
internal fun isUsedInScriptsInitialized(): Boolean = ::usedInScripts.isInitialized
|
||||
internal fun isUsedInScriptsInitialized(): Boolean = ::usedInScripts.isInitialized
|
||||
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in roots) {
|
||||
}
|
||||
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
index.index(this, item)
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in roots) {
|
||||
}
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val usedInScripts_data = usedInScripts.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
}
|
||||
if (usedInScripts_data != null) {
|
||||
usedInScripts = usedInScripts_data as MutableSet<KotlinScriptId>
|
||||
}
|
||||
return changed
|
||||
for (item in usedInScripts) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
val modifiable = KotlinScriptLibraryEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in roots) {
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptLibraryEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptLibraryEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn(
|
||||
"org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryEntity"
|
||||
) as EntityMetadata
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptLibraryEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptLibraryEntityData
|
||||
clonedEntity.roots = clonedEntity.roots.toMutableWorkspaceList()
|
||||
clonedEntity.usedInScripts = clonedEntity.usedInScripts.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val usedInScripts_data = usedInScripts.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptLibraryEntity::class.java
|
||||
if (usedInScripts_data != null) {
|
||||
usedInScripts = usedInScripts_data as MutableSet<KotlinScriptId>
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptLibraryEntity(name, roots, indexSourceRoots, usedInScripts, entitySource) {
|
||||
}
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
val modifiable = KotlinScriptLibraryEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptLibraryEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptLibraryEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn(
|
||||
"org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryEntity") as EntityMetadata
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptLibraryEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptLibraryEntityData
|
||||
clonedEntity.roots = clonedEntity.roots.toMutableWorkspaceList()
|
||||
clonedEntity.usedInScripts = clonedEntity.usedInScripts.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptLibraryEntity(name, roots, indexSourceRoots, usedInScripts, entitySource) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
|
||||
other as KotlinScriptLibraryEntityData
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
other as KotlinScriptLibraryEntityData
|
||||
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
|
||||
other as KotlinScriptLibraryEntityData
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
other as KotlinScriptLibraryEntityData
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testGen" isTestSource="true" generated="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.DelegatingGlobalSearchScope
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
|
||||
class KotlinScriptSearchScope(project: Project, baseScope: GlobalSearchScope) : DelegatingGlobalSearchScope(project, baseScope)
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.base.scripting.projectStructure
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.platform.backend.workspace.WorkspaceModel
|
||||
import com.intellij.platform.backend.workspace.toVirtualFileUrl
|
||||
import com.intellij.platform.workspace.jps.entities.ModuleEntity
|
||||
import com.intellij.platform.workspace.storage.EntityStorage
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun VirtualFile.scriptModuleEntity(project: Project, snapshot: EntityStorage): ModuleEntity? {
|
||||
val virtualFileUrlManager = WorkspaceModel.getInstance(project).getVirtualFileUrlManager()
|
||||
val virtualFileUrl = toVirtualFileUrl(virtualFileUrlManager)
|
||||
return snapshot.getVirtualFileUrlIndex().findEntitiesByUrl(virtualFileUrl).firstNotNullOfOrNull { it as? ModuleEntity }
|
||||
}
|
||||
@@ -16,42 +16,42 @@ interface KotlinScriptEntity : WorkspaceEntityWithSymbolicId {
|
||||
override val symbolicId: KotlinScriptId
|
||||
get() = KotlinScriptId(path)
|
||||
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var path: String
|
||||
var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
}
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var path: String
|
||||
var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
}
|
||||
|
||||
companion object : EntityType<KotlinScriptEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
path: String,
|
||||
dependencies: Set<KotlinScriptLibraryId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.path = path
|
||||
builder.dependencies = dependencies.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
}
|
||||
companion object : EntityType<KotlinScriptEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
path: String,
|
||||
dependencies: Set<KotlinScriptLibraryId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.path = path
|
||||
builder.dependencies = dependencies.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
//endregion
|
||||
|
||||
}
|
||||
|
||||
//region generated code
|
||||
fun MutableEntityStorage.modifyKotlinScriptEntity(
|
||||
entity: KotlinScriptEntity,
|
||||
modification: KotlinScriptEntity.Builder.() -> Unit,
|
||||
entity: KotlinScriptEntity,
|
||||
modification: KotlinScriptEntity.Builder.() -> Unit,
|
||||
): KotlinScriptEntity {
|
||||
return modifyEntity(KotlinScriptEntity.Builder::class.java, entity, modification)
|
||||
return modifyEntity(KotlinScriptEntity.Builder::class.java, entity, modification)
|
||||
}
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -38,46 +38,46 @@ interface KotlinScriptLibraryEntity : WorkspaceEntityWithSymbolicId {
|
||||
override val symbolicId: KotlinScriptLibraryId
|
||||
get() = KotlinScriptLibraryId(name)
|
||||
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var name: String
|
||||
var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean
|
||||
var usedInScripts: MutableSet<KotlinScriptId>
|
||||
}
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var name: String
|
||||
var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean
|
||||
var usedInScripts: MutableSet<KotlinScriptId>
|
||||
}
|
||||
|
||||
companion object : EntityType<KotlinScriptLibraryEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
name: String,
|
||||
roots: List<KotlinScriptLibraryRoot>,
|
||||
indexSourceRoots: Boolean,
|
||||
usedInScripts: Set<KotlinScriptId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.name = name
|
||||
builder.roots = roots.toMutableWorkspaceList()
|
||||
builder.indexSourceRoots = indexSourceRoots
|
||||
builder.usedInScripts = usedInScripts.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
}
|
||||
companion object : EntityType<KotlinScriptLibraryEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
name: String,
|
||||
roots: List<KotlinScriptLibraryRoot>,
|
||||
indexSourceRoots: Boolean,
|
||||
usedInScripts: Set<KotlinScriptId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.name = name
|
||||
builder.roots = roots.toMutableWorkspaceList()
|
||||
builder.indexSourceRoots = indexSourceRoots
|
||||
builder.usedInScripts = usedInScripts.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
||||
//region generated code
|
||||
fun MutableEntityStorage.modifyKotlinScriptLibraryEntity(
|
||||
entity: KotlinScriptLibraryEntity,
|
||||
modification: KotlinScriptLibraryEntity.Builder.() -> Unit,
|
||||
entity: KotlinScriptLibraryEntity,
|
||||
modification: KotlinScriptLibraryEntity.Builder.() -> Unit,
|
||||
): KotlinScriptLibraryEntity {
|
||||
return modifyEntity(KotlinScriptLibraryEntity.Builder::class.java, entity, modification)
|
||||
return modifyEntity(KotlinScriptLibraryEntity.Builder::class.java, entity, modification)
|
||||
}
|
||||
//endregion
|
||||
|
||||
@@ -38,6 +38,7 @@ jvm_library(
|
||||
"//plugins/kotlin/code-insight/api",
|
||||
"//plugins/kotlin/base/fe10/analysis",
|
||||
"//platform/lang-impl",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
],
|
||||
runtime_deps = [":kotlin-compiler-plugins-assignment-common-k1_resources"]
|
||||
)
|
||||
|
||||
@@ -42,5 +42,6 @@
|
||||
<orderEntry type="module" module-name="kotlin.code-insight.api" />
|
||||
<orderEntry type="module" module-name="kotlin.base.fe10.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,4 +1,7 @@
|
||||
<idea-plugin package="org.jetbrains.kotlin.idea.compilerPlugin.assignment.k1">
|
||||
<dependencies>
|
||||
<module name="kotlin.base.scripting.k1"/>
|
||||
</dependencies>
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<assignResolutionAltererExtension implementation="org.jetbrains.kotlin.idea.compilerPlugin.assignment.k1.IdeAssignPluginResolutionAltererExtension"/>
|
||||
<storageComponentContainerContributor implementation="org.jetbrains.kotlin.idea.compilerPlugin.assignment.k1.IdeAssignmentContainerContributor"/>
|
||||
|
||||
@@ -11,8 +11,8 @@ import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleProductionSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
|
||||
class IdeAssignmentContainerContributor(private val project: Project) : StorageComponentContainerContributor {
|
||||
|
||||
@@ -30,6 +30,7 @@ jvm_library(
|
||||
"//platform/util",
|
||||
"//plugins/kotlin/compiler-plugins/compiler-plugin-support/common",
|
||||
"//platform/core-api:core",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
]
|
||||
)
|
||||
### auto-generated section `build kotlin.compiler-plugins.sam-with-receiver.common` end
|
||||
@@ -34,5 +34,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
<orderEntry type="module" module-name="kotlin.compiler-plugins.compiler-plugin-support.common" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -15,9 +15,9 @@ import org.jetbrains.kotlin.container.useInstance
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleProductionSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.compilerPlugin.getSpecialAnnotations
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME
|
||||
|
||||
@@ -75,6 +75,7 @@ jvm_library(
|
||||
"//plugins/kotlin/base/platforms",
|
||||
"//plugins/kotlin/base/project-structure",
|
||||
"//plugins/kotlin/base/scripting",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
"//platform/util/progress",
|
||||
"//plugins/kotlin/base/external-build-system",
|
||||
"//plugins/kotlin/base/analysis",
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
<orderEntry type="module" module-name="kotlin.base.platforms" />
|
||||
<orderEntry type="module" module-name="kotlin.base.project-structure" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.progress" />
|
||||
<orderEntry type="module" module-name="kotlin.base.external-build-system" />
|
||||
<orderEntry type="module" module-name="kotlin.base.analysis" />
|
||||
|
||||
@@ -16,9 +16,9 @@ import org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfoOrNull
|
||||
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.safeAnalyzeNonSourceRootCode
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptModuleInfo
|
||||
import org.jetbrains.kotlin.idea.formatter.kotlinCustomSettings
|
||||
import org.jetbrains.kotlin.idea.references.*
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
|
||||
@@ -175,6 +175,7 @@ jvm_library(
|
||||
"//plugins/kotlin/code-insight/live-templates-shared:kotlin-code-insight-live-templates-shared",
|
||||
"//plugins/kotlin/code-insight/live-templates-shared:kotlin-code-insight-live-templates-shared_test_lib",
|
||||
"//plugins/kotlin/jvm/k1",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
],
|
||||
runtime_deps = [
|
||||
"//plugins/kotlin/gradle/gradle",
|
||||
|
||||
@@ -181,5 +181,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework.junit5" />
|
||||
<orderEntry type="module" module-name="kotlin.code-insight.live-templates.shared" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.jvm.k1" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -26,6 +26,7 @@ import com.intellij.testFramework.PsiTestUtil
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.util.ThrowableRunnable
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.kotlin.base.fe10.analysis.ResolutionAnchorCacheService
|
||||
import org.jetbrains.kotlin.base.fe10.analysis.ResolutionAnchorCacheServiceImpl
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinCommonLibraryKind
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinJavaScriptLibraryKind
|
||||
@@ -33,15 +34,13 @@ import org.jetbrains.kotlin.idea.base.platforms.KotlinWasmJsLibraryKind
|
||||
import org.jetbrains.kotlin.idea.base.platforms.KotlinWasmWasiLibraryKind
|
||||
import org.jetbrains.kotlin.idea.base.plugin.artifacts.TestKotlinArtifacts
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.*
|
||||
import org.jetbrains.kotlin.base.fe10.analysis.ResolutionAnchorCacheService
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.libraryToSourceAnalysis.withLibraryToSourceAnalysis
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.*
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.ModuleTestSourceInfo
|
||||
import org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.getDependentModules
|
||||
import org.jetbrains.kotlin.idea.caches.project.getIdeaModelInfosCache
|
||||
import org.jetbrains.kotlin.idea.caches.project.getModuleInfosFromIdeaModel
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager.Companion.updateScriptDependenciesSynchronously
|
||||
import org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils.allowProjectRootAccess
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils.disposeVfsRootAccess
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<orderEntry type="module" module-name="kotlin.base.analysis-api-platform" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.project-structure" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k2" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.analysis-api.utils" exported="" />
|
||||
<orderEntry type="module" module-name="kotlin.base.facet" exported="" />
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
|
||||
<psi.clsCustomNavigationPolicy
|
||||
implementation="org.jetbrains.kotlin.idea.core.script.dependencies.ScriptDependencySourceNavigationPolicyForJavaClasses"/>
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptResolveScopeProvider"/>
|
||||
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.dependencies.ScriptDependenciesResolveScopeProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
|
||||
@@ -31,6 +31,7 @@ java_library(
|
||||
"//plugins/kotlin/base/platforms",
|
||||
"//plugins/kotlin/base/project-structure",
|
||||
"//plugins/kotlin/base/scripting",
|
||||
"//plugins/kotlin/base/scripting.k1",
|
||||
"//plugins/kotlin/base/analysis",
|
||||
"//plugins/kotlin/base/analysis-api-platform",
|
||||
"//plugins/kotlin/base/facet",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<orderEntry type="module" module-name="kotlin.base.platforms" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.project-structure" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.scripting.k1" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.analysis" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.analysis-api-platform" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="kotlin.base.facet" scope="RUNTIME" />
|
||||
|
||||
@@ -80,10 +80,6 @@
|
||||
order="last"
|
||||
implementation="org.jetbrains.kotlin.idea.core.script.BundledScriptDefinitionSource"/>
|
||||
|
||||
<ktModuleFactory implementation="org.jetbrains.kotlin.idea.base.scripting.projectStructure.ScriptingKaModuleFactory"/>
|
||||
|
||||
<idea.base.projectStructure.moduleInfoProviderExtension implementation="org.jetbrains.kotlin.idea.base.scripting.ScriptingModuleInfoProviderExtension"/>
|
||||
|
||||
<syntheticResolveExtension implementation="org.jetbrains.kotlin.scripting.extensions.ScriptingResolveExtension"/>
|
||||
<extraImportsProviderExtension implementation="org.jetbrains.kotlin.scripting.extensions.ScriptExtraImportsProviderExtension"/>
|
||||
|
||||
|
||||
@@ -121,5 +121,7 @@
|
||||
<module name="kotlin.compiler-reference-index"/>
|
||||
|
||||
<module name="kotlin.performanceExtendedPlugin"/>
|
||||
|
||||
<module name="kotlin.base.scripting.k1"/>
|
||||
</content>
|
||||
</idea-plugin>
|
||||
@@ -106,6 +106,7 @@
|
||||
- name: kotlin.base.project-structure
|
||||
- name: kotlin.base.external-build-system
|
||||
- name: kotlin.base.scripting
|
||||
- name: kotlin.base.scripting.k1
|
||||
- name: kotlin.base.scripting.k2
|
||||
- name: kotlin.base.analysis-api-platform
|
||||
- name: kotlin.base.analysis
|
||||
|
||||
Reference in New Issue
Block a user