From ad9ce044fb9c556b0962bf07422f4743a42c33eb Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 31 Oct 2018 22:49:57 +0900 Subject: [PATCH] Prebuilt_etc can be uninstallable For APEXs, we need different prebuilt_etc modules having the same 'filename' properties, because we expect them to have same local path inside APEXs. For example, we will have ./etc/ld.config.txt file for APEXs having an executable. However, this can cause duplicated targets in the make world, because the prebuilt_etc modules will all be installed to the same path under /system. In order to avoid this, adding 'installable' property to prebuilt_etc module type to optionally make a module to be non-installable, but only to APEXs. Test: build/soong/build_test.bash --dist Change-Id: Iadb564e07d0483934548ca63f5f524a2c8515a81 --- android/prebuilt_etc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go index cc1f84616..83c38db07 100644 --- a/android/prebuilt_etc.go +++ b/android/prebuilt_etc.go @@ -44,6 +44,9 @@ type prebuiltEtcProperties struct { Recovery_available *bool InRecovery bool `blueprint:"mutated"` + + // Whether this module is directly installable to one of the partitions. Default: true. + Installable *bool } type PrebuiltEtc struct { @@ -96,6 +99,10 @@ func (p *PrebuiltEtc) SubDir() string { return String(p.properties.Sub_dir) } +func (p *PrebuiltEtc) Installable() bool { + return p.properties.Installable == nil || Bool(p.properties.Installable) +} + func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx ModuleContext) { p.sourceFilePath = ctx.ExpandSource(String(p.properties.Src), "src") filename := String(p.properties.Filename) @@ -128,6 +135,7 @@ func (p *PrebuiltEtc) AndroidMk() AndroidMkData { fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String()) fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString()) fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", p.outputFilePath.Base()) + fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !p.Installable()) if p.additionalDependencies != nil { fmt.Fprint(w, "LOCAL_ADDITIONAL_DEPENDENCIES :=") for _, path := range *p.additionalDependencies {