Added "optimize" flag to settings everywhere

This commit is contained in:
Denis Zharkov
2014-07-11 12:39:14 +04:00
committed by Alexander Udalov
parent 433c9cd4a5
commit 0e683b0b99
28 changed files with 301 additions and 25 deletions
@@ -35,6 +35,7 @@ import org.jetbrains.jet.cli.common.messages.MessageCollector;
import org.jetbrains.jet.cli.jvm.K2JVMCompiler;
import org.jetbrains.jet.cli.common.arguments.CompilerArgumentsUtil;
import org.jetbrains.jet.codegen.inline.InlineCodegenUtil;
import org.jetbrains.jet.codegen.optimization.OptimizationUtils;
import java.io.File;
import java.io.IOException;
@@ -158,6 +159,13 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
*/
public String inline;
/**
* Switch method optimization on/off: possible values are "on" and "off".
*
* @parameter
*/
public String optimize;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Kotlin Compiler version " + KotlinVersion.VERSION);
@@ -314,10 +322,23 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
arguments.annotations = getFullAnnotationsPath(log, annotationPaths);
log.info("Using kotlin annotations from " + arguments.annotations);
arguments.inline = inline;
arguments.optimize = optimize;
if (!CompilerArgumentsUtil.checkOption(arguments.inline)) {
throw new MojoExecutionException(CompilerArgumentsUtil.getWrongInlineOptionErrorMessage(arguments.inline));
throw new MojoExecutionException(CompilerArgumentsUtil.getWrongCheckOptionErrorMessage("inline", arguments.inline));
}
if (!CompilerArgumentsUtil.checkOption(arguments.optimize)) {
throw new MojoExecutionException(CompilerArgumentsUtil.getWrongCheckOptionErrorMessage("optimize", arguments.optimize));
}
log.info("Method inlining is " + CompilerArgumentsUtil.optionToBooleanFlag(arguments.inline, InlineCodegenUtil.DEFAULT_INLINE_FLAG));
log.info(
"Optimization mode is " + CompilerArgumentsUtil.optionToBooleanFlag(
arguments.optimize,
OptimizationUtils.DEFAULT_OPTIMIZATION_FLAG
)
);
}
protected String getFullAnnotationsPath(Log log, List<String> annotations) {