CLI: drop CompilerArguments and unnecessary methods from *CompilerArguments classes

This commit is contained in:
Zalim Bashorov
2013-10-15 17:56:06 +04:00
parent 5e0ef68d64
commit 31a4d91122
22 changed files with 67 additions and 229 deletions
@@ -16,13 +16,13 @@
package org.jetbrains.jet.cli.common.arguments;
import com.intellij.util.SmartList;
import com.sampullara.cli.Argument;
import java.util.List;
import static org.jetbrains.jet.cli.common.arguments.CommonArgumentConstants.SUPPRESS_WARNINGS;
public abstract class CommonCompilerArguments extends CompilerArguments {
public static final CommonCompilerArguments DUMMY = new DummyImpl();
public abstract class CommonCompilerArguments {
@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")
@@ -31,54 +31,17 @@ public abstract class CommonCompilerArguments extends CompilerArguments {
public boolean version;
@Argument(value = "help", alias = "h", description = "Show help")
public boolean help;
@Argument(value = "suppress", description = "Suppress compiler messages by severity (warnings)")
@Argument(value = "suppress", description = "Suppress compiler messages by severity (" + SUPPRESS_WARNINGS + ")")
public String suppress;
@Argument(value = "printArgs", description = "Print commandline arguments")
public boolean printArgs;
@Override
public boolean isHelp() {
return help;
}
public List<String> freeArgs = new SmartList<String>();
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;
}
@Override
public boolean isPrintArgs() {
return printArgs;
}
public void setTags(boolean tags) {
this.tags = tags;
}
@Override
public boolean suppressAllWarnings() {
return SUPPRESS_WARNINGS.equalsIgnoreCase(suppress);
}
// Used only for serialize and deserialize settings. Don't use in other places!
public static final class DummyImpl extends CommonCompilerArguments {
@Override
public String getSrc() {
return null;
}
}
public static final class DummyImpl extends CommonCompilerArguments {}
}
@@ -1,35 +0,0 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.cli.common.arguments;
import com.intellij.util.SmartList;
import java.util.List;
public abstract class CompilerArguments {
public List<String> freeArgs = new SmartList<String>();
public abstract boolean isHelp();
public abstract boolean isTags();
public abstract boolean isVersion();
public abstract boolean isVerbose();
public abstract boolean isPrintArgs();
public abstract String getSrc();
public abstract boolean suppressAllWarnings();
}
@@ -45,9 +45,4 @@ public class K2JSCompilerArguments extends CommonCompilerArguments {
@Argument(value = "main", description = "Whether a main function should be called; either '" + CALL +
"' or '" + NO_CALL + "', default '" + CALL + "' (main function will be auto detected)")
public String main;
@Override
public String getSrc() {
throw new IllegalStateException();
}
}
@@ -19,24 +19,11 @@ package org.jetbrains.jet.cli.common.arguments;
import com.sampullara.cli.Argument;
import java.util.List;
/**
* Command line arguments for the {@link K2JVMCompiler}
*/
@SuppressWarnings("UnusedDeclaration")
public class K2JVMCompilerArguments extends CommonCompilerArguments {
// TODO ideally we'd unify this with 'src' to just having a single field that supports multiple files/dirs
private List<String> sourceDirs;
public List<String> getSourceDirs() {
return sourceDirs;
}
public void setSourceDirs(List<String> sourceDirs) {
this.sourceDirs = sourceDirs;
}
@Argument(value = "jar", description = "jar file name")
public String jar;
@@ -78,65 +65,4 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
@Argument(value = "kotlinHome", description = "Path to Kotlin compiler home directory, used for annotations and runtime libraries discovery")
public String kotlinHome;
public String getKotlinHome() {
return kotlinHome;
}
public void setKotlinHome(String kotlinHome) {
this.kotlinHome = kotlinHome;
}
public String getClasspath() {
return classpath;
}
public void setClasspath(String classpath) {
this.classpath = classpath;
}
public boolean isIncludeRuntime() {
return includeRuntime;
}
public void setIncludeRuntime(boolean includeRuntime) {
this.includeRuntime = includeRuntime;
}
public String getJar() {
return jar;
}
public void setJar(String jar) {
this.jar = jar;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public String getOutputDir() {
return outputDir;
}
public void setOutputDir(String outputDir) {
this.outputDir = outputDir;
}
@Override
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public void setNoStdlib(boolean noStdlib) {
this.noStdlib = noStdlib;
}
}