minor refactoring to allow plugins to be added to the BytecodeCompiler

This commit is contained in:
James Strachan
2012-03-07 07:36:18 +00:00
parent fcc7189653
commit f6244f75ea
3 changed files with 31 additions and 5 deletions
@@ -18,6 +18,10 @@ package org.jetbrains.jet.buildtools.core;
import org.jetbrains.jet.compiler.CompileEnvironment;
import org.jetbrains.jet.compiler.CompileEnvironmentException;
import org.jetbrains.jet.compiler.CompilerPlugin;
import java.util.ArrayList;
import java.util.List;
/**
@@ -25,6 +29,7 @@ import org.jetbrains.jet.compiler.CompileEnvironmentException;
*/
public class BytecodeCompiler {
private List<CompilerPlugin> compilerPlugins = new ArrayList<CompilerPlugin>();
public BytecodeCompiler () {
}
@@ -49,6 +54,9 @@ public class BytecodeCompiler {
env.addToClasspath( classpath );
}
// lets register any compiler plugins
env.getMyEnvironment().getCompilerPlugins().addAll(getCompilerPlugins());
return env;
}
@@ -108,4 +116,12 @@ public class BytecodeCompiler {
public void moduleToJar ( String module, String jar, boolean includeRuntime, String stdlib, String[] classpath ) {
env( stdlib, classpath ).compileModuleScript( module, jar, null, includeRuntime );
}
public List<CompilerPlugin> getCompilerPlugins() {
return compilerPlugins;
}
public void setCompilerPlugins(List<CompilerPlugin> compilerPlugins) {
this.compilerPlugins = compilerPlugins;
}
}