[json] extract explicit main module from plugin.xml for JSON plugin (IJPL-176240)

This is needed to enable automatic layout and to allow merging two JSON plugins to a single one. Also, this is needed to allow adding dependency on JSON from the unified YAML plugin.

'intellij.json' is registered as an embedded content module, so it uses the main plugin classloader, and now has a dependency on 'intellij.json.split' module. This ensures that classes from both modules are available to content modules from other plugins which declare dependency on JSON plugin as before.

After this change, build scripts don't put intellij.toml.json to a separate JAR anymore, and an explicit adjustment is needed in the Wiremock plugin's layout to avoid creating an unnecessary separate JAR.

GitOrigin-RevId: be77513b7f0c1e397b4f6dda7524aa6978fa2a90
This commit is contained in:
Nikolay Chashnikov
2025-02-07 12:42:10 +01:00
committed by intellij-monorepo-bot
parent 9ab7236e56
commit 2d050772a0
7 changed files with 39 additions and 33 deletions

View File

@@ -19,6 +19,7 @@
<orderEntry type="module" module-name="intellij.platform.ide.core.impl" />
<orderEntry type="library" name="gson" level="project" />
<orderEntry type="module" module-name="intellij.regexp" />
<orderEntry type="module" module-name="intellij.platform.backend" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.platform.indexing.impl" />
<orderEntry type="module" module-name="intellij.platform.refactoring" />
<orderEntry type="module" module-name="intellij.platform.statistics" />

View File

@@ -1,9 +1,9 @@
- name: lib/frontend-split/json-frontend.jar
modules:
- name: intellij.json.frontend
- name: lib/json-split.jar
modules:
- name: intellij.json.split
- name: lib/json.jar
modules:
- name: intellij.json
contentModules:
- name: intellij.json
- name: lib/modules/intellij.json.split.jar
contentModules:
- name: intellij.json.split

View File

@@ -0,0 +1,22 @@
<idea-plugin>
<name>JSON</name>
<!-- The plugin id is intentionally kept equal to its main module id
because historically the module was bundled into the platform,
and dependent plugins used only module dependency -->
<id>com.intellij.modules.json</id>
<vendor>JetBrains</vendor>
<category>Languages</category>
<description><![CDATA[
Provides syntax highlighting and editor features for
<a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON">JSON</a> and
<a href="https://json-schema.org/overview/what-is-jsonschema">JSON Schema</a> languages
]]></description>
<dependencies>
<plugin id="com.intellij.modules.lang"/>
</dependencies>
<content>
<module name="intellij.json.split" loading="required"/>
<module name="intellij.json" loading="embedded"/>
</content>
</idea-plugin>

View File

@@ -1,24 +1,8 @@
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- No package, there are two top level packages available :( -->
<name>JSON</name>
<!-- The plugin id is intentionally kept equal to its main module id
because historically the module was bundled into the platform,
and dependent plugins used only module dependency -->
<id>com.intellij.modules.json</id>
<vendor>JetBrains</vendor>
<category>Languages</category>
<description><![CDATA[
Provides syntax highlighting and editor features for
<a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON">JSON</a> and
<a href="https://json-schema.org/overview/what-is-jsonschema">JSON Schema</a> languages
]]></description>
<idea-plugin>
<dependencies>
<plugin id="com.intellij.modules.lang"/>
<module name="intellij.json.split"/>
</dependencies>
<!--todo employ embedded/required content module feature when IJPL-164312 is fixed-->
<xi:include href="/intellij.json.split.xml" xpointer="xpointer(/idea-plugin/*)"/>
<actions resource-bundle="messages.JsonBundle">
<action id="JsonCopyPointer" class="com.intellij.json.editor.JsonCopyPointerAction">
<add-to-group group-id="CutCopyPasteGroup" anchor="after" relative-to-action="CopyReference"/>
@@ -86,7 +70,7 @@
<localInspection language="JSON" shortName="JsonSchemaRefReference"
bundle="messages.JsonBundle" key="json.schema.ref.refs.inspection.name" groupKey="json.inspection.group"
enabledByDefault="true" level="WARNING"
implementationClass="com.jetbrains.jsonSchema.impl.inspections.JsonSchemaRefReferenceInspection" />
implementationClass="com.jetbrains.jsonSchema.impl.inspections.JsonSchemaRefReferenceInspection"/>
<projectService serviceImplementation="com.jetbrains.jsonSchema.JsonSchemaMappingsProjectConfiguration"/>
<projectConfigurable groupId="preferences.externalResources" id="settings.json.schema"
@@ -110,7 +94,8 @@
<psi.referenceContributor language="JSON" implementation="com.jetbrains.jsonSchema.impl.JsonSchemaReferenceContributor"/>
<multiHostInjector implementation="com.jetbrains.jsonSchema.impl.JsonSchemaRegexInjector"/>
<multiHostInjector implementation="com.jetbrains.jsonSchema.impl.JsonSchemaBasedLanguageInjector"/>
<gotoDeclarationHandler id="JsonSchemaGotoDeclarationHandler" implementation="com.jetbrains.jsonSchema.impl.JsonSchemaGotoDeclarationHandler"/>
<gotoDeclarationHandler id="JsonSchemaGotoDeclarationHandler"
implementation="com.jetbrains.jsonSchema.impl.JsonSchemaGotoDeclarationHandler"/>
<highlightVisitor implementation="com.intellij.json.highlighting.JsonRainbowVisitor"/>
<intentionAction>
<language>JSON</language>
@@ -145,7 +130,7 @@
<extensions defaultExtensionNs="com.intellij.json">
<jsonLikePsiWalkerFactory implementation="com.intellij.json.json5.Json5PsiWalkerFactory"/>
<jsonSchemaEnabler implementation="com.jetbrains.jsonSchema.impl.JsonSchemaInJsonFilesEnabler" />
<jsonSchemaEnabler implementation="com.jetbrains.jsonSchema.impl.JsonSchemaInJsonFilesEnabler"/>
</extensions>
<extensionPoints>

View File

@@ -3,8 +3,11 @@ package com.intellij.json.split
import com.intellij.json.JsonLanguage
import com.intellij.json.formatter.JsonCodeStyleSettings
import com.intellij.openapi.extensions.InternalIgnoreDependencyViolation
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomDataSynchronizer
//todo split on two separate classes for the backend and the frontend
@InternalIgnoreDependencyViolation
class JsonCodeStyleSettingsCustomDataSynchronizer : CodeStyleSettingsCustomDataSynchronizer<JsonCodeStyleSettings>() {
override val language
get() = JsonLanguage.INSTANCE

View File

@@ -26,9 +26,6 @@ object CommunityRepositoryModules {
* Specifies non-trivial layout for all plugins that sources are located in 'community' and 'contrib' repositories
*/
val COMMUNITY_REPOSITORY_PLUGINS: PersistentList<PluginLayout> = persistentListOf(
pluginAuto("intellij.json") { spec ->
spec.withModule("intellij.json.split", "json-split.jar")
},
plugin("intellij.ant") { spec ->
spec.mainJarName = "antIntegration.jar"
spec.withModule("intellij.ant.jps", "ant-jps.jar")

View File

@@ -1,6 +1,3 @@
- name: lib/modules/intellij.toml.json.jar
contentModules:
- name: intellij.toml.json
- name: lib/toml-frontend.jar
modules:
- name: intellij.toml.core
@@ -9,4 +6,5 @@
modules:
- name: intellij.toml
contentModules:
- name: intellij.toml.json
- name: intellij.toml.grazie