Remove explicit registration of classFileDecompiler EP and core.xml
This commit is contained in:
committed by
TeamCityServer
parent
1b3046a61b
commit
ec99585eb9
@@ -1,12 +0,0 @@
|
||||
<idea-plugin>
|
||||
<id>org.jetbrains.kotlin</id>
|
||||
<version>1.2</version>
|
||||
|
||||
<!-- Don't add more extension points here! Logic in KotlinCoreEnvironment assumes that there is only one EP. -->
|
||||
<!-- And this file should be removed once 202 is no longer supported -->
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="com.intellij.psi.classFileDecompiler"
|
||||
interface="com.intellij.psi.compiled.ClassFileDecompilers$Decompiler"
|
||||
dynamic="true"/>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
@@ -538,11 +538,6 @@ class KotlinCoreEnvironment private constructor(
|
||||
val applicationEnvironment = KotlinCoreApplicationEnvironment.create(parentDisposable, unitTestMode)
|
||||
|
||||
registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/compiler.xml")
|
||||
// FIX ME WHEN BUNCH 202 REMOVED: this code is required to support compiler bundled to both 202 and 203.
|
||||
// Please, remove "com.intellij.psi.classFileDecompiler" EP registration once 202 is no longer supported by the compiler
|
||||
if (!ApplicationManager.getApplication().extensionArea.hasExtensionPoint("com.intellij.psi.classFileDecompiler")) {
|
||||
registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/core.xml")
|
||||
}
|
||||
|
||||
registerApplicationServicesForCLI(applicationEnvironment)
|
||||
registerApplicationServices(applicationEnvironment)
|
||||
|
||||
-1
@@ -88,7 +88,6 @@ public class JUnit3RunnerWithInnersForJPS extends Runner implements Filterable,
|
||||
*/
|
||||
private static void ensureCompilerExtensionFilesExists() {
|
||||
copyCompilerResourceFile("compiler.xml");
|
||||
copyCompilerResourceFile("core.xml");
|
||||
}
|
||||
|
||||
private static void copyCompilerResourceFile(String fileName) {
|
||||
|
||||
@@ -48,51 +48,11 @@ compilerDummyJar(compilerDummyForDependenciesRewriting("compilerDummy") {
|
||||
archiveClassifier.set("dummy")
|
||||
})
|
||||
|
||||
class CoreXmlShadingTransformer : Transformer {
|
||||
companion object {
|
||||
private const val XML_NAME = "META-INF/extensions/core.xml"
|
||||
}
|
||||
|
||||
@kotlin.jvm.Transient
|
||||
private var content: StringBuilder? = StringBuilder()
|
||||
|
||||
private fun ensureStringBuilderExist() {
|
||||
if (content == null) {
|
||||
content = StringBuilder()
|
||||
}
|
||||
}
|
||||
|
||||
override fun canTransformResource(element: FileTreeElement): Boolean {
|
||||
return (element.name == XML_NAME)
|
||||
}
|
||||
|
||||
override fun transform(context: TransformerContext) {
|
||||
ensureStringBuilderExist()
|
||||
val text = context.`is`.bufferedReader().lines()
|
||||
.map { it.replace("com.intellij.psi", "org.jetbrains.kotlin.com.intellij.psi") }
|
||||
.collect(Collectors.joining("\n"))
|
||||
content!!.appendln(text)
|
||||
context.`is`.close()
|
||||
}
|
||||
|
||||
override fun hasTransformedResource(): Boolean {
|
||||
return content?.isNotEmpty() ?: false
|
||||
}
|
||||
|
||||
override fun modifyOutputStream(outputStream: ZipOutputStream, preserveFileTimestamps: Boolean) {
|
||||
if (content == null) return
|
||||
val entry = ZipEntry(XML_NAME)
|
||||
outputStream.putNextEntry(entry)
|
||||
outputStream.write(content.toString().toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
val runtimeJar = runtimeJar(embeddableCompiler()) {
|
||||
exclude("com/sun/jna/**")
|
||||
exclude("org/jetbrains/annotations/**")
|
||||
mergeServiceFiles()
|
||||
|
||||
transform(CoreXmlShadingTransformer::class.java)
|
||||
}
|
||||
|
||||
sourcesJar()
|
||||
|
||||
Reference in New Issue
Block a user