diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/android/module.go b/android/module.go index 057a5c71f..02b2c8926 100644 --- a/android/module.go +++ b/android/module.go @@ -128,6 +128,13 @@ type BaseModuleContext interface { // and returns a top-down dependency path from a start module to current child module. GetWalkPath() []Module + // GetTagPath is supposed to be called in visit function passed in WalkDeps() + // and returns a top-down dependency tags path from a start module to current child module. + // It has one less entry than GetWalkPath() as it contains the dependency tags that + // exist between each adjacent pair of modules in the GetWalkPath(). + // GetTagPath()[i] is the tag between GetWalkPath()[i] and GetWalkPath()[i+1] + GetTagPath() []blueprint.DependencyTag + AddMissingDependencies(missingDeps []string) Target() Target @@ -220,6 +227,7 @@ type Module interface { InstallBypassMake() bool InstallForceOS() *OsType SkipInstall() + IsSkipInstall() bool ExportedToMake() bool InitRc() Paths VintfFragments() Paths @@ -894,6 +902,40 @@ func (m *ModuleBase) SystemExtSpecific() bool { return Bool(m.commonProperties.System_ext_specific) } +func (m *ModuleBase) PartitionTag(config DeviceConfig) string { + partition := "system" + if m.SocSpecific() { + // A SoC-specific module could be on the vendor partition at + // "vendor" or the system partition at "system/vendor". + if config.VendorPath() == "vendor" { + partition = "vendor" + } + } else if m.DeviceSpecific() { + // A device-specific module could be on the odm partition at + // "odm", the vendor partition at "vendor/odm", or the system + // partition at "system/vendor/odm". + if config.OdmPath() == "odm" { + partition = "odm" + } else if strings.HasPrefix(config.OdmPath(), "vendor/") { + partition = "vendor" + } + } else if m.ProductSpecific() { + // A product-specific module could be on the product partition + // at "product" or the system partition at "system/product". + if config.ProductPath() == "product" { + partition = "product" + } + } else if m.SystemExtSpecific() { + // A system_ext-specific module could be on the system_ext + // partition at "system_ext" or the system partition at + // "system/system_ext". + if config.SystemExtPath() == "system_ext" { + partition = "system_ext" + } + } + return partition +} + func (m *ModuleBase) Enabled() bool { if m.commonProperties.Enabled == nil { return !m.Os().DefaultDisabled @@ -909,6 +951,10 @@ func (m *ModuleBase) SkipInstall() { m.commonProperties.SkipInstall = true } +func (m *ModuleBase) IsSkipInstall() bool { + return m.commonProperties.SkipInstall == true +} + func (m *ModuleBase) ExportedToMake() bool { return m.commonProperties.NamespaceExportedToMake } @@ -1366,6 +1412,7 @@ type baseModuleContext struct { debug bool walkPath []Module + tagPath []blueprint.DependencyTag strictVisitDeps bool // If true, enforce that all dependencies are enabled } @@ -1472,10 +1519,17 @@ func (m *moduleContext) Variable(pctx PackageContext, name, value string) { func (m *moduleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams, argNames ...string) blueprint.Rule { - if m.config.UseRemoteBuild() && params.Pool == nil { - // When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict - // jobs to the local parallelism value - params.Pool = localPool + if m.config.UseRemoteBuild() { + if params.Pool == nil { + // When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict + // jobs to the local parallelism value + params.Pool = localPool + } else if params.Pool == remotePool { + // remotePool is a fake pool used to identify rule that are supported for remoting. If the rule's + // pool is the remotePool, replace with nil so that ninja runs it at NINJA_REMOTE_NUM_JOBS + // parallelism. + params.Pool = nil + } } rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...) @@ -1655,6 +1709,7 @@ func (b *baseModuleContext) WalkDepsBlueprint(visit func(blueprint.Module, bluep func (b *baseModuleContext) WalkDeps(visit func(Module, Module) bool) { b.walkPath = []Module{b.Module()} + b.tagPath = []blueprint.DependencyTag{} b.bp.WalkDeps(func(child, parent blueprint.Module) bool { childAndroidModule, _ := child.(Module) parentAndroidModule, _ := parent.(Module) @@ -1662,8 +1717,10 @@ func (b *baseModuleContext) WalkDeps(visit func(Module, Module) bool) { // record walkPath before visit for b.walkPath[len(b.walkPath)-1] != parentAndroidModule { b.walkPath = b.walkPath[0 : len(b.walkPath)-1] + b.tagPath = b.tagPath[0 : len(b.tagPath)-1] } b.walkPath = append(b.walkPath, childAndroidModule) + b.tagPath = append(b.tagPath, b.OtherModuleDependencyTag(childAndroidModule)) return visit(childAndroidModule, parentAndroidModule) } else { return false @@ -1675,6 +1732,10 @@ func (b *baseModuleContext) GetWalkPath() []Module { return b.walkPath } +func (b *baseModuleContext) GetTagPath() []blueprint.DependencyTag { + return b.tagPath +} + func (m *moduleContext) VisitAllModuleVariants(visit func(Module)) { m.bp.VisitAllModuleVariants(func(module blueprint.Module) { visit(module.(Module)) |