Propagate PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong and use it

Strip debug info in javac when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
is set.

Test: m with PRODUCT_MINIMIZE_JAVA_DEBUG_INFO=true
Change-Id: I167e742662801291c516bf1ff826486560d22147
This commit is contained in:
Colin Cross
2017-10-31 13:55:34 -07:00
parent 5c3c768187
commit 126a25cb3d
3 changed files with 10 additions and 0 deletions

View File

@@ -504,6 +504,10 @@ func (c *config) IsPdkBuild() bool {
return Bool(c.ProductVariables.Pdk)
}
func (c *config) MinimizeJavaDebugInfo() bool {
return Bool(c.ProductVariables.MinimizeJavaDebugInfo) && !Bool(c.ProductVariables.Eng)
}
func (c *config) DevicePrefer32BitExecutables() bool {
return Bool(c.ProductVariables.DevicePrefer32BitExecutables)
}

View File

@@ -158,6 +158,7 @@ type productVariables struct {
Treble *bool `json:",omitempty"`
Pdk *bool `json:",omitempty"`
Uml *bool `json:",omitempty"`
MinimizeJavaDebugInfo *bool `json:",omitempty"`
IntegerOverflowExcludePaths *[]string `json:",omitempty"`

View File

@@ -466,6 +466,11 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
if ctx.AConfig().TargetOpenJDK9() {
javacFlags = append(javacFlags, j.properties.Openjdk9.Javacflags...)
}
if ctx.AConfig().MinimizeJavaDebugInfo() {
// Override the -g flag passed globally to remove local variable debug info to reduce
// disk and memory usage.
javacFlags = append(javacFlags, "-g:source,lines")
}
if len(javacFlags) > 0 {
// optimization.
ctx.Variable(pctx, "javacFlags", strings.Join(javacFlags, " "))