Added "Additional command line parameters" to the Kotlin Compiler Settings tab.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.jet.compiler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AdditionalCompilerSettings {
|
||||
private static final String DEFAULT_ADDITIONAL_ARGUMENTS = "-version -printArgs";
|
||||
|
||||
@NotNull
|
||||
private String additionalArguments = DEFAULT_ADDITIONAL_ARGUMENTS;
|
||||
|
||||
@NotNull
|
||||
public String getAdditionalArguments() {
|
||||
return additionalArguments;
|
||||
}
|
||||
|
||||
public void setAdditionalArguments(@NotNull String additionalArguments) {
|
||||
this.additionalArguments = additionalArguments;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class SettingConstants {
|
||||
public static final String KOTLIN_COMMON_COMPILER_SETTINGS_SECTION = "KotlinCommonCompilerSettings";
|
||||
public static final String KOTLIN_TO_JS_COMPILER_SETTINGS_SECTION = "Kotlin2JsCompilerSettings";
|
||||
public static final String KOTLIN_TO_JVM_COMPILER_SETTINGS_SECTION = "Kotlin2JvmCompilerSettings";
|
||||
public static final String KOTLIN_ADDITIONAL_COMPILER_SETTINGS_SECTION = "KotlinAdditionalCompilerSettings";
|
||||
|
||||
public static final String KOTLIN_COMPILER_SETTINGS_FILE = "kotlinc.xml";
|
||||
public static final String KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + KOTLIN_COMPILER_SETTINGS_FILE;
|
||||
|
||||
+10
-4
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.compiler.runner;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -29,6 +30,7 @@ import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation;
|
||||
import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollectorUtil;
|
||||
import org.jetbrains.jet.compiler.AdditionalCompilerSettings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
@@ -43,6 +45,7 @@ public class KotlinCompilerRunner {
|
||||
public static void runK2JvmCompiler(
|
||||
CommonCompilerArguments commonArguments,
|
||||
K2JVMCompilerArguments k2jvmArguments,
|
||||
AdditionalCompilerSettings additionalSettings,
|
||||
MessageCollector messageCollector,
|
||||
CompilerEnvironment environment,
|
||||
File moduleFile,
|
||||
@@ -51,12 +54,14 @@ public class KotlinCompilerRunner {
|
||||
K2JVMCompilerArguments arguments = mergeBeans(commonArguments, k2jvmArguments);
|
||||
setupK2JvmSettings(moduleFile, arguments);
|
||||
|
||||
runCompiler(K2JVM_COMPILER, arguments, DEFAULT_K2JVM_ARGUMENTS, messageCollector, collector, environment);
|
||||
runCompiler(K2JVM_COMPILER, arguments, additionalSettings.getAdditionalArguments(),
|
||||
DEFAULT_K2JVM_ARGUMENTS, messageCollector, collector, environment);
|
||||
}
|
||||
|
||||
public static void runK2JsCompiler(
|
||||
CommonCompilerArguments commonArguments,
|
||||
K2JSCompilerArguments k2jsArguments,
|
||||
AdditionalCompilerSettings additionalSettings,
|
||||
MessageCollector messageCollector,
|
||||
CompilerEnvironment environment,
|
||||
OutputItemsCollector collector,
|
||||
@@ -67,18 +72,21 @@ public class KotlinCompilerRunner {
|
||||
K2JSCompilerArguments arguments = mergeBeans(commonArguments, k2jsArguments);
|
||||
setupK2JsSettings(outputFile, sourceFiles, libraryFiles, arguments);
|
||||
|
||||
runCompiler(K2JS_COMPILER, arguments, DEFAULT_K2JS_ARGUMENTS, messageCollector, collector, environment);
|
||||
runCompiler(K2JS_COMPILER, arguments, additionalSettings.getAdditionalArguments(),
|
||||
DEFAULT_K2JS_ARGUMENTS, messageCollector, collector, environment);
|
||||
}
|
||||
|
||||
private static void runCompiler(
|
||||
final String compilerClassName,
|
||||
CommonCompilerArguments arguments,
|
||||
String additionalArguments,
|
||||
CommonCompilerArguments defaultArguments,
|
||||
final MessageCollector messageCollector,
|
||||
OutputItemsCollector collector,
|
||||
final CompilerEnvironment environment
|
||||
) {
|
||||
final List<String> argumentsList = ArgumentUtils.convertArgumentsToStringList(arguments, defaultArguments);
|
||||
argumentsList.addAll(StringUtil.split(additionalArguments, " "));
|
||||
|
||||
CompilerRunnerUtil.outputCompilerMessagesAndHandleExitCode(messageCollector, collector, new Function<PrintStream, Integer>() {
|
||||
@Override
|
||||
@@ -125,8 +133,6 @@ public class KotlinCompilerRunner {
|
||||
private static void setupCommonSettings(CommonCompilerArguments settings) {
|
||||
settings.tags = true;
|
||||
settings.verbose = true;
|
||||
settings.version = true;
|
||||
settings.printArgs = true;
|
||||
}
|
||||
|
||||
private static void setupK2JvmSettings(
|
||||
|
||||
Reference in New Issue
Block a user