Created
June 13, 2016 14:52
-
-
Save nickwph/fac980fd6cf4ef9415d5a35477646024 to your computer and use it in GitHub Desktop.
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
// temporarily solution: place generated code into source directory | |
project.afterEvaluate { | |
def variants | |
if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.test")) { | |
variants = project.android.applicationVariants | |
} else if (project.plugins.hasPlugin("com.android.library")) { | |
variants = project.android.libraryVariants | |
} else { | |
throw new Exception("The android application or library plugin must be applied to the project") | |
} | |
variants.all { variant -> | |
File file = project.file(new File(project.buildDir, "generated/source/annotationProcessor/${variant.name}")) | |
project.tasks.getByName("transformClassesWithPreJackPackagedLibrariesFor${variant.name.capitalize()}").doFirst { | |
file.mkdirs() | |
} | |
variant.addJavaSourceFoldersToModel(file) | |
variant.javaCompiler.transform.options.additionalParameters.put("jack.annotation-processor.source.output", file.absolutePath) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment