Common CLI parameters extracted into a base class
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
package org.jetbrains.jet.cli;
|
||||||
|
|
||||||
|
import com.sampullara.cli.Argument;
|
||||||
|
import org.jetbrains.jet.cli.common.CompilerArguments;
|
||||||
|
|
||||||
|
public abstract class CommonCompilerArguments extends CompilerArguments {
|
||||||
|
@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")
|
||||||
|
public boolean verbose;
|
||||||
|
@Argument(value = "version", description = "Display compiler version")
|
||||||
|
public boolean version;
|
||||||
|
@Argument(value = "help", alias = "h", description = "Show help")
|
||||||
|
public boolean help;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHelp() {
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHelp(boolean help) {
|
||||||
|
this.help = help;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVerbose() {
|
||||||
|
return verbose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(boolean tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,14 +18,14 @@ package org.jetbrains.jet.cli.js;
|
|||||||
|
|
||||||
import com.sampullara.cli.Argument;
|
import com.sampullara.cli.Argument;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.cli.common.CompilerArguments;
|
import org.jetbrains.jet.cli.CommonCompilerArguments;
|
||||||
import org.jetbrains.k2js.facade.MainCallParameters;
|
import org.jetbrains.k2js.facade.MainCallParameters;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: for now K2JSCompiler supports only minimal amount of parameters required to launch it from the plugin.
|
* NOTE: for now K2JSCompiler supports only minimal amount of parameters required to launch it from the plugin.
|
||||||
*/
|
*/
|
||||||
public class K2JSCompilerArguments extends CompilerArguments {
|
public class K2JSCompilerArguments extends CommonCompilerArguments {
|
||||||
@Argument(value = "output", description = "Output file path")
|
@Argument(value = "output", description = "Output file path")
|
||||||
public String outputFile;
|
public String outputFile;
|
||||||
|
|
||||||
@@ -41,42 +41,10 @@ public class K2JSCompilerArguments extends CompilerArguments {
|
|||||||
@Argument(value = "target", description = "Generate js files for specific ECMA version (now support only ECMA 5)")
|
@Argument(value = "target", description = "Generate js files for specific ECMA version (now support only ECMA 5)")
|
||||||
public String target;
|
public String target;
|
||||||
|
|
||||||
@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")
|
|
||||||
public boolean verbose;
|
|
||||||
|
|
||||||
@Argument(value = "version", description = "Display compiler version")
|
|
||||||
public boolean version;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Argument(value = "main", description = "Whether a main function should be called; either 'call' or 'noCall', default 'call' (main function will be auto detected)")
|
@Argument(value = "main", description = "Whether a main function should be called; either 'call' or 'noCall', default 'call' (main function will be auto detected)")
|
||||||
public String main;
|
public String main;
|
||||||
|
|
||||||
@Argument(value = "help", alias = "h", description = "Show help")
|
|
||||||
public boolean help;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHelp() {
|
|
||||||
return help;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTags() {
|
|
||||||
return tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVerbose() {
|
|
||||||
return verbose;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSrc() {
|
public String getSrc() {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
package org.jetbrains.jet.cli.jvm;
|
package org.jetbrains.jet.cli.jvm;
|
||||||
|
|
||||||
import com.sampullara.cli.Argument;
|
import com.sampullara.cli.Argument;
|
||||||
import org.jetbrains.jet.cli.common.CompilerArguments;
|
import org.jetbrains.jet.cli.CommonCompilerArguments;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ import java.util.List;
|
|||||||
* Command line arguments for the {@link K2JVMCompiler}
|
* Command line arguments for the {@link K2JVMCompiler}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
public class K2JVMCompilerArguments extends CompilerArguments {
|
public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||||
|
|
||||||
|
|
||||||
// TODO ideally we'd unify this with 'src' to just having a single field that supports multiple files/dirs
|
// TODO ideally we'd unify this with 'src' to just having a single field that supports multiple files/dirs
|
||||||
@@ -82,18 +82,6 @@ public class K2JVMCompilerArguments extends CompilerArguments {
|
|||||||
@Argument(value = "script", description = "evaluate script")
|
@Argument(value = "script", description = "evaluate script")
|
||||||
public boolean script;
|
public boolean script;
|
||||||
|
|
||||||
@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")
|
|
||||||
public boolean verbose;
|
|
||||||
|
|
||||||
@Argument(value = "version", description = "Display compiler version")
|
|
||||||
public boolean version;
|
|
||||||
|
|
||||||
@Argument(value = "help", alias = "h", description = "show help")
|
|
||||||
public boolean help;
|
|
||||||
|
|
||||||
@Argument(value = "kotlinHome", description = "Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery")
|
@Argument(value = "kotlinHome", description = "Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery")
|
||||||
public String kotlinHome;
|
public String kotlinHome;
|
||||||
|
|
||||||
@@ -113,15 +101,6 @@ public class K2JVMCompilerArguments extends CompilerArguments {
|
|||||||
this.classpath = classpath;
|
this.classpath = classpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHelp() {
|
|
||||||
return help;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHelp(boolean help) {
|
|
||||||
this.help = help;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIncludeRuntime() {
|
public boolean isIncludeRuntime() {
|
||||||
return includeRuntime;
|
return includeRuntime;
|
||||||
}
|
}
|
||||||
@@ -154,6 +133,7 @@ public class K2JVMCompilerArguments extends CompilerArguments {
|
|||||||
this.outputDir = outputDir;
|
this.outputDir = outputDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSrc() {
|
public String getSrc() {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
@@ -162,25 +142,6 @@ public class K2JVMCompilerArguments extends CompilerArguments {
|
|||||||
this.src = src;
|
this.src = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isTags() {
|
|
||||||
return tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVerbose() {
|
|
||||||
return verbose;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTags(boolean tags) {
|
|
||||||
this.tags = tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoStdlib(boolean noStdlib) {
|
public void setNoStdlib(boolean noStdlib) {
|
||||||
this.noStdlib = noStdlib;
|
this.noStdlib = noStdlib;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user