Kotlin Facet: Add compiler settings to facet configuration

This commit is contained in:
Alexey Sedunov
2016-10-19 12:34:52 +03:00
parent 03f4d9f574
commit ea13456bba
10 changed files with 234 additions and 35 deletions
@@ -20,6 +20,7 @@ import com.intellij.util.SmartList;
import com.sampullara.cli.Argument;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.List;
public abstract class CommonCompilerArguments {
@@ -72,11 +73,44 @@ public abstract class CommonCompilerArguments {
public List<String> unknownExtraFlags = new SmartList<String>();
public CommonCompilerArguments() {
}
protected CommonCompilerArguments(CommonCompilerArguments arguments) {
this.languageVersion = arguments.languageVersion;
this.apiVersion = arguments.apiVersion;
this.suppressWarnings = arguments.suppressWarnings;
this.verbose = arguments.verbose;
this.version = arguments.version;
this.help = arguments.help;
this.extraHelp = arguments.extraHelp;
this.noInline = arguments.noInline;
this.repeat = arguments.repeat;
this.pluginClasspaths = arguments.pluginClasspaths != null ? Arrays.copyOf(arguments.pluginClasspaths, arguments.pluginClasspaths.length) : null;
this.pluginOptions = arguments.pluginOptions != null ? Arrays.copyOf(arguments.pluginOptions, arguments.pluginOptions.length) : null;
this.freeArgs.addAll(arguments.freeArgs);
this.unknownExtraFlags.addAll(arguments.unknownExtraFlags);
}
public abstract CommonCompilerArguments copy();
@NotNull
public String executableScriptFileName() {
return "kotlinc";
}
// Used only for serialize and deserialize settings. Don't use in other places!
public static final class DummyImpl extends CommonCompilerArguments {}
public static final class DummyImpl extends CommonCompilerArguments {
public DummyImpl() {
}
public DummyImpl(DummyImpl arguments) {
super(arguments);
}
@Override
public CommonCompilerArguments copy() {
return new DummyImpl(this);
}
}
}
@@ -20,6 +20,8 @@ import com.sampullara.cli.Argument;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CALL;
import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL;
@@ -73,6 +75,29 @@ public class K2JSCompilerArguments extends CommonCompilerArguments {
@ValueDescription("<path>")
public String outputPostfix;
public K2JSCompilerArguments() {
}
private K2JSCompilerArguments(K2JSCompilerArguments arguments) {
super(arguments);
this.outputFile = arguments.outputFile;
this.noStdlib = arguments.noStdlib;
this.libraryFiles = arguments.libraryFiles != null ? Arrays.copyOf(arguments.libraryFiles, arguments.libraryFiles.length) : null;
this.sourceMap = arguments.sourceMap;
this.metaInfo = arguments.metaInfo;
this.kjsm = arguments.kjsm;
this.target = arguments.target;
this.moduleKind = arguments.moduleKind;
this.main = arguments.main;
this.outputPrefix = arguments.outputPrefix;
this.outputPostfix = arguments.outputPostfix;
}
@Override
public K2JSCompilerArguments copy() {
return new K2JSCompilerArguments(this);
}
@Override
@NotNull
public String executableScriptFileName() {
@@ -107,6 +107,12 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
// Paths to output directories for friend modules.
public String[] friendPaths;
@Override
public CommonCompilerArguments copy() {
// No need to copy these arguments yet
throw new UnsupportedOperationException();
}
@Override
@NotNull
public String executableScriptFileName() {