Merge "Put base APK when AppSet is included in APEX" am: b5a04d7905 am: 361cfb2309 am: 8c15660653

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

Change-Id: I83f83b511fb6c84ea46fc6b8a559e25aa00ffad3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-09-30 05:19:12 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 4 deletions

View File

@@ -7235,12 +7235,13 @@ func TestAppSetBundle(t *testing.T) {
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`) ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
s := mod.Rule("apexRule").Args["copy_commands"] s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1) copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
if len(copyCmds) != 3 { if len(copyCmds) != 4 {
t.Fatalf("Expected 3 commands, got %d in:\n%s", len(copyCmds), s) t.Fatalf("Expected 4 commands, got %d in:\n%s", len(copyCmds), s)
} }
ensureMatches(t, copyCmds[0], "^rm -rf .*/app/AppSet@TEST.BUILD_ID$") ensureMatches(t, copyCmds[0], "^rm -rf .*/app/AppSet@TEST.BUILD_ID$")
ensureMatches(t, copyCmds[1], "^mkdir -p .*/app/AppSet@TEST.BUILD_ID$") ensureMatches(t, copyCmds[1], "^mkdir -p .*/app/AppSet@TEST.BUILD_ID$")
ensureMatches(t, copyCmds[2], "^unzip .*-d .*/app/AppSet@TEST.BUILD_ID .*/AppSet.zip$") ensureMatches(t, copyCmds[2], "^cp -f .*/app/AppSet@TEST.BUILD_ID/AppSet.apk$")
ensureMatches(t, copyCmds[3], "^unzip .*-d .*/app/AppSet@TEST.BUILD_ID .*/AppSet.zip$")
// Ensure that canned_fs_config has an entry for the app set zip file // Ensure that canned_fs_config has an entry for the app set zip file
generateFsRule := mod.Rule("generateFsConfig") generateFsRule := mod.Rule("generateFsConfig")

View File

@@ -459,8 +459,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
pathOnDevice := filepath.Join("/system", fi.path()) pathOnDevice := filepath.Join("/system", fi.path())
copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath) copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath)
} else { } else {
// Copy the file into APEX
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
var installedPath android.InstallPath var installedPath android.InstallPath
if fi.class == appSet { if fi.class == appSet {
// In case of AppSet, we need to copy additional APKs as well. They
// are zipped. So we need to unzip them.
copyCommands = append(copyCommands, copyCommands = append(copyCommands,
fmt.Sprintf("unzip -qDD -d %s %s", destPathDir, fmt.Sprintf("unzip -qDD -d %s %s", destPathDir,
fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs().String())) fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs().String()))
@@ -469,7 +474,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
fi.stem(), fi.builtFile, fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs()) fi.stem(), fi.builtFile, fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs())
} }
} else { } else {
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
if installSymbolFiles { if installSymbolFiles {
installedPath = ctx.InstallFile(pathWhenActivated.Join(ctx, fi.installDir), fi.stem(), fi.builtFile) installedPath = ctx.InstallFile(pathWhenActivated.Join(ctx, fi.installDir), fi.stem(), fi.builtFile)
} }
@@ -1086,6 +1090,9 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Outp
executablePaths = append(executablePaths, filepath.Join(f.installDir, s)) executablePaths = append(executablePaths, filepath.Join(f.installDir, s))
} }
} else if f.class == appSet { } else if f.class == appSet {
// base APK
readOnlyPaths = append(readOnlyPaths, pathInApex)
// Additional APKs
appSetDirs = append(appSetDirs, f.installDir) appSetDirs = append(appSetDirs, f.installDir)
appSetFiles[f.installDir] = f.module.(*java.AndroidAppSet).PackedAdditionalOutputs() appSetFiles[f.installDir] = f.module.(*java.AndroidAppSet).PackedAdditionalOutputs()
} else { } else {