added partial fix for KT-2765 so we can specify the paths to where annotations.xml files can be found
This commit is contained in:
+31
-2
@@ -36,6 +36,8 @@ import java.net.URL;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.jetbrains.jet.internal.com.intellij.openapi.util.text.StringUtil.join;
|
||||||
|
|
||||||
public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||||
/**
|
/**
|
||||||
* The source directories containing the sources to be compiled.
|
* The source directories containing the sources to be compiled.
|
||||||
@@ -46,6 +48,16 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
*/
|
*/
|
||||||
public List<String> sources;
|
public List<String> sources;
|
||||||
|
|
||||||
|
// TODO not sure why this doesn't work :(
|
||||||
|
// * @parameter default-value="$(project.basedir}/src/main/resources"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The directories used to scan for annotation.xml files for Kotlin annotations
|
||||||
|
*
|
||||||
|
* @parameter
|
||||||
|
*/
|
||||||
|
public List<String> annotationPaths;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The source directories containing the sources to be compiled for tests.
|
* The source directories containing the sources to be compiled for tests.
|
||||||
*
|
*
|
||||||
@@ -223,10 +235,27 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
arguments.setOutputDir(output);
|
arguments.setOutputDir(output);
|
||||||
|
|
||||||
arguments.noJdkAnnotations = true;
|
arguments.noJdkAnnotations = true;
|
||||||
arguments.annotations = getJdkAnnotations().getPath();
|
String jdkAnnotation = getJdkAnnotations().getPath();
|
||||||
log.debug("Using jdk annotations from " + arguments.annotations);
|
arguments.annotations = jdkAnnotation;
|
||||||
|
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
if (jdkAnnotation != null && jdkAnnotation.length() > 0) {
|
||||||
|
list.add(jdkAnnotation);
|
||||||
|
}
|
||||||
|
if (annotationPaths != null) {
|
||||||
|
for (String annotationPath : annotationPaths) {
|
||||||
|
if (new File(annotationPath).exists()) {
|
||||||
|
list.add(annotationPath);
|
||||||
|
} else {
|
||||||
|
log.info("annotation path " + annotationPath + " does not exist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arguments.annotations = join(list, File.pathSeparator);
|
||||||
|
log.info("Using kotlin annotations from " + arguments.annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: Make a better runtime detection or get rid of it entirely
|
// TODO: Make a better runtime detection or get rid of it entirely
|
||||||
private String getRuntimeFromClassPath(List<String> classpath) {
|
private String getRuntimeFromClassPath(List<String> classpath) {
|
||||||
for (String item : classpath) {
|
for (String item : classpath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user