Don't minimize debug information if module explicitly asks for it
In some configurations (for ex: go, auto) we minimize debug information to reduce disk and memory usage. However some tests need the debug information to work as expected. If a test explicitly requests for debug information by passing "-g" to javac flags don't add "-g:source,lines" to minimize debug information. Javac gives priority to -g:source,lines and doesn't respect the order. So check if there is a -g flag before adding flags to minimize debug information. Test: atest CtsJvmtiRunTest1912HostTestCases android.jvmti.cts.JvmtiHostTest1912#testJvmti Change-Id: I45e0f5fa9e79c16c2ff6e9413941a9a637753653
This commit is contained in:
10
java/base.go
10
java/base.go
@@ -1014,8 +1014,16 @@ func (j *Module) collectJavacFlags(
|
||||
ctx android.ModuleContext, flags javaBuilderFlags, srcFiles android.Paths) javaBuilderFlags {
|
||||
// javac flags.
|
||||
javacFlags := j.properties.Javacflags
|
||||
var needsDebugInfo bool
|
||||
|
||||
if ctx.Config().MinimizeJavaDebugInfo() && !ctx.Host() {
|
||||
needsDebugInfo = false
|
||||
for _, flag := range javacFlags {
|
||||
if strings.HasPrefix(flag, "-g") {
|
||||
needsDebugInfo = true
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Config().MinimizeJavaDebugInfo() && !ctx.Host() && !needsDebugInfo {
|
||||
// For non-host binaries, override the -g flag passed globally to remove
|
||||
// local variable debug info to reduce disk and memory usage.
|
||||
javacFlags = append(javacFlags, "-g:source,lines")
|
||||
|
Reference in New Issue
Block a user