CLI: don't fail on a wrong "-script" usage
This commit is contained in:
@@ -44,8 +44,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.common.base.Predicates.in;
|
import static com.google.common.base.Predicates.in;
|
||||||
import static org.jetbrains.jet.cli.common.ExitCode.INTERNAL_ERROR;
|
import static org.jetbrains.jet.cli.common.ExitCode.*;
|
||||||
import static org.jetbrains.jet.cli.common.ExitCode.OK;
|
|
||||||
|
|
||||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||||
public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||||
@@ -90,6 +89,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
|||||||
else if (arguments.module != null) {
|
else if (arguments.module != null) {
|
||||||
}
|
}
|
||||||
else if (arguments.script) {
|
else if (arguments.script) {
|
||||||
|
if (arguments.freeArgs.isEmpty()) {
|
||||||
|
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify script source path to evaluate",
|
||||||
|
CompilerMessageLocation.NO_LOCATION);
|
||||||
|
return COMPILATION_ERROR;
|
||||||
|
}
|
||||||
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, arguments.freeArgs.get(0));
|
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, arguments.freeArgs.get(0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
-script
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ERROR: Specify script source path to evaluate
|
||||||
|
COMPILATION_ERROR
|
||||||
@@ -109,6 +109,11 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
|||||||
doJvmTest("compiler/testData/cli/jvm/wrongKotlinSignature.args");
|
doJvmTest("compiler/testData/cli/jvm/wrongKotlinSignature.args");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("wrongScriptWithNoSource.args")
|
||||||
|
public void testWrongScriptWithNoSource() throws Exception {
|
||||||
|
doJvmTest("compiler/testData/cli/jvm/wrongScriptWithNoSource.args");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/cli/jvm/wrongAbiVersionLib")
|
@TestMetadata("compiler/testData/cli/jvm/wrongAbiVersionLib")
|
||||||
@InnerTestClasses({})
|
@InnerTestClasses({})
|
||||||
public static class WrongAbiVersionLib extends AbstractKotlincExecutableTest {
|
public static class WrongAbiVersionLib extends AbstractKotlincExecutableTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user