Change core env and proguard config for compatibility with new gradle build
(the build.xml should be modified to support the proguard config in this form)
This commit is contained in:
@@ -109,6 +109,7 @@ import org.jetbrains.kotlin.script.ScriptDependenciesProvider
|
|||||||
import org.jetbrains.kotlin.script.ScriptReportSink
|
import org.jetbrains.kotlin.script.ScriptReportSink
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
class KotlinCoreEnvironment private constructor(
|
class KotlinCoreEnvironment private constructor(
|
||||||
parentDisposable: Disposable,
|
parentDisposable: Disposable,
|
||||||
@@ -482,20 +483,25 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
|
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
|
||||||
var pluginRoot =
|
|
||||||
|
fun File.hasConfigFile(configFile: String): Boolean =
|
||||||
|
if (isDirectory) File(this, "META-INF" + File.separator + configFile).exists()
|
||||||
|
else try {
|
||||||
|
ZipFile(this).use {
|
||||||
|
it.getEntry("META-INF/" + configFile) != null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e: Throwable) {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
val pluginRoot =
|
||||||
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
|
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
|
||||||
?: configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)?.compilerJar
|
?: configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)?.compilerJar
|
||||||
?: PathUtil.pathUtilJar
|
?: PathUtil.getPathUtilJar().takeIf { it.hasConfigFile(configFilePath) }
|
||||||
|
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
|
||||||
val app = ApplicationManager.getApplication()
|
?: File("idea/src").takeIf { it.hasConfigFile(configFilePath) }
|
||||||
val parentFile = pluginRoot.parentFile
|
?: throw IllegalStateException("Unable to find extension point configuration $configFilePath")
|
||||||
|
|
||||||
if (pluginRoot.isDirectory && app != null && app.isUnitTestMode
|
|
||||||
&& FileUtil.toCanonicalPath(parentFile.path).endsWith("out/production")) {
|
|
||||||
// hack for load extensions when compiler run directly from out directory(e.g. in tests)
|
|
||||||
val srcDir = parentFile.parentFile.parentFile
|
|
||||||
pluginRoot = File(srcDir, "idea/src")
|
|
||||||
}
|
|
||||||
|
|
||||||
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())
|
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -1,4 +1,4 @@
|
|||||||
-injars '<output>/kotlin-compiler-before-shrink.jar'(
|
-injars '<kotlin-compiler-jar-before-shrink>'(
|
||||||
!com/thoughtworks/xstream/converters/extended/ISO8601**,
|
!com/thoughtworks/xstream/converters/extended/ISO8601**,
|
||||||
!com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter**,
|
!com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter**,
|
||||||
!com/thoughtworks/xstream/io/xml/JDom**,
|
!com/thoughtworks/xstream/io/xml/JDom**,
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
|
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
|
||||||
messages/**)
|
messages/**)
|
||||||
|
|
||||||
-outjars '<kotlin-home>/lib/kotlin-compiler.jar'
|
-outjars '<kotlin-compiler-jar>'
|
||||||
|
|
||||||
-dontnote **
|
-dontnote **
|
||||||
-dontwarn com.intellij.util.ui.IsRetina*
|
-dontwarn com.intellij.util.ui.IsRetina*
|
||||||
@@ -58,13 +58,15 @@ messages/**)
|
|||||||
-dontwarn java.lang.invoke.MethodHandle
|
-dontwarn java.lang.invoke.MethodHandle
|
||||||
-dontwarn org.jline.builtins.Nano$Buffer
|
-dontwarn org.jline.builtins.Nano$Buffer
|
||||||
-dontwarn net.jpountz.lz4.LZ4Factory
|
-dontwarn net.jpountz.lz4.LZ4Factory
|
||||||
|
-dontwarn org.jetbrains.annotations.ReadOnly
|
||||||
|
-dontwarn org.jetbrains.annotations.Mutable
|
||||||
|
|
||||||
-libraryjars '<rtjar>'
|
#-libraryjars '<rtjar>'
|
||||||
-libraryjars '<jssejar>'
|
#-libraryjars '<jssejar>'
|
||||||
-libraryjars '<bootstrap.runtime>'
|
#-libraryjars '<bootstrap.runtime>'
|
||||||
-libraryjars '<bootstrap.reflect>'
|
#-libraryjars '<bootstrap.reflect>'
|
||||||
-libraryjars '<bootstrap.script.runtime>'
|
#-libraryjars '<bootstrap.script.runtime>'
|
||||||
-libraryjars '<tools.jar>'
|
#-libraryjars '<tools.jar>'
|
||||||
|
|
||||||
-dontoptimize
|
-dontoptimize
|
||||||
-dontobfuscate
|
-dontobfuscate
|
||||||
|
|||||||
Reference in New Issue
Block a user