Introduce -Xintellij-plugin-root, deprecate CompilerJarLocator

This commit is contained in:
Alexander Udalov
2017-04-07 00:09:00 +03:00
parent ce6676baa8
commit 072f87ddab
7 changed files with 25 additions and 3 deletions
@@ -93,6 +93,13 @@ public abstract class CommonCompilerArguments implements Serializable {
@Argument(value = "-Xno-check-impl", description = "Do not check presence of 'impl' modifier in multi-platform projects")
public boolean noCheckImpl;
@Argument(
value = "-Xintellij-plugin-root",
valueDescription = "<path>",
description = "Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found"
)
public String intellijPluginRoot;
@Argument(
value = "-Xcoroutines",
valueDescription = "{enable|warn|error}",
@@ -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
+1
View File
@@ -8,6 +8,7 @@ where advanced options include:
-Xplugin=<path> Load plugins from the given classpath
-Xmulti-platform Enable experimental language support for multi-platform projects
-Xno-check-impl Do not check presence of 'impl' modifier in multi-platform projects
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
-Xcoroutines={enable|warn|error}
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
+1
View File
@@ -20,6 +20,7 @@ where advanced options include:
-Xplugin=<path> Load plugins from the given classpath
-Xmulti-platform Enable experimental language support for multi-platform projects
-Xno-check-impl Do not check presence of 'impl' modifier in multi-platform projects
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
-Xcoroutines={enable|warn|error}
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier