Added supprot for kapt (untested)
This commit is contained in:
parent
23255460e3
commit
6cb2955575
4 changed files with 352 additions and 1 deletions
|
@ -46,6 +46,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
|||
private File buildMainDirectory_;
|
||||
private File buildTestDirectory_;
|
||||
private CompileKotlinOptions compileOptions_;
|
||||
private KaptOptions kaptOptions_;
|
||||
|
||||
public static Collection<File> getKotlinFileList(File directory) {
|
||||
if (directory == null) {
|
||||
|
@ -238,6 +239,14 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
|||
args.addAll(compileOptions_.args());
|
||||
}
|
||||
|
||||
// kapt options
|
||||
if (kaptOptions_ != null) {
|
||||
kaptOptions_.args().forEach(a -> {
|
||||
args.add("-P");
|
||||
args.add(a);
|
||||
} );
|
||||
}
|
||||
|
||||
// source
|
||||
sources.forEach(f -> args.add(f.getAbsolutePath()));
|
||||
|
||||
|
@ -288,6 +297,17 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
|
|||
.testSourceFiles(getKotlinFileList(new File(project.srcTestDirectory(), "kotlin")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the annotation processor ({@code kapt} options.
|
||||
*
|
||||
* @param options the {@code kapt} options
|
||||
* @return this class instance
|
||||
*/
|
||||
public CompileKotlinOperation kaptOptions(KaptOptions options) {
|
||||
kaptOptions_ = options;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides main source directories that should be compiled.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue