summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go141
1 files changed, 93 insertions, 48 deletions
diff --git a/android/module.go b/android/module.go
index 20caae2d8..44f7583a2 100644
--- a/android/module.go
+++ b/android/module.go
@@ -15,9 +15,6 @@
package android
import (
- "bytes"
- "encoding/gob"
- "errors"
"fmt"
"net/url"
"path/filepath"
@@ -81,6 +78,7 @@ type Module interface {
InstallInOdm() bool
InstallInProduct() bool
InstallInVendor() bool
+ InstallInSystemExt() bool
InstallForceOS() (*OsType, *ArchType)
PartitionTag(DeviceConfig) string
HideFromMake()
@@ -1005,14 +1003,6 @@ func addRequiredDeps(ctx BottomUpMutatorContext) {
return
}
- // Do not create a dependency from common variant to arch variant for `common_first` modules
- if multilib, _ := decodeMultilib(ctx, ctx.Module().base()); multilib == string(MultilibCommonFirst) {
- commonVariant := ctx.Arch().ArchType.Multilib == ""
- if bothInAndroid && commonVariant && InList(target.Arch.ArchType.Multilib, []string{"lib32", "lib64"}) {
- return
- }
- }
-
variation := target.Variations()
if ctx.OtherModuleFarDependencyVariantExists(variation, depName) {
ctx.AddFarVariationDependencies(variation, RequiredDepTag, depName)
@@ -1514,6 +1504,10 @@ func (m *ModuleBase) InstallInVendor() bool {
return Bool(m.commonProperties.Vendor) || Bool(m.commonProperties.Soc_specific) || Bool(m.commonProperties.Proprietary)
}
+func (m *ModuleBase) InstallInSystemExt() bool {
+ return Bool(m.commonProperties.System_ext_specific)
+}
+
func (m *ModuleBase) InstallInRoot() bool {
return false
}
@@ -1801,6 +1795,26 @@ type FinalModuleBuildTargetsInfo struct {
var FinalModuleBuildTargetsProvider = blueprint.NewProvider[FinalModuleBuildTargetsInfo]()
+type CommonPropertiesProviderData struct {
+ Enabled bool
+ // Whether the module has been replaced by a prebuilt
+ ReplacedByPrebuilt bool
+}
+
+var CommonPropertiesProviderKey = blueprint.NewProvider[CommonPropertiesProviderData]()
+
+type PrebuiltModuleProviderData struct {
+ // Empty for now
+}
+
+var PrebuiltModuleProviderKey = blueprint.NewProvider[PrebuiltModuleProviderData]()
+
+type HostToolProviderData struct {
+ HostToolPath OptionalPath
+}
+
+var HostToolProviderKey = blueprint.NewProvider[HostToolProviderData]()
+
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
ctx := &moduleContext{
module: m.module,
@@ -2046,6 +2060,23 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
})
}
buildComplianceMetadataProvider(ctx, m)
+
+ commonData := CommonPropertiesProviderData{
+ ReplacedByPrebuilt: m.commonProperties.ReplacedByPrebuilt,
+ }
+ if m.commonProperties.ForcedDisabled {
+ commonData.Enabled = false
+ } else {
+ commonData.Enabled = m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled)
+ }
+ SetProvider(ctx, CommonPropertiesProviderKey, commonData)
+ if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil {
+ SetProvider(ctx, PrebuiltModuleProviderKey, PrebuiltModuleProviderData{})
+ }
+ if h, ok := m.module.(HostToolProvider); ok {
+ SetProvider(ctx, HostToolProviderKey, HostToolProviderData{
+ HostToolPath: h.HostToolPath()})
+ }
}
func SetJarJarPrefixHandler(handler func(ModuleContext)) {
@@ -2125,36 +2156,47 @@ type katiInstall struct {
orderOnlyDeps Paths
executable bool
extraFiles *extraFilesZip
+ absFrom string
+}
- absFrom string
+type katiInstallGob struct {
+ From Path
+ To InstallPath
+ ImplicitDeps Paths
+ OrderOnlyDeps Paths
+ Executable bool
+ ExtraFiles *extraFilesZip
+ AbsFrom string
}
-func (p *katiInstall) GobEncode() ([]byte, error) {
- w := new(bytes.Buffer)
- encoder := gob.NewEncoder(w)
- err := errors.Join(encoder.Encode(p.from), encoder.Encode(p.to),
- encoder.Encode(p.implicitDeps), encoder.Encode(p.orderOnlyDeps),
- encoder.Encode(p.executable), encoder.Encode(p.extraFiles),
- encoder.Encode(p.absFrom))
- if err != nil {
- return nil, err
+func (k *katiInstall) ToGob() *katiInstallGob {
+ return &katiInstallGob{
+ From: k.from,
+ To: k.to,
+ ImplicitDeps: k.implicitDeps,
+ OrderOnlyDeps: k.orderOnlyDeps,
+ Executable: k.executable,
+ ExtraFiles: k.extraFiles,
+ AbsFrom: k.absFrom,
}
+}
- return w.Bytes(), nil
+func (k *katiInstall) FromGob(data *katiInstallGob) {
+ k.from = data.From
+ k.to = data.To
+ k.implicitDeps = data.ImplicitDeps
+ k.orderOnlyDeps = data.OrderOnlyDeps
+ k.executable = data.Executable
+ k.extraFiles = data.ExtraFiles
+ k.absFrom = data.AbsFrom
}
-func (p *katiInstall) GobDecode(data []byte) error {
- r := bytes.NewBuffer(data)
- decoder := gob.NewDecoder(r)
- err := errors.Join(decoder.Decode(&p.from), decoder.Decode(&p.to),
- decoder.Decode(&p.implicitDeps), decoder.Decode(&p.orderOnlyDeps),
- decoder.Decode(&p.executable), decoder.Decode(&p.extraFiles),
- decoder.Decode(&p.absFrom))
- if err != nil {
- return err
- }
+func (k *katiInstall) GobEncode() ([]byte, error) {
+ return blueprint.CustomGobEncode[katiInstallGob](k)
+}
- return nil
+func (k *katiInstall) GobDecode(data []byte) error {
+ return blueprint.CustomGobDecode[katiInstallGob](data, k)
}
type extraFilesZip struct {
@@ -2162,26 +2204,29 @@ type extraFilesZip struct {
dir InstallPath
}
-func (p *extraFilesZip) GobEncode() ([]byte, error) {
- w := new(bytes.Buffer)
- encoder := gob.NewEncoder(w)
- err := errors.Join(encoder.Encode(p.zip), encoder.Encode(p.dir))
- if err != nil {
- return nil, err
+type extraFilesZipGob struct {
+ Zip Path
+ Dir InstallPath
+}
+
+func (e *extraFilesZip) ToGob() *extraFilesZipGob {
+ return &extraFilesZipGob{
+ Zip: e.zip,
+ Dir: e.dir,
}
+}
- return w.Bytes(), nil
+func (e *extraFilesZip) FromGob(data *extraFilesZipGob) {
+ e.zip = data.Zip
+ e.dir = data.Dir
}
-func (p *extraFilesZip) GobDecode(data []byte) error {
- r := bytes.NewBuffer(data)
- decoder := gob.NewDecoder(r)
- err := errors.Join(decoder.Decode(&p.zip), decoder.Decode(&p.dir))
- if err != nil {
- return err
- }
+func (e *extraFilesZip) GobEncode() ([]byte, error) {
+ return blueprint.CustomGobEncode[extraFilesZipGob](e)
+}
- return nil
+func (e *extraFilesZip) GobDecode(data []byte) error {
+ return blueprint.CustomGobDecode[extraFilesZipGob](data, e)
}
type katiInstalls []katiInstall