Use -processorpath for annotation processors
ErrorProne needs to be added to -processorpath, but once anything is passed via -processorpath javac stops looking in the classpath for annotation processors. Move annotation processors to -processorpath in preparation. This reapplies Ife06b3c7432ab971f5605dcc18a558bcbd99a675 with fixes to processorpath in errorprone rules. Test: m java Change-Id: I188136771386a2183fb31f4b70b50c95ac419ff8
This commit is contained in:
parent
ab97ae08cd
commit
6a77c9871c
2 changed files with 13 additions and 5 deletions
|
@ -43,7 +43,7 @@ var (
|
||||||
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
|
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
|
||||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||||
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
|
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
|
||||||
`$javacFlags $bootClasspath $classpath ` +
|
`$processorpath $javacFlags $bootClasspath $classpath ` +
|
||||||
`-source $javaVersion -target $javaVersion ` +
|
`-source $javaVersion -target $javaVersion ` +
|
||||||
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
|
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
|
||||||
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
||||||
|
@ -56,7 +56,7 @@ var (
|
||||||
Rspfile: "$out.rsp",
|
Rspfile: "$out.rsp",
|
||||||
RspfileContent: "$in",
|
RspfileContent: "$in",
|
||||||
},
|
},
|
||||||
"javacFlags", "bootClasspath", "classpath", "srcJars", "srcJarDir",
|
"javacFlags", "bootClasspath", "classpath", "processorpath", "srcJars", "srcJarDir",
|
||||||
"outDir", "annoDir", "javaVersion")
|
"outDir", "annoDir", "javaVersion")
|
||||||
|
|
||||||
kotlinc = pctx.AndroidGomaStaticRule("kotlinc",
|
kotlinc = pctx.AndroidGomaStaticRule("kotlinc",
|
||||||
|
@ -85,7 +85,7 @@ var (
|
||||||
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
|
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
|
||||||
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
|
||||||
`${config.SoongJavacWrapper} ${config.ErrorProneCmd} ` +
|
`${config.SoongJavacWrapper} ${config.ErrorProneCmd} ` +
|
||||||
`$javacFlags $bootClasspath $classpath ` +
|
`$processorpath $javacFlags $bootClasspath $classpath ` +
|
||||||
`-source $javaVersion -target $javaVersion ` +
|
`-source $javaVersion -target $javaVersion ` +
|
||||||
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
|
`-d $outDir -s $annoDir @$out.rsp @$srcJarDir/list && ` +
|
||||||
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
||||||
|
@ -100,7 +100,7 @@ var (
|
||||||
Rspfile: "$out.rsp",
|
Rspfile: "$out.rsp",
|
||||||
RspfileContent: "$in",
|
RspfileContent: "$in",
|
||||||
},
|
},
|
||||||
"javacFlags", "bootClasspath", "classpath", "srcJars", "srcJarDir",
|
"javacFlags", "bootClasspath", "classpath", "processorpath", "srcJars", "srcJarDir",
|
||||||
"outDir", "annoDir", "javaVersion")
|
"outDir", "annoDir", "javaVersion")
|
||||||
|
|
||||||
turbine = pctx.AndroidStaticRule("turbine",
|
turbine = pctx.AndroidStaticRule("turbine",
|
||||||
|
@ -155,6 +155,7 @@ type javaBuilderFlags struct {
|
||||||
javacFlags string
|
javacFlags string
|
||||||
bootClasspath classpath
|
bootClasspath classpath
|
||||||
classpath classpath
|
classpath classpath
|
||||||
|
processorPath classpath
|
||||||
systemModules classpath
|
systemModules classpath
|
||||||
aidlFlags string
|
aidlFlags string
|
||||||
javaVersion string
|
javaVersion string
|
||||||
|
@ -295,6 +296,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
|
||||||
}
|
}
|
||||||
|
|
||||||
deps = append(deps, flags.classpath...)
|
deps = append(deps, flags.classpath...)
|
||||||
|
deps = append(deps, flags.processorPath...)
|
||||||
|
|
||||||
srcJarDir := "srcjars"
|
srcJarDir := "srcjars"
|
||||||
outDir := "classes"
|
outDir := "classes"
|
||||||
|
@ -315,6 +317,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
|
||||||
"javacFlags": flags.javacFlags,
|
"javacFlags": flags.javacFlags,
|
||||||
"bootClasspath": bootClasspath,
|
"bootClasspath": bootClasspath,
|
||||||
"classpath": flags.classpath.FormJavaClassPath("-classpath"),
|
"classpath": flags.classpath.FormJavaClassPath("-classpath"),
|
||||||
|
"processorpath": flags.processorPath.FormJavaClassPath("-processorpath"),
|
||||||
"srcJars": strings.Join(srcJars.Strings(), " "),
|
"srcJars": strings.Join(srcJars.Strings(), " "),
|
||||||
"srcJarDir": android.PathForModuleOut(ctx, intermediatesDir, srcJarDir).String(),
|
"srcJarDir": android.PathForModuleOut(ctx, intermediatesDir, srcJarDir).String(),
|
||||||
"outDir": android.PathForModuleOut(ctx, intermediatesDir, outDir).String(),
|
"outDir": android.PathForModuleOut(ctx, intermediatesDir, outDir).String(),
|
||||||
|
|
|
@ -331,6 +331,7 @@ type dependencyTag struct {
|
||||||
var (
|
var (
|
||||||
staticLibTag = dependencyTag{name: "staticlib"}
|
staticLibTag = dependencyTag{name: "staticlib"}
|
||||||
libTag = dependencyTag{name: "javalib"}
|
libTag = dependencyTag{name: "javalib"}
|
||||||
|
annoTag = dependencyTag{name: "annotation processor"}
|
||||||
bootClasspathTag = dependencyTag{name: "bootclasspath"}
|
bootClasspathTag = dependencyTag{name: "bootclasspath"}
|
||||||
systemModulesTag = dependencyTag{name: "system modules"}
|
systemModulesTag = dependencyTag{name: "system modules"}
|
||||||
frameworkResTag = dependencyTag{name: "framework-res"}
|
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(), libTag, j.properties.Libs...)
|
||||||
ctx.AddDependency(ctx.Module(), staticLibTag, j.properties.Static_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.Srcs)
|
||||||
android.ExtractSourcesDeps(ctx, j.properties.Exclude_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 {
|
type deps struct {
|
||||||
classpath classpath
|
classpath classpath
|
||||||
bootClasspath classpath
|
bootClasspath classpath
|
||||||
|
processorPath classpath
|
||||||
staticJars android.Paths
|
staticJars android.Paths
|
||||||
staticHeaderJars android.Paths
|
staticHeaderJars android.Paths
|
||||||
staticJarResources android.Paths
|
staticJarResources android.Paths
|
||||||
|
@ -726,6 +728,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
||||||
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars()...)
|
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars()...)
|
||||||
// sdk lib names from dependencies are re-exported
|
// sdk lib names from dependencies are re-exported
|
||||||
j.exportedSdkLibs = append(j.exportedSdkLibs, dep.ExportedSdkLibs()...)
|
j.exportedSdkLibs = append(j.exportedSdkLibs, dep.ExportedSdkLibs()...)
|
||||||
|
case annoTag:
|
||||||
|
deps.processorPath = append(deps.processorPath, dep.ImplementationJars()...)
|
||||||
case frameworkResTag:
|
case frameworkResTag:
|
||||||
if ctx.ModuleName() == "framework" {
|
if ctx.ModuleName() == "framework" {
|
||||||
// framework.jar has a one-off dependency on the R.java and Manifest.java files
|
// 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
|
// classpath
|
||||||
flags.bootClasspath = append(flags.bootClasspath, deps.bootClasspath...)
|
flags.bootClasspath = append(flags.bootClasspath, deps.bootClasspath...)
|
||||||
flags.classpath = append(flags.classpath, deps.classpath...)
|
flags.classpath = append(flags.classpath, deps.classpath...)
|
||||||
|
flags.processorPath = append(flags.processorPath, deps.processorPath...)
|
||||||
|
|
||||||
if len(flags.bootClasspath) == 0 && ctx.Host() && !ctx.Config().TargetOpenJDK9() &&
|
if len(flags.bootClasspath) == 0 && ctx.Host() && !ctx.Config().TargetOpenJDK9() &&
|
||||||
!Bool(j.properties.No_standard_libs) &&
|
!Bool(j.properties.No_standard_libs) &&
|
||||||
|
|
Loading…
Reference in a new issue