Add installable property to apex module type
When set to false, the apex is built but not installed. Useful for not polluting the system image with test APEXes when doing mma. Bug: 120960303 Test: add 'installable: false' to apex.test under system/apex/tests/Android.bp m; check that out/..../system/apex/apex.test.apex does not exist. Change-Id: I383d5cdcc8aec705b6a5778dbd07233471d289d0
This commit is contained in:
parent
1ee00b54d9
commit
92c0f9ce54
1 changed files with 21 additions and 8 deletions
29
apex/apex.go
29
apex/apex.go
|
@ -211,6 +211,9 @@ type apexBundleProperties struct {
|
||||||
// or an android_app_certificate module name in the form ":module".
|
// or an android_app_certificate module name in the form ":module".
|
||||||
Certificate *string
|
Certificate *string
|
||||||
|
|
||||||
|
// Whether this APEX is installable to one of the partitions. Default: true.
|
||||||
|
Installable *bool
|
||||||
|
|
||||||
Multilib struct {
|
Multilib struct {
|
||||||
First struct {
|
First struct {
|
||||||
// List of native libraries whose compile_multilib is "first"
|
// 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]}
|
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) {
|
func getCopyManifestForNativeLibrary(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
|
||||||
// Decide the APEX-local directory by the multilib of the library
|
// Decide the APEX-local directory by the multilib of the library
|
||||||
// In the future, we may query this to the module.
|
// In the future, we may query this to the module.
|
||||||
|
@ -776,18 +783,22 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
|
||||||
})
|
})
|
||||||
|
|
||||||
// Install to $OUT/soong/{target,host}/.../apex
|
// Install to $OUT/soong/{target,host}/.../apex
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
|
if a.installable() {
|
||||||
|
ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
|
func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
|
||||||
// For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along
|
if a.installable() {
|
||||||
// with other ordinary files.
|
// For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along
|
||||||
manifest := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"))
|
// with other ordinary files.
|
||||||
a.filesInfo = append(a.filesInfo, apexFile{manifest, ctx.ModuleName() + ".apex_manifest.json", android.Common, ".", etc})
|
manifest := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"))
|
||||||
|
a.filesInfo = append(a.filesInfo, apexFile{manifest, ctx.ModuleName() + ".apex_manifest.json", android.Common, ".", etc})
|
||||||
|
|
||||||
for _, fi := range a.filesInfo {
|
for _, fi := range a.filesInfo {
|
||||||
dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
|
dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
|
||||||
ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
|
ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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_INSTALLED_MODULE_STEM :=", fi.builtFile.Base())
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
|
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
|
||||||
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
|
||||||
archStr := fi.archType.String()
|
archStr := fi.archType.String()
|
||||||
if archStr != "common" {
|
if archStr != "common" {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
|
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_PREBUILT_MODULE_FILE :=", a.outputFiles[apexType].String())
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString()))
|
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_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, "LOCAL_REQUIRED_MODULES :=", String(a.properties.Key))
|
||||||
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue