Merge "Fix on-device paths to used libraries in dexpreopt." am: 69bd288409

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326319

Change-Id: I0ae80438d2e6971173d66c4ab718cd3f8a6a47c1
This commit is contained in:
Ulyana Trafimovich
2020-06-11 13:57:52 +00:00
committed by Automerger Merge Worker
4 changed files with 30 additions and 7 deletions

View File

@@ -734,6 +734,10 @@ func (a *AARImport) DexJarBuildPath() android.Path {
return nil return nil
} }
func (a *AARImport) DexJarInstallPath() android.Path {
return nil
}
func (a *AARImport) AidlIncludeDirs() android.Paths { func (a *AARImport) AidlIncludeDirs() android.Paths {
return nil return nil
} }

View File

@@ -1883,16 +1883,22 @@ func (u *usesLibrary) usesLibraryPaths(ctx android.ModuleContext) dexpreopt.Libr
ctx.VisitDirectDepsWithTag(usesLibTag, func(m android.Module) { ctx.VisitDirectDepsWithTag(usesLibTag, func(m android.Module) {
dep := ctx.OtherModuleName(m) dep := ctx.OtherModuleName(m)
if lib, ok := m.(Dependency); ok { if lib, ok := m.(Dependency); ok {
if dexJar := lib.DexJarBuildPath(); dexJar != nil { buildPath := lib.DexJarBuildPath()
usesLibPaths[dep] = &dexpreopt.LibraryPath{ if buildPath == nil {
dexJar,
// TODO(b/132357300): propagate actual install paths here.
filepath.Join("/system/framework", dep+".jar"),
}
} else {
ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must"+ ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must"+
" produce a dex jar, does it have installable: true?", dep) " produce a dex jar, does it have installable: true?", dep)
return
} }
var devicePath string
installPath := lib.DexJarInstallPath()
if installPath == nil {
devicePath = filepath.Join("/system/framework", dep+".jar")
} else {
devicePath = android.InstallPathToOnDevicePath(ctx, installPath.(android.InstallPath))
}
usesLibPaths[dep] = &dexpreopt.LibraryPath{buildPath, devicePath}
} else if ctx.Config().AllowMissingDependencies() { } else if ctx.Config().AllowMissingDependencies() {
ctx.AddMissingDependencies([]string{dep}) ctx.AddMissingDependencies([]string{dep})
} else { } else {

View File

@@ -154,6 +154,10 @@ func (d *DeviceHostConverter) DexJarBuildPath() android.Path {
return nil return nil
} }
func (d *DeviceHostConverter) DexJarInstallPath() android.Path {
return nil
}
func (d *DeviceHostConverter) AidlIncludeDirs() android.Paths { func (d *DeviceHostConverter) AidlIncludeDirs() android.Paths {
return nil return nil
} }

View File

@@ -502,6 +502,7 @@ type Dependency interface {
ResourceJars() android.Paths ResourceJars() android.Paths
ImplementationAndResourcesJars() android.Paths ImplementationAndResourcesJars() android.Paths
DexJarBuildPath() android.Path DexJarBuildPath() android.Path
DexJarInstallPath() android.Path
AidlIncludeDirs() android.Paths AidlIncludeDirs() android.Paths
ExportedSdkLibs() []string ExportedSdkLibs() []string
ExportedPlugins() (android.Paths, []string) ExportedPlugins() (android.Paths, []string)
@@ -1749,6 +1750,10 @@ func (j *Module) DexJarBuildPath() android.Path {
return j.dexJarFile return j.dexJarFile
} }
func (j *Module) DexJarInstallPath() android.Path {
return j.installFile
}
func (j *Module) ResourceJars() android.Paths { func (j *Module) ResourceJars() android.Paths {
if j.resourceJar == nil { if j.resourceJar == nil {
return nil return nil
@@ -2575,6 +2580,10 @@ func (j *Import) DexJarBuildPath() android.Path {
return nil return nil
} }
func (j *Import) DexJarInstallPath() android.Path {
return nil
}
func (j *Import) AidlIncludeDirs() android.Paths { func (j *Import) AidlIncludeDirs() android.Paths {
return j.exportAidlIncludeDirs return j.exportAidlIncludeDirs
} }