Last active
August 29, 2015 14:01
-
-
Save roman-mazur/95c7f46b66c7f15fb97a to your computer and use it in GitHub Desktop.
Add Java annotation processors output to Android sources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds code generated by annotation processors to source folders. | |
*/ | |
def aptOutputDir = project.file(new File(project.buildDir, "generated/source/apt")) | |
android.applicationVariants.all { def v -> | |
def aptOutput = new File(aptOutputDir, v.dirName) | |
v.addJavaSourceFoldersToModel(aptOutput) | |
v.javaCompile.options.compilerArgs += [ | |
'-s', aptOutput.absolutePath | |
] | |
v.javaCompile.doFirst { | |
aptOutput.mkdirs() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment