Introduce -Xintellij-plugin-root, deprecate CompilerJarLocator
This commit is contained in:
@@ -212,7 +212,10 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
||||
if (arguments.noInline) {
|
||||
configuration.put(CommonConfigurationKeys.DISABLE_INLINE, true);
|
||||
}
|
||||
|
||||
if (arguments.intellijPluginRoot != null) {
|
||||
configuration.put(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot);
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
CompilerJarLocator locator = services.get(CompilerJarLocator.class);
|
||||
if (locator != null) {
|
||||
configuration.put(CLIConfigurationKeys.COMPILER_JAR_LOCATOR, locator);
|
||||
|
||||
@@ -33,6 +33,9 @@ public class CLIConfigurationKeys {
|
||||
CompilerConfigurationKey.create("is API version explicit");
|
||||
|
||||
// Used in Eclipse plugin (see KotlinCLICompiler)
|
||||
public static final CompilerConfigurationKey<String> INTELLIJ_PLUGIN_ROOT =
|
||||
CompilerConfigurationKey.create("intellij plugin root");
|
||||
@SuppressWarnings("deprecation")
|
||||
public static final CompilerConfigurationKey<CompilerJarLocator> COMPILER_JAR_LOCATOR =
|
||||
CompilerConfigurationKey.create("compiler jar locator");
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @deprecated use the -Xintellij-plugin-root command line argument instead
|
||||
*/
|
||||
// TODO: drop as soon as Eclipse plugin starts using the new API
|
||||
@Deprecated
|
||||
public interface CompilerJarLocator {
|
||||
@NotNull
|
||||
File getCompilerJar();
|
||||
|
||||
@@ -435,8 +435,10 @@ class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
|
||||
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
|
||||
val locator = configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)
|
||||
var pluginRoot = if (locator == null) PathUtil.getPathUtilJar() else locator.compilerJar
|
||||
var pluginRoot =
|
||||
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
|
||||
?: configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)?.compilerJar
|
||||
?: PathUtil.getPathUtilJar()
|
||||
|
||||
val app = ApplicationManager.getApplication()
|
||||
val parentFile = pluginRoot.parentFile
|
||||
|
||||
Reference in New Issue
Block a user