Add CompilerConfiguration to JsConfig

Will be used to store common compiler options (such as source version, inline
disabled, etc) as well as JS-specific options, to unify the logic of compiler
option initialization between JS and JVM compilers
This commit is contained in:
Alexander Udalov
2016-05-23 18:45:52 +03:00
parent 116e4a5ced
commit 6889bdbef8
7 changed files with 42 additions and 18 deletions
@@ -119,7 +119,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
File outputFile = new File(arguments.outputFile);
JsConfig config = getConfig(arguments, project);
JsConfig config = getConfig(project, configuration, arguments);
if (config.checkLibFilesAndReportErrors(new Function1<String, Unit>() {
@Override
public Unit invoke(String message) {
@@ -245,7 +245,11 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
}
@NotNull
private static JsConfig getConfig(@NotNull K2JSCompilerArguments arguments, @NotNull Project project) {
private static JsConfig getConfig(
@NotNull Project project,
@NotNull CompilerConfiguration configuration,
@NotNull K2JSCompilerArguments arguments
) {
if (arguments.target != null) {
assert arguments.target == "v5" : "Unsupported ECMA version: " + arguments.target;
}
@@ -262,7 +266,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
ContainerUtil.addAllNotNull(libraryFiles, arguments.libraryFiles);
}
return new LibrarySourcesConfig.Builder(project, moduleId, libraryFiles)
return new LibrarySourcesConfig.Builder(project, configuration, moduleId, libraryFiles)
.ecmaVersion(ecmaVersion)
.sourceMap(arguments.sourceMap)
.inlineEnabled(inlineEnabled)