diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/android/module.go b/android/module.go index bf74cad07..9f923e2d0 100644 --- a/android/module.go +++ b/android/module.go @@ -443,6 +443,7 @@ type Module interface { Disable() Enabled() bool Target() Target + MultiTargets() []Target Owner() string InstallInData() bool InstallInTestcases() bool @@ -507,13 +508,17 @@ type Module interface { type BazelTargetModule interface { Module - BazelTargetModuleProperties() *bazel.BazelTargetModuleProperties + bazelTargetModuleProperties() *bazel.BazelTargetModuleProperties + SetBazelTargetModuleProperties(props bazel.BazelTargetModuleProperties) + + RuleClass() string + BzlLoadLocation() string } // InitBazelTargetModule is a wrapper function that decorates BazelTargetModule // with property structs containing metadata for bp2build conversion. func InitBazelTargetModule(module BazelTargetModule) { - module.AddProperties(module.BazelTargetModuleProperties()) + module.AddProperties(module.bazelTargetModuleProperties()) InitAndroidModule(module) } @@ -524,11 +529,26 @@ type BazelTargetModuleBase struct { Properties bazel.BazelTargetModuleProperties } -// BazelTargetModuleProperties getter. -func (btmb *BazelTargetModuleBase) BazelTargetModuleProperties() *bazel.BazelTargetModuleProperties { +// bazelTargetModuleProperties getter. +func (btmb *BazelTargetModuleBase) bazelTargetModuleProperties() *bazel.BazelTargetModuleProperties { return &btmb.Properties } +// SetBazelTargetModuleProperties setter for BazelTargetModuleProperties +func (btmb *BazelTargetModuleBase) SetBazelTargetModuleProperties(props bazel.BazelTargetModuleProperties) { + btmb.Properties = props +} + +// RuleClass returns the rule class for this Bazel target +func (b *BazelTargetModuleBase) RuleClass() string { + return b.bazelTargetModuleProperties().Rule_class +} + +// BzlLoadLocation returns the rule class for this Bazel target +func (b *BazelTargetModuleBase) BzlLoadLocation() string { + return b.bazelTargetModuleProperties().Bzl_load_location +} + // Qualified id for a module type qualifiedModuleName struct { // The package (i.e. directory) in which the module is defined, without trailing / @@ -733,7 +753,7 @@ type commonProperties struct { // Whether this module is installed to vendor ramdisk Vendor_ramdisk *bool - // Whether this module is built for non-native architecures (also known as native bridge binary) + // Whether this module is built for non-native architectures (also known as native bridge binary) Native_bridge_supported *bool `android:"arch_variant"` // init.rc files to be installed if this module is installed @@ -1104,8 +1124,15 @@ type ModuleBase struct { variableProperties interface{} hostAndDeviceProperties hostAndDeviceProperties generalProperties []interface{} - archProperties [][]interface{} - customizableProperties []interface{} + + // Arch specific versions of structs in generalProperties. The outer index + // has the same order as generalProperties as initialized in + // InitAndroidArchModule, and the inner index chooses the props specific to + // the architecture. The interface{} value is an archPropRoot that is + // filled with arch specific values by the arch mutator. + archProperties [][]interface{} + + customizableProperties []interface{} // Properties specific to the Blueprint to BUILD migration. bazelTargetModuleProperties bazel.BazelTargetModuleProperties @@ -1149,8 +1176,6 @@ type ModuleBase struct { initRcPaths Paths vintfFragmentsPaths Paths - - prefer32 func(ctx BaseModuleContext, base *ModuleBase, os OsType) bool } func (m *ModuleBase) ComponentDepsMutator(BottomUpMutatorContext) {} @@ -1177,10 +1202,6 @@ func (m *ModuleBase) VariablesForTests() map[string]string { return m.variables } -func (m *ModuleBase) Prefer32(prefer32 func(ctx BaseModuleContext, base *ModuleBase, os OsType) bool) { - m.prefer32 = prefer32 -} - // Name returns the name of the module. It may be overridden by individual module types, for // example prebuilts will prepend prebuilt_ to the name. func (m *ModuleBase) Name() string { @@ -1811,6 +1832,18 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) return } + m.initRcPaths = PathsForModuleSrc(ctx, m.commonProperties.Init_rc) + rcDir := PathForModuleInstall(ctx, "etc", "init") + for _, src := range m.initRcPaths { + ctx.PackageFile(rcDir, filepath.Base(src.String()), src) + } + + m.vintfFragmentsPaths = PathsForModuleSrc(ctx, m.commonProperties.Vintf_fragments) + vintfDir := PathForModuleInstall(ctx, "etc", "vintf", "manifest") + for _, src := range m.vintfFragmentsPaths { + ctx.PackageFile(vintfDir, filepath.Base(src.String()), src) + } + // Create the set of tagged dist files after calling GenerateAndroidBuildActions // as GenerateTaggedDistFiles() calls OutputFiles(tag) and so relies on the // output paths being set which must be done before or during @@ -1823,8 +1856,6 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) m.installFiles = append(m.installFiles, ctx.installFiles...) m.checkbuildFiles = append(m.checkbuildFiles, ctx.checkbuildFiles...) m.packagingSpecs = append(m.packagingSpecs, ctx.packagingSpecs...) - m.initRcPaths = PathsForModuleSrc(ctx, m.commonProperties.Init_rc) - m.vintfFragmentsPaths = PathsForModuleSrc(ctx, m.commonProperties.Vintf_fragments) for k, v := range ctx.phonies { m.phonies[k] = append(m.phonies[k], v...) } |