Merge "Soong: support Errorprone javacflags" am: fdc2b3bebe
am: 1b1936c487
Change-Id: Ic695e451d51e36ef81bcb0f46845a0361f44cc1d
This commit is contained in:
commit
4cba2cae61
4 changed files with 38 additions and 0 deletions
|
@ -128,6 +128,7 @@ func init() {
|
|||
|
||||
"LOCAL_JAVA_RESOURCE_DIRS": "java_resource_dirs",
|
||||
"LOCAL_JAVACFLAGS": "javacflags",
|
||||
"LOCAL_ERROR_PRONE_FLAGS": "errorprone.javacflags",
|
||||
"LOCAL_DX_FLAGS": "dxflags",
|
||||
"LOCAL_JAVA_LIBRARIES": "libs",
|
||||
"LOCAL_STATIC_JAVA_LIBRARIES": "static_libs",
|
||||
|
|
|
@ -474,6 +474,24 @@ include $(call all-makefiles-under,$(LOCAL_PATH))
|
|||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
desc: "errorprone options for java library",
|
||||
in: `
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_ERROR_PRONE_FLAGS := -Xep:AsyncCallableReturnsNull:ERROR -Xep:AsyncFunctionReturnsNull:ERROR
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
`,
|
||||
expected: `
|
||||
java_library {
|
||||
errorprone: {
|
||||
javacflags: [
|
||||
"-Xep:AsyncCallableReturnsNull:ERROR",
|
||||
"-Xep:AsyncFunctionReturnsNull:ERROR",
|
||||
],
|
||||
},
|
||||
}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
func reformatBlueprint(input string) string {
|
||||
|
|
|
@ -155,6 +155,8 @@ type javaBuilderFlags struct {
|
|||
aidlFlags string
|
||||
javaVersion string
|
||||
|
||||
errorProneExtraJavacFlags string
|
||||
|
||||
kotlincFlags string
|
||||
kotlincClasspath classpath
|
||||
|
||||
|
@ -210,6 +212,14 @@ func RunErrorProne(ctx android.ModuleContext, outputFile android.WritablePath,
|
|||
ctx.ModuleErrorf("cannot build with Error Prone, missing external/error_prone?")
|
||||
}
|
||||
|
||||
if len(flags.errorProneExtraJavacFlags) > 0 {
|
||||
if len(flags.javacFlags) > 0 {
|
||||
flags.javacFlags = flags.errorProneExtraJavacFlags + " " + flags.javacFlags
|
||||
} else {
|
||||
flags.javacFlags = flags.errorProneExtraJavacFlags
|
||||
}
|
||||
}
|
||||
|
||||
transformJavaToClasses(ctx, outputFile, -1, srcFiles, srcJars, flags, nil,
|
||||
"errorprone", "errorprone", errorprone)
|
||||
}
|
||||
|
|
|
@ -142,6 +142,11 @@ type CompilerProperties struct {
|
|||
Exclude_filter []string
|
||||
}
|
||||
|
||||
Errorprone struct {
|
||||
// List of javac flags that should only be used when running errorprone.
|
||||
Javacflags []string
|
||||
}
|
||||
|
||||
Proto struct {
|
||||
// List of extra options that will be passed to the proto generator.
|
||||
Output_params []string
|
||||
|
@ -646,6 +651,10 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
|
|||
flags.javacFlags = "$javacFlags"
|
||||
}
|
||||
|
||||
if len(j.properties.Errorprone.Javacflags) > 0 {
|
||||
flags.errorProneExtraJavacFlags = strings.Join(j.properties.Errorprone.Javacflags, " ")
|
||||
}
|
||||
|
||||
// javaVersion flag.
|
||||
sdk := sdkStringToNumber(ctx, String(j.deviceProperties.Sdk_version))
|
||||
if j.properties.Java_version != nil {
|
||||
|
|
Loading…
Reference in a new issue