summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go69
1 files changed, 44 insertions, 25 deletions
diff --git a/android/module.go b/android/module.go
index b689a87f2..337ae4076 100644
--- a/android/module.go
+++ b/android/module.go
@@ -198,7 +198,7 @@ type ModuleContext interface {
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
- InstallForceOS() *OsType
+ InstallForceOS() (*OsType, *ArchType)
RequiredModuleNames() []string
HostRequiredModuleNames() []string
@@ -247,6 +247,7 @@ type Module interface {
Disable()
Enabled() bool
Target() Target
+ Owner() string
InstallInData() bool
InstallInTestcases() bool
InstallInSanitizerDir() bool
@@ -254,10 +255,12 @@ type Module interface {
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
- InstallForceOS() *OsType
+ InstallForceOS() (*OsType, *ArchType)
SkipInstall()
IsSkipInstall() bool
MakeUninstallable()
+ ReplacedByPrebuilt()
+ IsReplacedByPrebuilt() bool
ExportedToMake() bool
InitRc() Paths
VintfFragments() Paths
@@ -490,14 +493,6 @@ type commonProperties struct {
// relative path to a file to include in the list of notices for the device
Notice *string `android:"path"`
- // configuration to distribute output files from this module to the distribution
- // directory (default: $OUT/dist, configurable with $DIST_DIR)
- Dist Dist `android:"arch_variant"`
-
- // a list of configurations to distribute output files from this module to the
- // distribution directory (default: $OUT/dist, configurable with $DIST_DIR)
- Dists []Dist `android:"arch_variant"`
-
// The OsType of artifacts that this module variant is responsible for creating.
//
// Set by osMutator
@@ -550,6 +545,9 @@ type commonProperties struct {
SkipInstall bool `blueprint:"mutated"`
+ // Whether the module has been replaced by a prebuilt
+ ReplacedByPrebuilt bool `blueprint:"mutated"`
+
// Disabled by mutators. If set to true, it overrides Enabled property.
ForcedDisabled bool `blueprint:"mutated"`
@@ -566,6 +564,16 @@ type commonProperties struct {
ImageVariation string `blueprint:"mutated"`
}
+type distProperties struct {
+ // configuration to distribute output files from this module to the distribution
+ // directory (default: $OUT/dist, configurable with $DIST_DIR)
+ Dist Dist `android:"arch_variant"`
+
+ // a list of configurations to distribute output files from this module to the
+ // distribution directory (default: $OUT/dist, configurable with $DIST_DIR)
+ Dists []Dist `android:"arch_variant"`
+}
+
// A map of OutputFile tag keys to Paths, for disting purposes.
type TaggedDistFiles map[string]Paths
@@ -661,7 +669,8 @@ func InitAndroidModule(m Module) {
m.AddProperties(
&base.nameProperties,
- &base.commonProperties)
+ &base.commonProperties,
+ &base.distProperties)
initProductVariableModule(m)
@@ -752,6 +761,7 @@ type ModuleBase struct {
nameProperties nameProperties
commonProperties commonProperties
+ distProperties distProperties
variableProperties interface{}
hostAndDeviceProperties hostAndDeviceProperties
generalProperties []interface{}
@@ -861,13 +871,13 @@ func (m *ModuleBase) visibilityProperties() []visibilityProperty {
}
func (m *ModuleBase) Dists() []Dist {
- if len(m.commonProperties.Dist.Targets) > 0 {
+ if len(m.distProperties.Dist.Targets) > 0 {
// Make a copy of the underlying Dists slice to protect against
// backing array modifications with repeated calls to this method.
- distsCopy := append([]Dist(nil), m.commonProperties.Dists...)
- return append(distsCopy, m.commonProperties.Dist)
+ distsCopy := append([]Dist(nil), m.distProperties.Dists...)
+ return append(distsCopy, m.distProperties.Dist)
} else {
- return m.commonProperties.Dists
+ return m.distProperties.Dists
}
}
@@ -1063,6 +1073,15 @@ func (m *ModuleBase) MakeUninstallable() {
m.SkipInstall()
}
+func (m *ModuleBase) ReplacedByPrebuilt() {
+ m.commonProperties.ReplacedByPrebuilt = true
+ m.SkipInstall()
+}
+
+func (m *ModuleBase) IsReplacedByPrebuilt() bool {
+ return m.commonProperties.ReplacedByPrebuilt
+}
+
func (m *ModuleBase) ExportedToMake() bool {
return m.commonProperties.NamespaceExportedToMake
}
@@ -1116,8 +1135,8 @@ func (m *ModuleBase) InstallBypassMake() bool {
return false
}
-func (m *ModuleBase) InstallForceOS() *OsType {
- return nil
+func (m *ModuleBase) InstallForceOS() (*OsType, *ArchType) {
+ return nil, nil
}
func (m *ModuleBase) Owner() string {
@@ -1344,20 +1363,20 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
ctx.Variable(pctx, "moduleDescSuffix", s)
// Some common property checks for properties that will be used later in androidmk.go
- if m.commonProperties.Dist.Dest != nil {
- _, err := validateSafePath(*m.commonProperties.Dist.Dest)
+ if m.distProperties.Dist.Dest != nil {
+ _, err := validateSafePath(*m.distProperties.Dist.Dest)
if err != nil {
ctx.PropertyErrorf("dist.dest", "%s", err.Error())
}
}
- if m.commonProperties.Dist.Dir != nil {
- _, err := validateSafePath(*m.commonProperties.Dist.Dir)
+ if m.distProperties.Dist.Dir != nil {
+ _, err := validateSafePath(*m.distProperties.Dist.Dir)
if err != nil {
ctx.PropertyErrorf("dist.dir", "%s", err.Error())
}
}
- if m.commonProperties.Dist.Suffix != nil {
- if strings.Contains(*m.commonProperties.Dist.Suffix, "/") {
+ if m.distProperties.Dist.Suffix != nil {
+ if strings.Contains(*m.distProperties.Dist.Suffix, "/") {
ctx.PropertyErrorf("dist.suffix", "Suffix may not contain a '/' character.")
}
}
@@ -2017,7 +2036,7 @@ func (m *moduleContext) InstallBypassMake() bool {
return m.module.InstallBypassMake()
}
-func (m *moduleContext) InstallForceOS() *OsType {
+func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) {
return m.module.InstallForceOS()
}
@@ -2246,7 +2265,7 @@ func OutputFileForModule(ctx PathContext, module blueprint.Module, tag string) P
return nil
}
if len(paths) > 1 {
- reportPathErrorf(ctx, "got multiple output files from module %q, expected exactly one",
+ ReportPathErrorf(ctx, "got multiple output files from module %q, expected exactly one",
pathContextName(ctx, module))
return nil
}