Loading android/module.go +1 −0 Original line number Diff line number Diff line Loading @@ -502,6 +502,7 @@ type Module interface { InstallInRoot() bool InstallInVendor() bool InstallForceOS() (*OsType, *ArchType) PartitionTag(DeviceConfig) string HideFromMake() IsHideFromMake() bool IsSkipInstall() bool Loading apex/apex.go +2 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ type apexFile struct { // buildFile is put in the installDir inside the APEX. builtFile android.Path installDir string partition string customStem string symlinks []string // additional symlinks Loading Loading @@ -553,6 +554,7 @@ func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidM } if module != nil { ret.moduleDir = ctx.OtherModuleDir(module) ret.partition = module.PartitionTag(ctx.DeviceConfig()) ret.requiredModuleNames = module.RequiredModuleNames() ret.targetRequiredModuleNames = module.TargetRequiredModuleNames() ret.hostRequiredModuleNames = module.HostRequiredModuleNames() Loading apex/apex_test.go +28 −4 Original line number Diff line number Diff line Loading @@ -7122,7 +7122,10 @@ func TestSymlinksFromApexToSystem(t *testing.T) { cc_library { name: "mylib", srcs: ["mylib.cpp"], shared_libs: ["myotherlib"], shared_libs: [ "myotherlib", "myotherlib_ext", ], system_shared_libs: [], stl: "none", apex_available: [ Loading @@ -7146,6 +7149,20 @@ func TestSymlinksFromApexToSystem(t *testing.T) { min_sdk_version: "current", } cc_library { name: "myotherlib_ext", srcs: ["mylib.cpp"], system_shared_libs: [], system_ext_specific: true, stl: "none", apex_available: [ "myapex", "myapex.updatable", "//apex_available:platform", ], min_sdk_version: "current", } java_library { name: "myjar", srcs: ["foo/bar/MyClass.java"], Loading Loading @@ -7186,12 +7203,15 @@ func TestSymlinksFromApexToSystem(t *testing.T) { t.Errorf("%q is not found", file) } ensureSymlinkExists := func(t *testing.T, files []fileInApex, file string) { ensureSymlinkExists := func(t *testing.T, files []fileInApex, file string, target string) { for _, f := range files { if f.path == file { if !f.isLink { t.Errorf("%q is not a symlink", file) } if f.src != target { t.Errorf("expected symlink target to be %q, got %q", target, f.src) } return } } Loading @@ -7205,23 +7225,27 @@ func TestSymlinksFromApexToSystem(t *testing.T) { ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") // For bundled build, symlink to the system for the non-updatable APEXes only ctx = testApex(t, bp) files = getFiles(t, ctx, "myapex", "android_common_myapex_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureSymlinkExists(t, files, "lib64/myotherlib.so") // this is symlink ensureSymlinkExists(t, files, "lib64/myotherlib.so", "/system/lib64/myotherlib.so") // this is symlink ensureSymlinkExists(t, files, "lib64/myotherlib_ext.so", "/system_ext/lib64/myotherlib_ext.so") // this is symlink files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") // this is a real file } func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) { Loading apex/builder.go +2 −4 Original line number Diff line number Diff line Loading @@ -476,8 +476,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { // Copy the built file to the directory. But if the symlink optimization is turned // on, place a symlink to the corresponding file in /system partition instead. if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() { // TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here pathOnDevice := filepath.Join("/system", fi.path()) pathOnDevice := filepath.Join("/", fi.partition, fi.path()) copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath) } else { // Copy the file into APEX Loading Loading @@ -941,8 +940,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { dir := filepath.Join("apex", bundleName, fi.installDir) installDir := android.PathForModuleInstall(ctx, dir) if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() { // TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here pathOnDevice := filepath.Join("/system", fi.path()) pathOnDevice := filepath.Join("/", fi.partition, fi.path()) installedSymlinks = append(installedSymlinks, ctx.InstallAbsoluteSymlink(installDir, fi.stem(), pathOnDevice)) } else { Loading Loading
android/module.go +1 −0 Original line number Diff line number Diff line Loading @@ -502,6 +502,7 @@ type Module interface { InstallInRoot() bool InstallInVendor() bool InstallForceOS() (*OsType, *ArchType) PartitionTag(DeviceConfig) string HideFromMake() IsHideFromMake() bool IsSkipInstall() bool Loading
apex/apex.go +2 −0 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ type apexFile struct { // buildFile is put in the installDir inside the APEX. builtFile android.Path installDir string partition string customStem string symlinks []string // additional symlinks Loading Loading @@ -553,6 +554,7 @@ func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidM } if module != nil { ret.moduleDir = ctx.OtherModuleDir(module) ret.partition = module.PartitionTag(ctx.DeviceConfig()) ret.requiredModuleNames = module.RequiredModuleNames() ret.targetRequiredModuleNames = module.TargetRequiredModuleNames() ret.hostRequiredModuleNames = module.HostRequiredModuleNames() Loading
apex/apex_test.go +28 −4 Original line number Diff line number Diff line Loading @@ -7122,7 +7122,10 @@ func TestSymlinksFromApexToSystem(t *testing.T) { cc_library { name: "mylib", srcs: ["mylib.cpp"], shared_libs: ["myotherlib"], shared_libs: [ "myotherlib", "myotherlib_ext", ], system_shared_libs: [], stl: "none", apex_available: [ Loading @@ -7146,6 +7149,20 @@ func TestSymlinksFromApexToSystem(t *testing.T) { min_sdk_version: "current", } cc_library { name: "myotherlib_ext", srcs: ["mylib.cpp"], system_shared_libs: [], system_ext_specific: true, stl: "none", apex_available: [ "myapex", "myapex.updatable", "//apex_available:platform", ], min_sdk_version: "current", } java_library { name: "myjar", srcs: ["foo/bar/MyClass.java"], Loading Loading @@ -7186,12 +7203,15 @@ func TestSymlinksFromApexToSystem(t *testing.T) { t.Errorf("%q is not found", file) } ensureSymlinkExists := func(t *testing.T, files []fileInApex, file string) { ensureSymlinkExists := func(t *testing.T, files []fileInApex, file string, target string) { for _, f := range files { if f.path == file { if !f.isLink { t.Errorf("%q is not a symlink", file) } if f.src != target { t.Errorf("expected symlink target to be %q, got %q", target, f.src) } return } } Loading @@ -7205,23 +7225,27 @@ func TestSymlinksFromApexToSystem(t *testing.T) { ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") // For bundled build, symlink to the system for the non-updatable APEXes only ctx = testApex(t, bp) files = getFiles(t, ctx, "myapex", "android_common_myapex_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureSymlinkExists(t, files, "lib64/myotherlib.so") // this is symlink ensureSymlinkExists(t, files, "lib64/myotherlib.so", "/system/lib64/myotherlib.so") // this is symlink ensureSymlinkExists(t, files, "lib64/myotherlib_ext.so", "/system_ext/lib64/myotherlib_ext.so") // this is symlink files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image") ensureRealfileExists(t, files, "javalib/myjar.jar") ensureRealfileExists(t, files, "lib64/mylib.so") ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file ensureRealfileExists(t, files, "lib64/myotherlib_ext.so") // this is a real file } func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) { Loading
apex/builder.go +2 −4 Original line number Diff line number Diff line Loading @@ -476,8 +476,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { // Copy the built file to the directory. But if the symlink optimization is turned // on, place a symlink to the corresponding file in /system partition instead. if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() { // TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here pathOnDevice := filepath.Join("/system", fi.path()) pathOnDevice := filepath.Join("/", fi.partition, fi.path()) copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath) } else { // Copy the file into APEX Loading Loading @@ -941,8 +940,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { dir := filepath.Join("apex", bundleName, fi.installDir) installDir := android.PathForModuleInstall(ctx, dir) if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() { // TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here pathOnDevice := filepath.Join("/system", fi.path()) pathOnDevice := filepath.Join("/", fi.partition, fi.path()) installedSymlinks = append(installedSymlinks, ctx.InstallAbsoluteSymlink(installDir, fi.stem(), pathOnDevice)) } else { Loading