Merge "Add installable property to apex module type"

This commit is contained in:
Treehugger Robot
2018-12-15 17:59:41 +00:00
committed by Gerrit Code Review

View File

@@ -211,6 +211,9 @@ type apexBundleProperties struct {
// or an android_app_certificate module name in the form ":module".
Certificate *string
// Whether this APEX is installable to one of the partitions. Default: true.
Installable *bool
Multilib struct {
First struct {
// List of native libraries whose compile_multilib is "first"
@@ -449,6 +452,10 @@ func (a *apexBundle) Srcs() android.Paths {
return android.Paths{a.outputFiles[imageApex]}
}
func (a *apexBundle) installable() bool {
return a.properties.Installable == nil || proptools.Bool(a.properties.Installable)
}
func getCopyManifestForNativeLibrary(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
// Decide the APEX-local directory by the multilib of the library
// In the future, we may query this to the module.
@@ -776,10 +783,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
})
// Install to $OUT/soong/{target,host}/.../apex
if a.installable() {
ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
}
}
func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
if a.installable() {
// For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along
// with other ordinary files.
manifest := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"))
@@ -790,6 +800,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
}
}
}
func (a *apexBundle) AndroidMk() android.AndroidMkData {
writers := []android.AndroidMkData{}
@@ -832,6 +843,7 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", fi.builtFile.Base())
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
archStr := fi.archType.String()
if archStr != "common" {
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
@@ -860,6 +872,7 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFiles[apexType].String())
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString()))
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", name+apexType.suffix())
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", String(a.properties.Key))
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")