Commit 951baaac authored by Ilya.Kazakevich's avatar Ilya.Kazakevich Committed by intellij-monorepo-bot
Browse files

PY-70729: Move `com.jetbrains.extensions` deprecated package to the separate module.

This package is only used by third party plugins. We can't leave it inside another v2 module due to package inconsistency.

See errors like https://youtrack.jetbrains.com/issue/PY-70729/Class-com.jetbrains.python.psi.PyElementType-must-not-be-requested-from-main-classloader-of-Pythonid-plugin#focus=Comments-27-9494155.0-0

So we move it to the separate v2 module which will be removed soon

(cherry picked from commit ac83deba61735dd09c2c7133fdca37605480f654)

IJ-CR-129709

GitOrigin-RevId: b7f209aeaf8b58ba41e7d0d876d893c4bf18d620
parent 55644970
Showing with 78 additions and 39 deletions
+78 -39
......@@ -1126,6 +1126,7 @@
<module fileurl="file://$PROJECT_DIR$/python/python-common-tests/intellij.python.commonTests.iml" filepath="$PROJECT_DIR$/python/python-common-tests/intellij.python.commonTests.iml" />
<module fileurl="file://$PROJECT_DIR$/python/openapi/intellij.python.community.iml" filepath="$PROJECT_DIR$/python/openapi/intellij.python.community.iml" />
<module fileurl="file://$PROJECT_DIR$/python/python-core-impl/intellij.python.community.core.impl.iml" filepath="$PROJECT_DIR$/python/python-core-impl/intellij.python.community.core.impl.iml" />
<module fileurl="file://$PROJECT_DIR$/python/python-core-impl/intellij.python.community.deprecated.extensions/intellij.python.community.deprecated.extensions.iml" filepath="$PROJECT_DIR$/python/python-core-impl/intellij.python.community.deprecated.extensions/intellij.python.community.deprecated.extensions.iml" />
<module fileurl="file://$PROJECT_DIR$/python/intellij.python.community.impl.iml" filepath="$PROJECT_DIR$/python/intellij.python.community.impl.iml" />
<module fileurl="file://$PROJECT_DIR$/python/intellij.python.community.impl.community_only/intellij.python.community.impl.community_only.iml" filepath="$PROJECT_DIR$/python/intellij.python.community.impl.community_only/intellij.python.community.impl.community_only.iml" />
<module fileurl="file://$PROJECT_DIR$/python/huggingFace/intellij.python.community.impl.huggingFace.iml" filepath="$PROJECT_DIR$/python/huggingFace/intellij.python.community.impl.huggingFace.iml" />
......
......@@ -34,7 +34,8 @@ object PythonCommunityPluginModules {
"intellij.python.featuresTrainer",
"intellij.jupyter.core",
"intellij.python.syntax",
"intellij.python.syntax.core"
"intellij.python.syntax.core",
"intellij.python.community.deprecated.extensions"
)
const val pythonCommunityName: String = "python-ce"
......
......@@ -21,13 +21,17 @@ The Python plug-in provides smart editing for Python scripts. The feature set of
<plugin id="com.intellij.modules.python-core-capable"/>
</dependencies>
<!-- Declare that we support python -->
<module value="com.intellij.modules.python"/>
<!-- Python bundled modules for content -->
<xi:include href="/META-INF/python-v2-core-plugin-include.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/python-v2-core-plugin-content-include.xml" xpointer="xpointer(/idea-plugin/*)"/>
<content>
<!--Mini-IDes support community python only-->
<module name="intellij.python.community.plugin.minor"/> <!-- Python for Mini-IDEs-->
<module name="intellij.python.community.plugin.minor.rider"/> <!-- Python special support for Rider -->
<module name="intellij.python.community.impl.community_only"/> <!-- Community-specific code-->
<module name="intellij.python.community.deprecated.extensions"/><!-- backward comp -->
</content>
</idea-plugin>
<?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$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jetbrains-annotations" level="project" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.python.psi" />
<orderEntry type="module" module-name="intellij.python.psi.impl" />
<orderEntry type="module" module-name="intellij.python.sdk" />
<orderEntry type="module" module-name="intellij.python.community.core.impl" />
<orderEntry type="module" module-name="intellij.platform.indexing" />
</component>
</module>
\ No newline at end of file
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.extensions
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.GlobalSearchScope
import com.jetbrains.python.psi.resolve.PyQualifiedNameResolveContext
import com.jetbrains.python.psi.resolve.fromModule
import org.jetbrains.annotations.ApiStatus
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
class ModuleBasedContextAnchor(val module: Module) : ContextAnchor {
override val sdk: Sdk? = module.getSdk()
override val project: Project = module.project
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext = fromModule(module)
override val scope: GlobalSearchScope = module.moduleContentScope
override fun getRoots(): Array<VirtualFile> {
val manager = ModuleRootManager.getInstance(module)
return super.getRoots() + manager.contentRoots + manager.sourceRoots
}
}
\ No newline at end of file
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.extensions
import com.intellij.openapi.module.Module
......
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.extensions
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.vfs.VirtualFile
......@@ -38,22 +36,6 @@ interface ContextAnchor {
}
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
class ModuleBasedContextAnchor(val module: Module) : ContextAnchor {
override val sdk: Sdk? = module.getSdk()
override val project: Project = module.project
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext = fromModule(module)
override val scope: GlobalSearchScope = module.moduleContentScope
override fun getRoots(): Array<VirtualFile> {
val manager = ModuleRootManager.getInstance(module)
return super.getRoots() + manager.contentRoots + manager.sourceRoots
}
}
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
......@@ -104,7 +86,7 @@ fun QualifiedName.getRelativeNameTo(root: QualifiedName): QualifiedName? {
*/
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Moved to com.jetbrains.python")
class ProjectSdkContextAnchor(override val project: Project, override val sdk: Sdk?) : com.jetbrains.python.extensions.ContextAnchor {
class ProjectSdkContextAnchor(override val project: Project, override val sdk: Sdk?) : ContextAnchor {
override val qualifiedNameResolveContext: PyQualifiedNameResolveContext? = sdk?.let { fromSdk(project, it) }
override val scope: GlobalSearchScope = GlobalSearchScope.projectScope(project) //TODO: Check if project scope includes SDK
override fun getRoots(): Array<VirtualFile> {
......@@ -168,7 +150,6 @@ fun QualifiedName.getElementAndResolvableName(context: QNameResolveContext, stop
if (lastElement != null && element is PyClass) {
// Drill in class
//TODO: Support nested classes
val method = element.findMethodByName(lastElement, true, context.evalContext)
if (method != null) {
return NameAndElement(currentName.append(lastElement), method)
......
......@@ -2,8 +2,5 @@
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
@Deprecated(forRemoval = true)
package com.jetbrains.extensions;
import org.jetbrains.annotations.ApiStatus;
\ No newline at end of file
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.extensions.python;
......
......@@ -2,8 +2,6 @@
/**
* @deprecated moved to {@link com.jetbrains.python.extensions}
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
@Deprecated(forRemoval = true)
package com.jetbrains.extensions.python;
import org.jetbrains.annotations.ApiStatus;
\ No newline at end of file
<idea-plugin package="com.jetbrains.extensions">
<!--This module will be removed soon, do not use it-->
<dependencies>
<plugin id="com.intellij.modules.lang"/>
<module name="intellij.python.community.impl"/>
</dependencies>
</idea-plugin>
\ No newline at end of file
<idea-plugin>
<!--This is not a module, but a part of `plugin.xml` to be included-->
<dependencies>
<plugin id="com.intellij.modules.platform"/>
<plugin id="com.intellij.modules.lang"/>
</dependencies>
<!-- Declare that we support python -->
<module value="com.intellij.modules.python"/>
<!--This is not a module, but a part of `plugin.xml` to be included. Only content could be shared for now-->
<!--These modules are used both in Python Community and Prof-->
<content>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment