Use Stem where output file name is expected in APEX

Bug: 157638999
Test: m
Change-Id: I4a4892bc2941cf1301d210fc3107c02f0e7b13b7
This commit is contained in:
Jiyong Park
2020-05-29 21:29:20 +09:00
parent 705e6e8ce9
commit f1493cc0f2
3 changed files with 20 additions and 17 deletions

View File

@@ -1193,11 +1193,14 @@ func (af *apexFile) apexRelativePath(path string) string {
// Path() returns path of this apex file relative to the APEX root
func (af *apexFile) Path() string {
stem := af.builtFile.Base()
return af.apexRelativePath(af.Stem())
}
func (af *apexFile) Stem() string {
if af.stem != "" {
stem = af.stem
return af.stem
}
return af.apexRelativePath(stem)
return af.builtFile.Base()
}
// SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root
@@ -1943,13 +1946,13 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
case sharedLibTag, jniLibTag:
isJniLib := depTag == jniLibTag
if c, ok := child.(*cc.Module); ok {
// bootstrap bionic libs are treated as provided by system
if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) {
provideNativeLibs = append(provideNativeLibs, c.OutputFile().Path().Base())
}
fi := apexFileForNativeLibrary(ctx, c, handleSpecialLibs)
fi.isJniLib = isJniLib
filesInfo = append(filesInfo, fi)
// bootstrap bionic libs are treated as provided by system
if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) {
provideNativeLibs = append(provideNativeLibs, fi.Stem())
}
return true // track transitive dependencies
} else {
propertyName := "native_shared_libs"
@@ -2069,6 +2072,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// don't include it in this APEX
return false
}
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
af.transitiveDep = true
if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
// If the dependency is a stubs lib, don't include it in this APEX,
// but make sure that the lib is installed on the device.
@@ -2080,12 +2085,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.BaseModuleName(), a.requiredDeps) {
a.requiredDeps = append(a.requiredDeps, cc.BaseModuleName())
}
requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base())
requireNativeLibs = append(requireNativeLibs, af.Stem())
// Don't track further
return false
}
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
af.transitiveDep = true
filesInfo = append(filesInfo, af)
return true // track transitive dependencies
}