Merge "Use -processorpath for annotation processors"

This commit is contained in:
Colin Cross 2018-06-21 03:34:10 +00:00 committed by Gerrit Code Review
commit 1418fe2e4c
2 changed files with 11 additions and 3 deletions

View File

@ -43,7 +43,7 @@ var (
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
`$javacFlags $bootClasspath $classpath ` +
`$processorpath $javacFlags $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
@ -56,7 +56,7 @@ var (
Rspfile: "$out.rsp",
RspfileContent: "$in",
},
"javacFlags", "bootClasspath", "classpath", "srcJars", "srcJarDir",
"javacFlags", "bootClasspath", "classpath", "processorpath", "srcJars", "srcJarDir",
"outDir", "annoDir", "javaVersion")
kotlinc = pctx.AndroidGomaStaticRule("kotlinc",
@ -155,6 +155,7 @@ type javaBuilderFlags struct {
javacFlags string
bootClasspath classpath
classpath classpath
processorPath classpath
systemModules classpath
aidlFlags string
javaVersion string
@ -295,6 +296,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
}
deps = append(deps, flags.classpath...)
deps = append(deps, flags.processorPath...)
srcJarDir := "srcjars"
outDir := "classes"
@ -315,6 +317,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
"javacFlags": flags.javacFlags,
"bootClasspath": bootClasspath,
"classpath": flags.classpath.FormJavaClassPath("-classpath"),
"processorpath": flags.processorPath.FormJavaClassPath("-processorpath"),
"srcJars": strings.Join(srcJars.Strings(), " "),
"srcJarDir": android.PathForModuleOut(ctx, intermediatesDir, srcJarDir).String(),
"outDir": android.PathForModuleOut(ctx, intermediatesDir, outDir).String(),

View File

@ -331,6 +331,7 @@ type dependencyTag struct {
var (
staticLibTag = dependencyTag{name: "staticlib"}
libTag = dependencyTag{name: "javalib"}
annoTag = dependencyTag{name: "annotation processor"}
bootClasspathTag = dependencyTag{name: "bootclasspath"}
systemModulesTag = dependencyTag{name: "system modules"}
frameworkResTag = dependencyTag{name: "framework-res"}
@ -521,7 +522,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...)
ctx.AddDependency(ctx.Module(), staticLibTag, j.properties.Static_libs...)
ctx.AddDependency(ctx.Module(), libTag, j.properties.Annotation_processors...)
ctx.AddDependency(ctx.Module(), annoTag, j.properties.Annotation_processors...)
android.ExtractSourcesDeps(ctx, j.properties.Srcs)
android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs)
@ -602,6 +603,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
type deps struct {
classpath classpath
bootClasspath classpath
processorPath classpath
staticJars android.Paths
staticHeaderJars android.Paths
staticJarResources android.Paths
@ -726,6 +728,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars()...)
// sdk lib names from dependencies are re-exported
j.exportedSdkLibs = append(j.exportedSdkLibs, dep.ExportedSdkLibs()...)
case annoTag:
deps.processorPath = append(deps.processorPath, dep.ImplementationJars()...)
case frameworkResTag:
if ctx.ModuleName() == "framework" {
// framework.jar has a one-off dependency on the R.java and Manifest.java files
@ -850,6 +854,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
// classpath
flags.bootClasspath = append(flags.bootClasspath, deps.bootClasspath...)
flags.classpath = append(flags.classpath, deps.classpath...)
flags.processorPath = append(flags.processorPath, deps.processorPath...)
if len(flags.bootClasspath) == 0 && ctx.Host() && !ctx.Config().TargetOpenJDK9() &&
!Bool(j.properties.No_standard_libs) &&