CLI: move the compilerPlugins property from CompilerArguments to CLICompiler.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.jet.cli.common;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.sampullara.cli.Args;
|
||||
@@ -26,11 +27,24 @@ import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentException;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jet.cli.common.ExitCode.*;
|
||||
|
||||
public abstract class CLICompiler<A extends CompilerArguments> {
|
||||
|
||||
@NotNull
|
||||
private List<CompilerPlugin> compilerPlugins = Lists.newArrayList();
|
||||
|
||||
@NotNull
|
||||
public List<CompilerPlugin> getCompilerPlugins() {
|
||||
return compilerPlugins;
|
||||
}
|
||||
|
||||
public void setCompilerPlugins(@NotNull List<CompilerPlugin> compilerPlugins) {
|
||||
this.compilerPlugins = compilerPlugins;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ExitCode exec(@NotNull PrintStream errStream, @NotNull String... args) {
|
||||
A arguments = createArguments();
|
||||
@@ -85,7 +99,7 @@ public abstract class CLICompiler<A extends CompilerArguments> {
|
||||
*/
|
||||
//TODO: add parameter annotations when KT-1863 is resolved
|
||||
protected void configureEnvironment(@NotNull CompilerConfiguration configuration, @NotNull A arguments) {
|
||||
configuration.addAll(CLIConfigurationKeys.COMPILER_PLUGINS, arguments.getCompilerPlugins());
|
||||
configuration.addAll(CLIConfigurationKeys.COMPILER_PLUGINS, compilerPlugins);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -17,26 +17,10 @@
|
||||
package org.jetbrains.jet.cli.common;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CompilerArguments {
|
||||
@NotNull
|
||||
private List<CompilerPlugin> compilerPlugins = Lists.newArrayList();
|
||||
|
||||
@NotNull
|
||||
public List<CompilerPlugin> getCompilerPlugins() {
|
||||
return compilerPlugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the compiler plugins to be used when working with the {@link org.jetbrains.jet.cli.CLICompiler}
|
||||
*/
|
||||
public void setCompilerPlugins(@NotNull List<CompilerPlugin> compilerPlugins) {
|
||||
this.compilerPlugins = compilerPlugins;
|
||||
}
|
||||
|
||||
public List<String> freeArgs = Lists.newArrayList();
|
||||
|
||||
public abstract boolean isHelp();
|
||||
|
||||
@@ -24,9 +24,9 @@ class HtmlVisitorTest {
|
||||
args.kotlinHome = "../../../dist/kotlinc"
|
||||
args.setSrc(srcDir.toString())
|
||||
args.setOutputDir(File(dir, "target/classes-htmldocs").toString())
|
||||
args.getCompilerPlugins().add(HtmlCompilerPlugin())
|
||||
|
||||
val compiler = K2JVMCompiler()
|
||||
compiler.getCompilerPlugins().add(HtmlCompilerPlugin())
|
||||
compiler.exec(System.out, args)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user