Kapt: Preserve kapt plugin options if there are also options from compiler plugins (KT-20257)
This commit is contained in:
+5
-1
@@ -51,6 +51,8 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.jetbrains.kotlin.maven.Util.joinArrays;
|
||||
|
||||
public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> extends AbstractMojo {
|
||||
@Component
|
||||
protected PlexusContainer container;
|
||||
@@ -494,7 +496,9 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
||||
getLog().debug("Plugin options are: " + Joiner.on(", ").join(pluginArguments));
|
||||
}
|
||||
|
||||
arguments.setPluginOptions(pluginArguments.toArray(new String[pluginArguments.size()]));
|
||||
arguments.setPluginOptions(joinArrays(
|
||||
arguments.getPluginOptions(),
|
||||
pluginArguments.toArray(new String[pluginArguments.size()])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.maven;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -26,4 +29,21 @@ public class Util {
|
||||
new File(s).exists() || new File(basedir, s).exists()
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] joinArrays(@Nullable String[] first, @Nullable String[] second) {
|
||||
if (first == null) {
|
||||
first = new String[0];
|
||||
}
|
||||
if (second == null) {
|
||||
second = new String[0];
|
||||
}
|
||||
|
||||
String[] result = new String[first.length + second.length];
|
||||
|
||||
System.arraycopy(first, 0, result, 0, first.length);
|
||||
System.arraycopy(second, 0, result, first.length, second.length);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-17
@@ -31,6 +31,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.maven.Util.joinArrays;
|
||||
import static org.jetbrains.kotlin.maven.kapt.AnnotationProcessingManager.*;
|
||||
|
||||
/** @noinspection UnusedDeclaration */
|
||||
@@ -182,23 +183,6 @@ public class KaptJVMCompilerMojo extends K2JVMCompileMojo {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String[] joinArrays(@Nullable String[] first, @Nullable String[] second) {
|
||||
if (first == null) {
|
||||
first = new String[0];
|
||||
}
|
||||
if (second == null) {
|
||||
second = new String[0];
|
||||
}
|
||||
|
||||
String[] result = new String[first.length + second.length];
|
||||
|
||||
System.arraycopy(first, 0, result, 0, first.length);
|
||||
System.arraycopy(second, 0, result, first.length, second.length);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isIncremental() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user