Merge "Add overrides property to prebuilt_apex"

This commit is contained in:
Jaewoong Jung
2019-07-18 17:35:07 +00:00
committed by Gerrit Code Review
2 changed files with 58 additions and 31 deletions

View File

@@ -1430,6 +1430,13 @@ type PrebuiltProperties struct {
// Optional name for the installed apex. If unspecified, name of the
// module is used as the file name
Filename *string
// Names of modules to be overridden. Listed modules can only be other binaries
// (in Make or Soong).
// This does not completely prevent installation of the overridden binaries, but if both
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
// from PRODUCT_PACKAGES.
Overrides []string
}
func (p *Prebuilt) installable() bool {
@@ -1525,17 +1532,16 @@ func (p *Prebuilt) Name() string {
return p.prebuilt.Name(p.ModuleBase.Name())
}
func (p *Prebuilt) AndroidMk() android.AndroidMkData {
return android.AndroidMkData{
func (p *Prebuilt) AndroidMkEntries() android.AndroidMkEntries {
return android.AndroidMkEntries{
Class: "ETC",
OutputFile: android.OptionalPathForPath(p.inputApex),
Include: "$(BUILD_PREBUILT)",
Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", p.installDir.RelPathString()))
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", p.installFilename)
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !p.installable())
},
AddCustomEntries: func(name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", filepath.Join("$(OUT_DIR)", p.installDir.RelPathString()))
entries.SetString("LOCAL_MODULE_STEM", p.installFilename)
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.installable())
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", p.properties.Overrides...)
},
}
}