CLI: drop "-tags" argument
It was only used for the compiler inside the IDE, and there we already invoke a special method which outputs HTML only
This commit is contained in:
-3
@@ -26,9 +26,6 @@ public abstract class CommonCompilerArguments {
|
|||||||
@Argument(value = "nowarn", description = "Generate no warnings")
|
@Argument(value = "nowarn", description = "Generate no warnings")
|
||||||
public boolean suppressWarnings;
|
public boolean suppressWarnings;
|
||||||
|
|
||||||
@Argument(value = "tags", description = "Demarcate each compilation message (error, warning, etc) with an open and close tag")
|
|
||||||
public boolean tags;
|
|
||||||
|
|
||||||
@Argument(value = "verbose", description = "Enable verbose logging output")
|
@Argument(value = "verbose", description = "Enable verbose logging output")
|
||||||
public boolean verbose;
|
public boolean verbose;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.Disposable;
|
|||||||
import com.intellij.openapi.util.Disposer;
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.sampullara.cli.Args;
|
import com.sampullara.cli.Args;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.cli.common.arguments.CommonCompilerArguments;
|
import org.jetbrains.jet.cli.common.arguments.CommonCompilerArguments;
|
||||||
import org.jetbrains.jet.cli.common.messages.*;
|
import org.jetbrains.jet.cli.common.messages.*;
|
||||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentException;
|
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentException;
|
||||||
@@ -48,44 +49,34 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ExitCode exec(@NotNull PrintStream errStream, @NotNull String... args) {
|
public ExitCode exec(@NotNull PrintStream errStream, @NotNull String... args) {
|
||||||
A arguments = createArguments();
|
return exec(errStream, MessageRenderer.PLAIN, args);
|
||||||
if (!parseArguments(errStream, arguments, args)) {
|
|
||||||
return INTERNAL_ERROR;
|
|
||||||
}
|
|
||||||
return exec(errStream, getMessageRenderer(arguments), arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("UnusedDeclaration") // Used via reflection in CompilerRunnerUtil#invokeExecMethod
|
@SuppressWarnings("UnusedDeclaration") // Used via reflection in CompilerRunnerUtil#invokeExecMethod
|
||||||
@NotNull
|
@NotNull
|
||||||
public ExitCode execAndOutputHtml(@NotNull PrintStream errStream, @NotNull String... args) {
|
public ExitCode execAndOutputHtml(@NotNull PrintStream errStream, @NotNull String... args) {
|
||||||
A arguments = createArguments();
|
return exec(errStream, MessageRenderer.TAGS, args);
|
||||||
if (!parseArguments(errStream, arguments, args)) {
|
|
||||||
return INTERNAL_ERROR;
|
|
||||||
}
|
|
||||||
return exec(errStream, MessageRenderer.TAGS, arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Nullable
|
||||||
* Returns true if the arguments can be parsed correctly
|
private A parseArguments(@NotNull PrintStream errStream, @NotNull MessageRenderer messageRenderer, @NotNull String[] args) {
|
||||||
*/
|
|
||||||
protected boolean parseArguments(@NotNull PrintStream errStream, @NotNull A arguments, @NotNull String[] args) {
|
|
||||||
try {
|
try {
|
||||||
|
A arguments = createArguments();
|
||||||
arguments.freeArgs = Args.parse(arguments, args);
|
arguments.freeArgs = Args.parse(arguments, args);
|
||||||
return true;
|
return arguments;
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e) {
|
catch (IllegalArgumentException e) {
|
||||||
errStream.println(e.getMessage());
|
errStream.println(e.getMessage());
|
||||||
usage(errStream, false);
|
usage(errStream, false);
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
// Always use tags
|
errStream.println(messageRenderer.render(
|
||||||
errStream.println(MessageRenderer.TAGS.render(
|
|
||||||
CompilerMessageSeverity.EXCEPTION,
|
CompilerMessageSeverity.EXCEPTION,
|
||||||
OutputMessageUtil.renderException(t),
|
OutputMessageUtil.renderException(t),
|
||||||
CompilerMessageLocation.NO_LOCATION)
|
CompilerMessageLocation.NO_LOCATION)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,11 +97,13 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
|||||||
@NotNull
|
@NotNull
|
||||||
protected abstract A createArguments();
|
protected abstract A createArguments();
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes the compiler on the parsed arguments
|
|
||||||
*/
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ExitCode exec(@NotNull PrintStream errStream, @NotNull MessageRenderer messageRenderer, @NotNull A arguments) {
|
private ExitCode exec(@NotNull PrintStream errStream, @NotNull MessageRenderer messageRenderer, @NotNull String[] args) {
|
||||||
|
A arguments = parseArguments(errStream, messageRenderer, args);
|
||||||
|
if (arguments == null) {
|
||||||
|
return INTERNAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (arguments.help || arguments.extraHelp) {
|
if (arguments.help || arguments.extraHelp) {
|
||||||
usage(errStream, arguments.extraHelp);
|
usage(errStream, arguments.extraHelp);
|
||||||
return OK;
|
return OK;
|
||||||
@@ -161,12 +154,6 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
|||||||
@NotNull
|
@NotNull
|
||||||
protected abstract ExitCode doExecute(@NotNull A arguments, @NotNull MessageCollector messageCollector, @NotNull Disposable rootDisposable);
|
protected abstract ExitCode doExecute(@NotNull A arguments, @NotNull MessageCollector messageCollector, @NotNull Disposable rootDisposable);
|
||||||
|
|
||||||
//TODO: can we make it private?
|
|
||||||
@NotNull
|
|
||||||
protected MessageRenderer getMessageRenderer(@NotNull A arguments) {
|
|
||||||
return arguments.tags ? MessageRenderer.TAGS : MessageRenderer.PLAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void printVersionIfNeeded(
|
protected void printVersionIfNeeded(
|
||||||
@NotNull PrintStream errStream,
|
@NotNull PrintStream errStream,
|
||||||
@NotNull A arguments,
|
@NotNull A arguments,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ where possible options include:
|
|||||||
-output-prefix <path> Path to file which will be added to the beginning of output file
|
-output-prefix <path> Path to file which will be added to the beginning of output file
|
||||||
-output-postfix <path> Path to file which will be added to the end of output file
|
-output-postfix <path> Path to file which will be added to the end of output file
|
||||||
-nowarn Generate no warnings
|
-nowarn Generate no warnings
|
||||||
-tags Demarcate each compilation message (error, warning, etc) with an open and close tag
|
|
||||||
-verbose Enable verbose logging output
|
-verbose Enable verbose logging output
|
||||||
-version Display compiler version
|
-version Display compiler version
|
||||||
-help (-h) Print a synopsis of standard options
|
-help (-h) Print a synopsis of standard options
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ where possible options include:
|
|||||||
-script Evaluate the script file
|
-script Evaluate the script file
|
||||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
||||||
-nowarn Generate no warnings
|
-nowarn Generate no warnings
|
||||||
-tags Demarcate each compilation message (error, warning, etc) with an open and close tag
|
|
||||||
-verbose Enable verbose logging output
|
-verbose Enable verbose logging output
|
||||||
-version Display compiler version
|
-version Display compiler version
|
||||||
-help (-h) Print a synopsis of standard options
|
-help (-h) Print a synopsis of standard options
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ where possible options include:
|
|||||||
-script Evaluate the script file
|
-script Evaluate the script file
|
||||||
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
-kotlin-home <path> Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery
|
||||||
-nowarn Generate no warnings
|
-nowarn Generate no warnings
|
||||||
-tags Demarcate each compilation message (error, warning, etc) with an open and close tag
|
|
||||||
-verbose Enable verbose logging output
|
-verbose Enable verbose logging output
|
||||||
-version Display compiler version
|
-version Display compiler version
|
||||||
-help (-h) Print a synopsis of standard options
|
-help (-h) Print a synopsis of standard options
|
||||||
|
|||||||
+10
-14
@@ -19,6 +19,7 @@ package org.jetbrains.jet.compiler.runner;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import com.intellij.util.containers.Stack;
|
import com.intellij.util.containers.Stack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation;
|
import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation;
|
||||||
import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity;
|
import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity;
|
||||||
@@ -41,19 +42,14 @@ import static org.jetbrains.jet.cli.common.messages.MessageCollectorUtil.reportE
|
|||||||
|
|
||||||
public class CompilerOutputParser {
|
public class CompilerOutputParser {
|
||||||
public static void parseCompilerMessagesFromReader(MessageCollector messageCollector, final Reader reader, OutputItemsCollector collector) {
|
public static void parseCompilerMessagesFromReader(MessageCollector messageCollector, final Reader reader, OutputItemsCollector collector) {
|
||||||
// Sometimes the compiler can't output valid XML
|
// Sometimes the compiler doesn't output valid XML.
|
||||||
// Example: error in command line arguments passed to the compiler
|
// Example: error in command line arguments passed to the compiler.
|
||||||
// having no -tags key (arguments are not parsed), the compiler doesn't know
|
// The compiler will print the usage and the SAX parser will break.
|
||||||
// if it should put any tags in the output, so it will simply print the usage
|
// In this case, we want to read everything from this stream and report it as an IDE error.
|
||||||
// and the SAX parser will break.
|
|
||||||
// In this case, we want to read everything from this stream
|
|
||||||
// and report it as an IDE error.
|
|
||||||
final StringBuilder stringBuilder = new StringBuilder();
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
//noinspection IOResourceOpenedButNotSafelyClosed
|
|
||||||
Reader wrappingReader = new Reader() {
|
Reader wrappingReader = new Reader() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
public int read(@NotNull char[] cbuf, int off, int len) throws IOException {
|
||||||
int read = reader.read(cbuf, off, len);
|
int read = reader.read(cbuf, off, len);
|
||||||
stringBuilder.append(cbuf, off, len);
|
stringBuilder.append(cbuf, off, len);
|
||||||
return read;
|
return read;
|
||||||
@@ -74,7 +70,6 @@ public class CompilerOutputParser {
|
|||||||
parser.parse(new InputSource(wrappingReader), new CompilerOutputSAXHandler(messageCollector, collector));
|
parser.parse(new InputSource(wrappingReader), new CompilerOutputSAXHandler(messageCollector, collector));
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
|
|
||||||
// Load all the text into the stringBuilder
|
// Load all the text into the stringBuilder
|
||||||
try {
|
try {
|
||||||
// This will not close the reader (see the wrapper above)
|
// This will not close the reader (see the wrapper above)
|
||||||
@@ -112,7 +107,7 @@ public class CompilerOutputParser {
|
|||||||
private final OutputItemsCollector collector;
|
private final OutputItemsCollector collector;
|
||||||
|
|
||||||
private final StringBuilder message = new StringBuilder();
|
private final StringBuilder message = new StringBuilder();
|
||||||
private Stack<String> tags = new Stack<String>();
|
private final Stack<String> tags = new Stack<String>();
|
||||||
private String path;
|
private String path;
|
||||||
private int line;
|
private int line;
|
||||||
private int column;
|
private int column;
|
||||||
@@ -123,7 +118,8 @@ public class CompilerOutputParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
public void startElement(@NotNull String uri, @NotNull String localName, @NotNull String qName, @NotNull Attributes attributes)
|
||||||
|
throws SAXException {
|
||||||
tags.push(qName);
|
tags.push(qName);
|
||||||
|
|
||||||
message.setLength(0);
|
message.setLength(0);
|
||||||
@@ -148,7 +144,7 @@ public class CompilerOutputParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
public void endElement(String uri, @NotNull String localName, @NotNull String qName) throws SAXException {
|
||||||
if (tags.size() == 1) {
|
if (tags.size() == 1) {
|
||||||
// We're directly inside the root tag: <MESSAGES>
|
// We're directly inside the root tag: <MESSAGES>
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ public class KotlinCompilerRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void setupCommonSettings(CommonCompilerArguments settings) {
|
private static void setupCommonSettings(CommonCompilerArguments settings) {
|
||||||
settings.tags = true;
|
|
||||||
settings.verbose = true;
|
settings.verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-18
@@ -17,15 +17,16 @@
|
|||||||
package org.jetbrains.k2js.test.semantics;
|
package org.jetbrains.k2js.test.semantics;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.intellij.util.ArrayUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.cli.common.ExitCode;
|
import org.jetbrains.jet.cli.common.ExitCode;
|
||||||
import org.jetbrains.jet.cli.common.arguments.K2JSCompilerArguments;
|
|
||||||
import org.jetbrains.jet.cli.common.messages.MessageRenderer;
|
|
||||||
import org.jetbrains.jet.cli.js.K2JSCompiler;
|
import org.jetbrains.jet.cli.js.K2JSCompiler;
|
||||||
import org.jetbrains.k2js.config.EcmaVersion;
|
import org.jetbrains.k2js.config.EcmaVersion;
|
||||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +36,6 @@ import java.util.List;
|
|||||||
* has completed so that there are various kotlin files to be compiled
|
* has completed so that there are various kotlin files to be compiled
|
||||||
*/
|
*/
|
||||||
public class CompileMavenGeneratedJSLibrary extends SingleFileTranslationTest {
|
public class CompileMavenGeneratedJSLibrary extends SingleFileTranslationTest {
|
||||||
|
|
||||||
protected final String generatedJsDir = "libraries/tools/kotlin-js-library/target/";
|
protected final String generatedJsDir = "libraries/tools/kotlin-js-library/target/";
|
||||||
protected String generatedJsDefinitionsDir = generatedJsDir + "generated-js-definitions";
|
protected String generatedJsDefinitionsDir = generatedJsDir + "generated-js-definitions";
|
||||||
protected File generatedJsLibraryDir = new File( generatedJsDir + "generated-js-library");
|
protected File generatedJsLibraryDir = new File( generatedJsDir + "generated-js-library");
|
||||||
@@ -66,22 +66,23 @@ public class CompileMavenGeneratedJSLibrary extends SingleFileTranslationTest {
|
|||||||
"collections/ListTest.kt",
|
"collections/ListTest.kt",
|
||||||
"collections/SetTest.kt",
|
"collections/SetTest.kt",
|
||||||
"text/StringTest.kt");
|
"text/StringTest.kt");
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
System.out.println("Warning " + generatedJsLibraryDir + " does not exist - I guess you've not run the maven build in library/ yet?");
|
System.out.println("Warning " + generatedJsLibraryDir + " does not exist - I guess you've not run the maven build in library/ yet?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateJavaScriptFiles(@NotNull Iterable<EcmaVersion> ecmaVersions,
|
private void generateJavaScriptFiles(
|
||||||
@NotNull String sourceDir, @NotNull String... stdLibFiles) throws Exception {
|
@NotNull Iterable<EcmaVersion> ecmaVersions,
|
||||||
|
@NotNull String sourceDir,
|
||||||
|
@NotNull String... stdLibFiles
|
||||||
|
) throws Exception {
|
||||||
List<String> files = Lists.newArrayList();
|
List<String> files = Lists.newArrayList();
|
||||||
|
|
||||||
|
|
||||||
// now lets add all the files from the definitions and library
|
// now lets add all the files from the definitions and library
|
||||||
//addAllSourceFiles(files, generatedJsDefinitionsDir);
|
//addAllSourceFiles(files, generatedJsDefinitionsDir);
|
||||||
addAllSourceFiles(files, generatedJsLibraryDir);
|
addAllSourceFiles(files, generatedJsLibraryDir);
|
||||||
|
|
||||||
|
|
||||||
File stdlibDir = new File(sourceDir);
|
File stdlibDir = new File(sourceDir);
|
||||||
assertTrue("Cannot find stdlib test source: " + stdlibDir, stdlibDir.exists());
|
assertTrue("Cannot find stdlib test source: " + stdlibDir, stdlibDir.exists());
|
||||||
for (String file : stdLibFiles) {
|
for (String file : stdLibFiles) {
|
||||||
@@ -90,14 +91,17 @@ public class CompileMavenGeneratedJSLibrary extends SingleFileTranslationTest {
|
|||||||
|
|
||||||
// now lets try invoke the compiler
|
// now lets try invoke the compiler
|
||||||
for (EcmaVersion version : ecmaVersions) {
|
for (EcmaVersion version : ecmaVersions) {
|
||||||
K2JSCompiler compiler = new K2JSCompiler();
|
String outputFile = getOutputFilePath(getTestName(false) + ".compiler.kt", version);
|
||||||
K2JSCompilerArguments arguments = new K2JSCompilerArguments();
|
System.out.println("Compiling with version: " + version + " to: " + outputFile);
|
||||||
arguments.outputFile = getOutputFilePath(getTestName(false) + ".compiler.kt", version);
|
|
||||||
arguments.freeArgs = files;
|
List<String> args = new ArrayList<String>(Arrays.asList(
|
||||||
arguments.verbose = true;
|
"-output", outputFile,
|
||||||
arguments.libraryFiles = new String[] {generatedJsDefinitionsDir};
|
"-library-files", generatedJsDefinitionsDir,
|
||||||
System.out.println("Compiling with version: " + version + " to: " + arguments.outputFile);
|
"-verbose"
|
||||||
ExitCode answer = compiler.exec(System.out, MessageRenderer.PLAIN, arguments);
|
));
|
||||||
|
args.addAll(files);
|
||||||
|
ExitCode answer = new K2JSCompiler().exec(System.out, ArrayUtil.toStringArray(args));
|
||||||
|
|
||||||
assertEquals("Compile failed", ExitCode.OK, answer);
|
assertEquals("Compile failed", ExitCode.OK, answer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +112,8 @@ public class CompileMavenGeneratedJSLibrary extends SingleFileTranslationTest {
|
|||||||
for (File child : children) {
|
for (File child : children) {
|
||||||
if (child.isDirectory()) {
|
if (child.isDirectory()) {
|
||||||
addAllSourceFiles(files, child);
|
addAllSourceFiles(files, child);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
String name = child.getName();
|
String name = child.getName();
|
||||||
if (name.toLowerCase().endsWith(".kt")) {
|
if (name.toLowerCase().endsWith(".kt")) {
|
||||||
files.add(child.getPath());
|
files.add(child.getPath());
|
||||||
|
|||||||
@@ -20,18 +20,17 @@ import com.google.common.collect.Lists;
|
|||||||
import com.intellij.util.ArrayUtil;
|
import com.intellij.util.ArrayUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.cli.common.ExitCode;
|
import org.jetbrains.jet.cli.common.ExitCode;
|
||||||
import org.jetbrains.jet.cli.common.arguments.K2JSCompilerArguments;
|
|
||||||
import org.jetbrains.jet.cli.common.messages.MessageRenderer;
|
|
||||||
import org.jetbrains.jet.cli.js.K2JSCompiler;
|
import org.jetbrains.jet.cli.js.K2JSCompiler;
|
||||||
import org.jetbrains.k2js.config.EcmaVersion;
|
import org.jetbrains.k2js.config.EcmaVersion;
|
||||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||||
import org.jetbrains.k2js.test.utils.LibraryFilePathsUtil;
|
import org.jetbrains.k2js.test.utils.LibraryFilePathsUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
abstract class StdLibTestBase extends SingleFileTranslationTest {
|
abstract class StdLibTestBase extends SingleFileTranslationTest {
|
||||||
|
|
||||||
protected StdLibTestBase() {
|
protected StdLibTestBase() {
|
||||||
super("stdlib/");
|
super("stdlib/");
|
||||||
}
|
}
|
||||||
@@ -66,16 +65,19 @@ abstract class StdLibTestBase extends SingleFileTranslationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO: reuse this in CompileMavenGeneratedJSLibrary
|
//TODO: reuse this in CompileMavenGeneratedJSLibrary
|
||||||
private static void invokeCompiler(@NotNull List<String> files, @NotNull List<String> libFiles,
|
private static void invokeCompiler(
|
||||||
@NotNull EcmaVersion version, @NotNull String outputFilePath) {
|
@NotNull List<String> files,
|
||||||
K2JSCompiler compiler = new K2JSCompiler();
|
@NotNull List<String> libFiles,
|
||||||
K2JSCompilerArguments arguments = new K2JSCompilerArguments();
|
@NotNull EcmaVersion version,
|
||||||
arguments.outputFile = outputFilePath;
|
@NotNull String outputFilePath
|
||||||
arguments.freeArgs = files;
|
) {
|
||||||
arguments.verbose = true;
|
System.out.println("Compiling with version: " + version + " to: " + outputFilePath);
|
||||||
arguments.libraryFiles = ArrayUtil.toStringArray(libFiles);
|
|
||||||
System.out.println("Compiling with version: " + version + " to: " + arguments.outputFile);
|
List<String> args = new ArrayList<String>(Arrays.asList("-output", outputFilePath, "-verbose", "-library-files"));
|
||||||
ExitCode answer = compiler.exec(System.out, MessageRenderer.PLAIN, arguments);
|
args.addAll(libFiles);
|
||||||
|
args.addAll(files);
|
||||||
|
ExitCode answer = new K2JSCompiler().exec(System.out, ArrayUtil.toStringArray(args));
|
||||||
|
|
||||||
assertEquals("Compile failed", ExitCode.OK, answer);
|
assertEquals("Compile failed", ExitCode.OK, answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user