allow the JS compiler to take a list of files, verbose flag and a flag to indicate if a main call is required; plus added a test case to ensure we can compile some of the kotlin standard library using the K2JSCompiler directly

This commit is contained in:
James Strachan
2012-05-30 11:31:35 +01:00
parent 782773fca9
commit d7573b49a6
6 changed files with 95 additions and 19 deletions
@@ -38,6 +38,14 @@ public class K2JSCompilerMojo extends KotlinCompileMojo {
*/
private String outFile;
/**
* Whether verbose logging is enabled or not.
*
* @parameter default-value="false"
* @parameter expression="${verbose}"
*/
private Boolean verbose;
@Override
protected void configureCompilerArguments(CompilerArguments arguments) throws MojoExecutionException {
super.configureCompilerArguments(arguments);
@@ -45,9 +53,11 @@ public class K2JSCompilerMojo extends KotlinCompileMojo {
if (arguments instanceof K2JSCompilerArguments) {
K2JSCompilerArguments k2jsArgs = (K2JSCompilerArguments)arguments;
k2jsArgs.outputFile = outFile;
if (verbose != null) {
k2jsArgs.verbose = verbose;
}
if (sources.size() > 0) {
// TODO K2JSCompilerArguments should allow more than one path/file
k2jsArgs.srcdir = sources.get(0);
k2jsArgs.sourceFiles = sources;
}
}
getLog().info("Compiling Kotlin src from " + arguments.getSrc() + " to JavaScript at: " + outFile);