diff options
Diffstat (limited to 'apex/vndk.go')
| -rw-r--r-- | apex/vndk.go | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/apex/vndk.go b/apex/vndk.go index cf525a874..75c0fb01b 100644 --- a/apex/vndk.go +++ b/apex/vndk.go @@ -15,6 +15,7 @@ package apex import ( + "path/filepath" "strings" "android/soong/android" @@ -95,14 +96,11 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { } // name is module.BaseModuleName() which is used as LOCAL_MODULE_NAME and also LOCAL_OVERRIDES_* -func makeCompatSymlinks(name string, ctx android.ModuleContext, primaryApex bool) (symlinks android.InstallPaths) { +func makeCompatSymlinks(name string, ctx android.ModuleContext) (symlinks []string) { // small helper to add symlink commands - addSymlink := func(target string, dir android.InstallPath, linkName string) { - if primaryApex { - symlinks = append(symlinks, ctx.InstallAbsoluteSymlink(dir, linkName, target)) - } else { - symlinks = append(symlinks, dir.Join(ctx, linkName)) - } + addSymlink := func(target, dir, linkName string) { + link := filepath.Join(dir, linkName) + symlinks = append(symlinks, "mkdir -p "+dir+" && rm -rf "+link+" && ln -sf "+target+" "+link) } // TODO(b/142911355): [VNDK APEX] Fix hard-coded references to /system/lib/vndk @@ -120,15 +118,14 @@ func makeCompatSymlinks(name string, ctx android.ModuleContext, primaryApex bool // the name of vndk apex is formatted "com.android.vndk.v" + version apexName := vndkApexNamePrefix + vndkVersion if ctx.Config().Android64() { - dir := android.PathForModuleInPartitionInstall(ctx, "system", "lib64") - addSymlink("/apex/"+apexName+"/lib64", dir, "vndk-sp-"+vndkVersion) - addSymlink("/apex/"+apexName+"/lib64", dir, "vndk-"+vndkVersion) + addSymlink("/apex/"+apexName+"/lib64", "$(TARGET_OUT)/lib64", "vndk-sp-"+vndkVersion) + addSymlink("/apex/"+apexName+"/lib64", "$(TARGET_OUT)/lib64", "vndk-"+vndkVersion) } if !ctx.Config().Android64() || ctx.DeviceConfig().DeviceSecondaryArch() != "" { - dir := android.PathForModuleInPartitionInstall(ctx, "system", "lib") - addSymlink("/apex/"+apexName+"/lib", dir, "vndk-sp-"+vndkVersion) - addSymlink("/apex/"+apexName+"/lib", dir, "vndk-"+vndkVersion) + addSymlink("/apex/"+apexName+"/lib", "$(TARGET_OUT)/lib", "vndk-sp-"+vndkVersion) + addSymlink("/apex/"+apexName+"/lib", "$(TARGET_OUT)/lib", "vndk-"+vndkVersion) } + return } // http://b/121248172 - create a link from /system/usr/icu to @@ -136,25 +133,19 @@ func makeCompatSymlinks(name string, ctx android.ModuleContext, primaryApex bool // A symlink can't overwrite a directory and the /system/usr/icu directory once // existed so the required structure must be created whatever we find. if name == "com.android.i18n" { - dir := android.PathForModuleInPartitionInstall(ctx, "system", "usr") - addSymlink("/apex/com.android.i18n/etc/icu", dir, "icu") + addSymlink("/apex/com.android.i18n/etc/icu", "$(TARGET_OUT)/usr", "icu") + return } // TODO(b/124106384): Clean up compat symlinks for ART binaries. - if name == "com.android.art" { - dir := android.PathForModuleInPartitionInstall(ctx, "system", "bin") - addSymlink("/apex/com.android.art/bin/dalvikvm", dir, "dalvikvm") + if name == "com.android.art" || strings.HasPrefix(name, "com.android.art.") { + addSymlink("/apex/com.android.art/bin/dalvikvm", "$(TARGET_OUT)/bin", "dalvikvm") dex2oat := "dex2oat32" if ctx.Config().Android64() { dex2oat = "dex2oat64" } - addSymlink("/apex/com.android.art/bin/"+dex2oat, dir, "dex2oat") - } else if name == "com.android.art" || strings.HasPrefix(name, "com.android.art.") { - dir := android.PathForModuleInPartitionInstall(ctx, "system", "bin") - symlinks = append(symlinks, - dir.Join(ctx, "dalvikvm"), - dir.Join(ctx, "dex2oat")) + addSymlink("/apex/com.android.art/bin/"+dex2oat, "$(TARGET_OUT)/bin", "dex2oat") + return } - - return symlinks + return } |