Fix annotation processors in kotlin modules that generate resources

The kapt rule was only keeping the generated sources, and not the
generated classes directory.  The generated classes directory will
contain resources generated by the annotation processor and needs
to be added to the final jar.

Test: m ApiFinder
Bug: 153485543
Change-Id: I89197d0afcb1eee011c01aa400f9977e66f43768
Merged-In: I89197d0afcb1eee011c01aa400f9977e66f43768
(cherry picked from commit 9ca38d22a4)
This commit is contained in:
Colin Cross
2020-06-18 15:46:32 -07:00
parent 1e28e3c615
commit 3791b45f67
2 changed files with 16 additions and 9 deletions

View File

@@ -1327,8 +1327,10 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
if len(flags.processorPath) > 0 {
// Use kapt for annotation processing
kaptSrcJar := android.PathForModuleOut(ctx, "kapt", "kapt-sources.jar")
kotlinKapt(ctx, kaptSrcJar, kotlinSrcFiles, srcJars, flags)
kaptResJar := android.PathForModuleOut(ctx, "kapt", "kapt-res.jar")
kotlinKapt(ctx, kaptSrcJar, kaptResJar, kotlinSrcFiles, srcJars, flags)
srcJars = append(srcJars, kaptSrcJar)
kotlinJars = append(kotlinJars, kaptResJar)
// Disable annotation processing in javac, it's already been handled by kapt
flags.processorPath = nil
flags.processors = nil