Remove deprecated CompilerJarLocator

This commit is contained in:
Alexander Udalov
2018-07-07 12:18:52 +02:00
parent a44d70e79d
commit 9dc53c38f3
4 changed files with 2 additions and 47 deletions
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.cli.common.messages.GroupingMessageCollector;
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
import org.jetbrains.kotlin.cli.common.messages.MessageCollectorUtil;
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer;
import org.jetbrains.kotlin.cli.jvm.compiler.CompilerJarLocator;
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
import org.jetbrains.kotlin.config.CommonConfigurationKeysKt;
import org.jetbrains.kotlin.config.CompilerConfiguration;
@@ -80,7 +79,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
configuration.put(MESSAGE_COLLECTOR_KEY, groupingCollector);
configuration.put(CLIConfigurationKeys.PERF_MANAGER, performanceManager);
try {
setupCommonArgumentsAndServices(configuration, arguments, services);
setupCommonArguments(configuration, arguments);
setupPlatformSpecificArgumentsAndServices(configuration, arguments, services);
KotlinPaths paths = computeKotlinPaths(groupingCollector, arguments);
if (groupingCollector.hasErrors()) {
@@ -138,9 +137,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
}
}
private void setupCommonArgumentsAndServices(
@NotNull CompilerConfiguration configuration, @NotNull A arguments, @NotNull Services services
) {
private void setupCommonArguments(@NotNull CompilerConfiguration configuration, @NotNull A arguments) {
if (arguments.getNoInline()) {
configuration.put(CommonConfigurationKeys.DISABLE_INLINE, true);
}
@@ -162,12 +159,6 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
}
}
@SuppressWarnings("deprecation")
CompilerJarLocator locator = services.get(CompilerJarLocator.class);
if (locator != null) {
configuration.put(CLIConfigurationKeys.COMPILER_JAR_LOCATOR, locator);
}
setupLanguageVersionSettings(configuration, arguments);
}
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.cli.common;
import org.jetbrains.kotlin.cli.common.config.ContentRoot;
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
import org.jetbrains.kotlin.cli.jvm.compiler.CompilerJarLocator;
import org.jetbrains.kotlin.config.CompilerConfigurationKey;
import java.io.File;
@@ -39,9 +38,6 @@ public class CLIConfigurationKeys {
// 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");
// See K2MetadataCompilerArguments
@@ -1,31 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.cli.jvm.compiler;
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();
}
@@ -621,7 +621,6 @@ class KotlinCoreEnvironment private constructor(
val pluginRoot =
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
?: configuration.get(CLIConfigurationKeys.COMPILER_JAR_LOCATOR)?.compilerJar
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
?: File("idea/src").takeIf { it.hasConfigFile(configFilePath) }