maven-plugin: log actual compiler arguments
mvn --debug prints compiler arguments
This commit is contained in:
+23
@@ -28,6 +28,8 @@ import org.jetbrains.jet.cli.KotlinCompiler;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -109,6 +111,8 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
|
|
||||||
final KotlinCompiler compiler = createCompiler();
|
final KotlinCompiler compiler = createCompiler();
|
||||||
|
|
||||||
|
printCompilerArgumentsIfDebugEnabled(arguments, compiler);
|
||||||
|
|
||||||
final KotlinCompiler.ExitCode exitCode = compiler.exec(System.err, arguments);
|
final KotlinCompiler.ExitCode exitCode = compiler.exec(System.err, arguments);
|
||||||
|
|
||||||
switch (exitCode) {
|
switch (exitCode) {
|
||||||
@@ -120,6 +124,25 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void printCompilerArgumentsIfDebugEnabled(CompilerArguments arguments, KotlinCompiler compiler) {
|
||||||
|
if (getLog().isDebugEnabled()) {
|
||||||
|
getLog().debug("Invoking compiler " + compiler + " with arguments:");
|
||||||
|
try {
|
||||||
|
Field[] fields = arguments.getClass().getFields();
|
||||||
|
for (Field f : fields) {
|
||||||
|
Object value = f.get(arguments);
|
||||||
|
if (value != null) {
|
||||||
|
getLog().debug(f.getName() + "=" + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getLog().debug("End of arguments");
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
getLog().warn("Failed to print compiler arguments: " + e, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected KotlinCompiler createCompiler() {
|
protected KotlinCompiler createCompiler() {
|
||||||
return new KotlinCompiler();
|
return new KotlinCompiler();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user