JPS plugin: make the code more understandable -- added some comments and rename scriptFile to moduleFile.
Original commit: cfb7104ae9
This commit is contained in:
@@ -77,6 +77,7 @@ public class KotlinBuilder extends ModuleLevelBuilder {
|
|||||||
OutputConsumer outputConsumer
|
OutputConsumer outputConsumer
|
||||||
) throws ProjectBuildException, IOException {
|
) throws ProjectBuildException, IOException {
|
||||||
MessageCollector messageCollector = new MessageCollectorAdapter(context);
|
MessageCollector messageCollector = new MessageCollectorAdapter(context);
|
||||||
|
// Workaround for Android Studio
|
||||||
if (!isJavaPluginEnabled(context)) {
|
if (!isJavaPluginEnabled(context)) {
|
||||||
messageCollector.report(INFO, "Kotlin JPS plugin is disabled", CompilerMessageLocation.NO_LOCATION);
|
messageCollector.report(INFO, "Kotlin JPS plugin is disabled", CompilerMessageLocation.NO_LOCATION);
|
||||||
return ExitCode.NOTHING_DONE;
|
return ExitCode.NOTHING_DONE;
|
||||||
@@ -141,6 +142,7 @@ public class KotlinBuilder extends ModuleLevelBuilder {
|
|||||||
|
|
||||||
private static boolean isJavaPluginEnabled(@NotNull CompileContext context) {
|
private static boolean isJavaPluginEnabled(@NotNull CompileContext context) {
|
||||||
try {
|
try {
|
||||||
|
// Using reflection for backward compatibility with IDEA 12
|
||||||
Field javaPluginIsEnabledField = JavaBuilder.class.getDeclaredField("IS_ENABLED");
|
Field javaPluginIsEnabledField = JavaBuilder.class.getDeclaredField("IS_ENABLED");
|
||||||
return Modifier.isPublic(javaPluginIsEnabledField.getModifiers()) ? JavaBuilder.IS_ENABLED.get(context, Boolean.TRUE) : true;
|
return Modifier.isPublic(javaPluginIsEnabledField.getModifiers()) ? JavaBuilder.IS_ENABLED.get(context, Boolean.TRUE) : true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user