Move apex module installation into Soong
Move apex module installation rules into Soong by overriding InstallBypassMake. Soong installs don't support post install commands, so move the symlinks into separate rules and add dependencies on them. This relands If65d283abc86f18ad266da0bf16fe95971a0bf9c with fixes to install files into $OUT/apex and I606286e971b55d9d1fc4dcd0fbd476962de5fa79 with a fix for reversed logic. Bug: 204136549 Test: m checkbuild Change-Id: Ie65c53ebc7911efacdb8e11ba49059448f03c658
This commit is contained in:
@@ -108,18 +108,6 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||
return moduleNames
|
||||
}
|
||||
|
||||
var postInstallCommands []string
|
||||
for _, fi := range a.filesInfo {
|
||||
if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() {
|
||||
// TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here
|
||||
linkTarget := filepath.Join("/system", fi.path())
|
||||
linkPath := filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.path())
|
||||
mkdirCmd := "mkdir -p " + filepath.Dir(linkPath)
|
||||
linkCmd := "ln -sfn " + linkTarget + " " + linkPath
|
||||
postInstallCommands = append(postInstallCommands, mkdirCmd, linkCmd)
|
||||
}
|
||||
}
|
||||
|
||||
seenDataOutPaths := make(map[string]bool)
|
||||
|
||||
for _, fi := range a.filesInfo {
|
||||
@@ -193,6 +181,8 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||
// we will have duplicated notice entries.
|
||||
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_SOONG_INSTALLED_MODULE :=", filepath.Join(modulePath, fi.stem()))
|
||||
fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS :=", fi.builtFile.String()+":"+filepath.Join(modulePath, fi.stem()))
|
||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.nameInMake())
|
||||
if fi.module != nil {
|
||||
@@ -302,18 +292,10 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||
if len(patterns) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(patterns, " "))
|
||||
}
|
||||
if len(a.compatSymlinks) > 0 {
|
||||
// For flattened apexes, compat symlinks are attached to apex_manifest.json which is guaranteed for every apex
|
||||
postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
|
||||
}
|
||||
}
|
||||
|
||||
// File_contexts of flattened APEXes should be merged into file_contexts.bin
|
||||
fmt.Fprintln(w, "LOCAL_FILE_CONTEXTS :=", a.fileContexts)
|
||||
|
||||
if len(postInstallCommands) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
|
||||
}
|
||||
}
|
||||
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
||||
}
|
||||
@@ -394,6 +376,8 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+stemSuffix)
|
||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
|
||||
fmt.Fprintln(w, "LOCAL_SOONG_INSTALLED_MODULE :=", a.installedFile.String())
|
||||
fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS :=", a.outputFile.String()+":"+a.installedFile.String())
|
||||
|
||||
// Because apex writes .mk with Custom(), we need to write manually some common properties
|
||||
// which are available via data.Entries
|
||||
@@ -418,16 +402,6 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
|
||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.requiredDeps, " "))
|
||||
}
|
||||
a.writeRequiredModules(w, name)
|
||||
var postInstallCommands []string
|
||||
if a.prebuiltFileToDelete != "" {
|
||||
postInstallCommands = append(postInstallCommands, "rm -rf "+
|
||||
filepath.Join(a.installDir.ToMakePath().String(), a.prebuiltFileToDelete))
|
||||
}
|
||||
// For unflattened apexes, compat symlinks are attached to apex package itself as LOCAL_POST_INSTALL_CMD
|
||||
postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
|
||||
if len(postInstallCommands) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
|
||||
}
|
||||
|
||||
if a.mergedNotices.Merged.Valid() {
|
||||
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNotices.Merged.Path().String())
|
||||
|
Reference in New Issue
Block a user