Only desugar/dx installable libraries

Don't waste time running dx on libraries that will never end up
on the device.

Test: m -j checkbuild
Change-Id: Iad1750823d3261cd6ad6eb6aa00c74d45b9737a3
This commit is contained in:
Colin Cross 2017-09-27 17:59:10 -07:00
parent 40a3671416
commit 59f1bb66ea
1 changed files with 6 additions and 2 deletions

View File

@ -464,7 +464,7 @@ func (j *Module) compile(ctx android.ModuleContext) {
j.classpathFile = outputFile j.classpathFile = outputFile
// TODO(ccross): handle hostdex // TODO(ccross): handle hostdex
if ctx.Device() && len(srcFiles) > 0 { if ctx.Device() && len(srcFiles) > 0 && j.installable() {
dxFlags := j.deviceProperties.Dxflags dxFlags := j.deviceProperties.Dxflags
if false /* emma enabled */ { if false /* emma enabled */ {
// If you instrument class files that have local variable debug information in // If you instrument class files that have local variable debug information in
@ -538,6 +538,10 @@ func (j *Module) compile(ctx android.ModuleContext) {
j.outputFile = outputFile j.outputFile = outputFile
} }
func (j *Module) installable() bool {
return j.properties.Installable == nil || *j.properties.Installable
}
var _ Dependency = (*Library)(nil) var _ Dependency = (*Library)(nil)
func (j *Module) ClasspathFiles() android.Paths { func (j *Module) ClasspathFiles() android.Paths {
@ -569,7 +573,7 @@ type Library struct {
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.compile(ctx) j.compile(ctx)
if j.properties.Installable == nil || *j.properties.Installable == true { if j.installable() {
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
ctx.ModuleName()+".jar", j.outputFile) ctx.ModuleName()+".jar", j.outputFile)
} }