IJPL-961 get rid of grpc - do not include into core

GitOrigin-RevId: d65d2ea5e98fe910ae02ec50b5ef2a5d0aa7abb1
This commit is contained in:
Vladimir Krivosheev
2024-04-02 18:00:14 +03:00
committed by intellij-monorepo-bot
parent 17b40dc523
commit d73cc76758
18 changed files with 111 additions and 70 deletions

1
.idea/modules.xml generated
View File

@@ -855,6 +855,7 @@
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" filepath="$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/laf/macos/intellij.laf.macos.iml" filepath="$PROJECT_DIR$/plugins/laf/macos/intellij.laf.macos.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/laf/win10/intellij.laf.win10.iml" filepath="$PROJECT_DIR$/plugins/laf/win10/intellij.laf.win10.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/libraries/grpc/intellij.libraries.grpc.iml" filepath="$PROJECT_DIR$/platform/libraries/grpc/intellij.libraries.grpc.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/lombok/intellij.lombok.iml" filepath="$PROJECT_DIR$/plugins/lombok/intellij.lombok.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/lombok/generated/intellij.lombok.generated.iml" filepath="$PROJECT_DIR$/plugins/lombok/generated/intellij.lombok.generated.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/markdown/core/intellij.markdown.iml" filepath="$PROJECT_DIR$/plugins/markdown/core/intellij.markdown.iml" />

View File

@@ -333,7 +333,7 @@ object CommunityRepositoryModules {
additionalModulesToJars: Map<String, String> = emptyMap(),
allPlatforms: Boolean,
addition: ((PluginLayout.PluginLayoutSpec) -> Unit)?): PluginLayout =
plugin(mainModuleName) { spec ->
plugin(mainModuleName, auto = true) { spec ->
spec.directoryName = "android"
spec.mainJarName = "android.jar"
spec.withCustomVersion(object : PluginLayout.VersionEvaluator {
@@ -349,6 +349,8 @@ object CommunityRepositoryModules {
}
})
spec.excludeProjectLibrary("Gradle")
// modules:
// adt-ui.jar
//spec.withModule("intellij.android.adt.ui.compose", "adt-ui.jar")
@@ -379,10 +381,10 @@ object CommunityRepositoryModules {
spec.withModule("intellij.android.kotlin.output.parser", "android-kotlin.jar")
// android-profilers.jar
spec. withModule("intellij.android.profilers.atrace", "android-profilers.jar")
spec. withModule("intellij.android.profilers.ui", "android-profilers.jar")
spec. withModule("intellij.android.profilers", "android-profilers.jar")
spec. withModule("intellij.android.transportDatabase", "android-profilers.jar")
spec.withModule("intellij.android.profilers.atrace", "android-profilers.jar")
spec.withModule("intellij.android.profilers.ui", "android-profilers.jar")
spec.withModule("intellij.android.profilers", "android-profilers.jar")
spec.withModule("intellij.android.transportDatabase", "android-profilers.jar")
// android-rt.jar
//tools/adt/idea/rt:intellij.android.rt <= REMOVED

View File

@@ -84,8 +84,6 @@ private val predefinedMergeRules = HashMap<String, (String, JetBrainsClientModul
map.put("groovy.jar") { it, _ -> it.startsWith("org.codehaus.groovy:") }
map.put("jsch-agent.jar") { it, _ -> it.startsWith("jsch-agent") }
map.put(rdJarName) { it, _ -> it.startsWith("rd-") }
// all grpc garbage into one jar
map.put("grpc.jar") { it, _ -> it.startsWith("grpc-") }
// separate file to use in Gradle Daemon classpath
map.put("opentelemetry.jar") { it, _ -> it == "opentelemetry" || it == "opentelemetry-semconv" || it.startsWith("opentelemetry-exporter-otlp") }
map.put("bouncy-castle.jar") { it, _ -> it.startsWith("bouncy-castle-") }
@@ -431,7 +429,7 @@ class JarPackager private constructor(
asset: AssetDescriptor,
) {
val moduleName = module.name
val includeProjectLib = layout is PluginLayout && layout.auto
val includeProjectLib = if (layout is PluginLayout) layout.auto else item.reason == ModuleIncludeReasons.PRODUCT_MODULES
val excluded = (layout.excludedLibraries.get(moduleName) ?: emptyList()) + (layout.excludedLibraries.get(null) ?: emptyList())
for (element in helper.getLibraryDependencies(module)) {

View File

@@ -265,28 +265,53 @@ internal suspend fun createPlatformLayout(addPlatformCoverage: Boolean,
addModule("cds/classesLogAgent.jar", listOf("intellij.platform.cdsAgent"), productLayout = productLayout, layout = layout)
val productPluginSourceModuleName = context.productProperties.productPluginSourceModuleName
?: context.productProperties.applicationInfoModule
val productPluginContentModules = getProductPluginContentModules(context = context,
productPluginSourceModuleName = productPluginSourceModuleName)
val productPluginContentModules = getProductPluginContentModules(
context = context,
productPluginSourceModuleName = productPluginSourceModuleName,
)
val explicit = mutableListOf<ModuleItem>()
for (moduleName in productLayout.productImplementationModules) {
if (productLayout.excludedModuleNames.contains(moduleName)) {
continue
}
explicit.add(ModuleItem(moduleName = moduleName,
relativeOutputFile = when {
isModuleCloseSource(moduleName, context = context) -> {
if (jetBrainsClientModuleFilter.isModuleIncluded(moduleName)) PRODUCT_CLIENT_JAR else PRODUCT_JAR
}
else -> PlatformJarNames.getPlatformModuleJarName(moduleName, context)
},
reason = "productImplementationModules"))
explicit.add(
ModuleItem(
moduleName = moduleName,
relativeOutputFile = when {
isModuleCloseSource(moduleName, context = context) -> {
if (jetBrainsClientModuleFilter.isModuleIncluded(moduleName)) PRODUCT_CLIENT_JAR else PRODUCT_JAR
}
else -> PlatformJarNames.getPlatformModuleJarName(moduleName, context)
},
reason = "productImplementationModules",
)
)
}
explicit.addAll(toModuleItemSequence(PLATFORM_API_MODULES, productLayout = productLayout, reason = "PLATFORM_API_MODULES", context))
explicit.addAll(toModuleItemSequence(PLATFORM_IMPLEMENTATION_MODULES, productLayout = productLayout, reason = "PLATFORM_IMPLEMENTATION_MODULES",
context))
explicit.addAll(toModuleItemSequence(productLayout.productApiModules, productLayout = productLayout, reason = "productApiModules",
context))
explicit.addAll(
toModuleItemSequence(
list = PLATFORM_API_MODULES,
productLayout = productLayout,
reason = "PLATFORM_API_MODULES",
context = context,
)
)
explicit.addAll(
toModuleItemSequence(
list = PLATFORM_IMPLEMENTATION_MODULES,
productLayout = productLayout,
reason = "PLATFORM_IMPLEMENTATION_MODULES",
context = context
)
)
explicit.addAll(
toModuleItemSequence(
list = productLayout.productApiModules,
productLayout = productLayout,
reason = "productApiModules",
context = context,
)
)
if (addPlatformCoverage) {
explicit.add(ModuleItem(moduleName = "intellij.platform.coverage", relativeOutputFile = APP_JAR, reason = "coverage"))
}
@@ -490,39 +515,36 @@ private suspend fun getProductPluginContentModules(context: BuildContext, produc
withContext(Dispatchers.IO) {
var file = context.findFileInModuleSources(productPluginSourceModuleName, "META-INF/plugin.xml")
if (file == null) {
file = context.findFileInModuleSources(moduleName = productPluginSourceModuleName,
relativePath = "META-INF/${context.productProperties.platformPrefix}Plugin.xml")
file = context.findFileInModuleSources(
moduleName = productPluginSourceModuleName,
relativePath = "META-INF/${context.productProperties.platformPrefix}Plugin.xml",
)
if (file == null) {
Span.current().addEvent("Cannot find product plugin descriptor in '$productPluginSourceModuleName' module")
return@withContext null
}
}
readXmlAsModel(file).getChild("content")
}?.let { content ->
collectProductModules(content, result)
readXmlAsModel(file)
}?.let { root ->
collectProductModules(root = root, result = result, context = context)
}
withContext(Dispatchers.IO) {
val file = context.findFileInModuleSources("intellij.platform.resources", "META-INF/PlatformLangPlugin.xml")
file?.let { readXmlAsModel(it).getChild("content") }
file?.let { readXmlAsModel(it) }
}?.let {
collectProductModules(it, result)
collectProductModules(root = it, result = result, context = context)
}
return result
}
private fun collectProductModules(content: XmlElement, result: LinkedHashSet<ModuleItem>) {
for (module in content.children("module")) {
private fun collectProductModules(root: XmlElement, result: LinkedHashSet<ModuleItem>, context: BuildContext) {
for (module in (root.getChild("content")?.children("module") ?: emptySequence())) {
val moduleName = module.attributes.get("name") ?: continue
result.add(
ModuleItem(
moduleName = moduleName,
relativeOutputFile = "modules/$moduleName.jar",
reason = ModuleIncludeReasons.PRODUCT_MODULES
),
ModuleItem(moduleName = moduleName, relativeOutputFile = "modules/$moduleName.jar", reason = ModuleIncludeReasons.PRODUCT_MODULES),
)
}
}

View File

@@ -98,8 +98,8 @@ class PluginLayout private constructor(
* @param mainModuleName name of the module containing META-INF/plugin.xml file of the plugin
*/
@JvmStatic
fun plugin(mainModuleName: String, body: (PluginLayoutSpec) -> Unit): PluginLayout {
val layout = PluginLayout(mainModuleName)
fun plugin(mainModuleName: String, auto: Boolean = false, body: (PluginLayoutSpec) -> Unit): PluginLayout {
val layout = PluginLayout(mainModuleName, auto = auto)
val spec = PluginLayoutSpec(layout)
body(spec)

View File

@@ -133,7 +133,7 @@ class ClassLoaderConfigurator(
configureDependenciesInOldFormat(module, mainDependentClassLoader)
}
else {
if (module.packagePrefix == null) {
if (module.packagePrefix == null && module.pluginId != PluginManagerCore.CORE_ID) {
throw PluginException("Package is not specified (module=$module)", module.pluginId)
}
@@ -200,7 +200,7 @@ class ClassLoaderConfigurator(
classPath = ClassPath(jarFiles, DEFAULT_CLASSLOADER_CONFIGURATION, resourceFileFactory, false),
parents = deps,
pluginDescriptor = module,
coreLoader = coreLoader,
coreLoader = if (module.isDependentOnCoreClassLoader) coreLoader else coreLoader.parent,
resolveScopeManager = null,
packagePrefix = module.packagePrefix,
libDirectories = ArrayList(),

View File

@@ -46,6 +46,7 @@ class IdeaPluginDescriptorImpl(
id: PluginId?,
@JvmField val moduleName: String?,
@JvmField val useCoreClassLoader: Boolean = false,
@JvmField var isDependentOnCoreClassLoader: Boolean = true,
) : IdeaPluginDescriptor {
private val id: PluginId = id ?: PluginId.getId(raw.id ?: raw.name ?: throw RuntimeException("Neither id nor name are specified"))
private val name = raw.name ?: id?.idString ?: raw.id
@@ -208,6 +209,7 @@ class IdeaPluginDescriptorImpl(
id = id,
moduleName = moduleName,
useCoreClassLoader = useCoreClassLoader,
isDependentOnCoreClassLoader = raw.isDependentOnCoreClassLoader,
)
context.debugData?.recordDescriptorPath(descriptor = result, rawPluginDescriptor = raw, path = descriptorPath)
result.descriptorPath = descriptorPath

View File

@@ -105,11 +105,7 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
}
}
return object : ModuleGraphBase(
modules,
directDependencies,
directDependents,
) {}
return object : ModuleGraphBase(modules = modules, directDependencies = directDependencies, directDependents = directDependents) {}
}
private fun toCoreAwareComparator(comparator: Comparator<IdeaPluginDescriptorImpl>): Comparator<IdeaPluginDescriptorImpl> {
@@ -159,8 +155,11 @@ private fun copySorted(
*/
private fun getImplicitDependency(descriptor: IdeaPluginDescriptorImpl,
idMap: Map<String, IdeaPluginDescriptorImpl>): IdeaPluginDescriptorImpl? {
// skip our plugins as expected to be up-to-date whether bundled or not
if (descriptor.isBundled || descriptor.packagePrefix != null || descriptor.implementationDetail) {
// skip our plugins as expected to be up to date whether bundled or not
if (descriptor.isBundled ||
descriptor.packagePrefix != null ||
descriptor.implementationDetail ||
descriptor.content.modules.isNotEmpty()) {
return null
}

View File

@@ -34,6 +34,8 @@ class RawPluginDescriptor {
@JvmField internal var implementationDetail: Boolean = false
@JvmField internal var isRestartRequired: Boolean = false
@JvmField internal var isLicenseOptional: Boolean = false
// makes sense only for product modules for now
@JvmField internal var isDependentOnCoreClassLoader: Boolean = true
@JvmField internal var productCode: String? = null
@JvmField internal var releaseDate: LocalDate? = null

View File

@@ -152,6 +152,7 @@ private fun readRootAttributes(reader: XMLStreamReader2, descriptor: RawPluginDe
"allow-bundled-update" -> descriptor.isBundledUpdateAllowed = reader.getAttributeAsBoolean(i)
IMPLEMENTATION_DETAIL_ATTRIBUTE -> descriptor.implementationDetail = reader.getAttributeAsBoolean(i)
"require-restart" -> descriptor.isRestartRequired = reader.getAttributeAsBoolean(i)
"dependent-on-core" -> descriptor.isDependentOnCoreClassLoader = reader.getAttributeAsBoolean(i)
"version" -> {
// internalVersionString - why it is not used, but just checked?
getNullifiedAttributeValue(reader, i)?.let {

View File

@@ -61,13 +61,15 @@ private var logStream: Writer? = null
private val parentListCacheIdCounter = AtomicInteger()
@ApiStatus.Internal
class PluginClassLoader(classPath: ClassPath,
private val parents: Array<IdeaPluginDescriptorImpl>,
private val pluginDescriptor: PluginDescriptor,
private val coreLoader: ClassLoader,
resolveScopeManager: ResolveScopeManager?,
packagePrefix: String?,
private val libDirectories: MutableList<String>) : UrlClassLoader(classPath), PluginAwareClassLoader {
class PluginClassLoader(
classPath: ClassPath,
private val parents: Array<IdeaPluginDescriptorImpl>,
private val pluginDescriptor: PluginDescriptor,
private val coreLoader: ClassLoader,
resolveScopeManager: ResolveScopeManager?,
packagePrefix: String?,
private val libDirectories: MutableList<String>,
) : UrlClassLoader(classPath), PluginAwareClassLoader {
// cache of a computed list of all parents (not only direct)
@Volatile
private var allParents: Array<ClassLoader>? = null

View File

@@ -10,12 +10,12 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
<orderEntry type="library" name="grpc-core" level="project" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.client" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.daemon" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.common" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
<orderEntry type="library" name="jna" level="project" />
<orderEntry type="module" module-name="intellij.libraries.grpc" />
</component>
</module>

View File

@@ -13,10 +13,6 @@
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="library" name="protobuf" level="project" />
<orderEntry type="library" name="grpc-core" level="project" />
<orderEntry type="library" name="grpc-stub" level="project" />
<orderEntry type="library" name="grpc-protobuf" level="project" />
<orderEntry type="library" name="grpc-kotlin-stub" level="project" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.daemon" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.common" />
<orderEntry type="module" module-name="intellij.platform.util" />
@@ -42,5 +38,6 @@
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module" module-name="intellij.libraries.grpc" />
</component>
</module>

View File

@@ -15,10 +15,6 @@
<orderEntry type="library" name="jetbrains-annotations" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="library" name="protobuf" level="project" />
<orderEntry type="library" name="grpc-core" level="project" />
<orderEntry type="library" name="grpc-stub" level="project" />
<orderEntry type="library" name="grpc-protobuf" level="project" />
<orderEntry type="library" name="grpc-kotlin-stub" level="project" />
<orderEntry type="library" name="javax.annotation-api" level="project" />
<orderEntry type="library" scope="TEST" name="JUnit5" level="project" />
<orderEntry type="module-library" scope="TEST">
@@ -55,5 +51,6 @@
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module" module-name="intellij.libraries.grpc" />
</component>
</module>

View File

@@ -1 +1,5 @@
<idea-plugin package="com.intellij.execution.process.mediator.common"/>
<idea-plugin package="com.intellij.execution.process.mediator.common">
<dependencies>
<module name="intellij.libraries.grpc"/>
</dependencies>
</idea-plugin>

View File

@@ -13,12 +13,9 @@
<orderEntry type="library" name="jetbrains-annotations" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="library" name="protobuf" level="project" />
<orderEntry type="library" name="grpc-core" level="project" />
<orderEntry type="library" name="grpc-stub" level="project" />
<orderEntry type="library" name="grpc-protobuf" level="project" />
<orderEntry type="library" name="grpc-netty-shaded" level="project" />
<orderEntry type="library" name="grpc-kotlin-stub" level="project" />
<orderEntry type="library" name="jna" level="project" />
<orderEntry type="module" module-name="intellij.execution.process.mediator.common" />
<orderEntry type="module" module-name="intellij.libraries.grpc" />
</component>
</module>

View File

@@ -0,0 +1,15 @@
<?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" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="grpc-core" level="project" />
<orderEntry type="library" exported="" name="grpc-stub" level="project" />
<orderEntry type="library" exported="" name="grpc-kotlin-stub" level="project" />
<orderEntry type="library" exported="" name="grpc-protobuf" level="project" />
</component>
</module>

View File

@@ -0,0 +1,2 @@
<idea-plugin dependent-on-core="false">
</idea-plugin>