Add no_apex property

This change adds 'no_apex' property which, when set to true, prevents
the module from being installed to any APEX. If the module is included
either directly or transitively in an APEX, but build fails.

Bug: 139016109
Test: m

Change-Id: If1478aa9660a3442f7dd1ffe45e4ca5611a6acbe
This commit is contained in:
Jiyong Park
2019-08-12 10:37:49 +09:00
committed by Sundong Ahn
parent 3440835748
commit 4f7dd9b4db
3 changed files with 113 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import (
"sync"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
// ApexModule is the interface that a module type is expected to implement if
@@ -74,9 +75,15 @@ type ApexModule interface {
// Sets the name of the apex variant of this module. Called inside
// CreateApexVariations.
setApexName(apexName string)
// Return the no_apex property
NoApex() bool
}
type ApexProperties struct {
// Whether this module should not be part of any APEX. Default is false.
No_apex *bool
// Name of the apex variant that this module is mutated into
ApexName string `blueprint:"mutated"`
}
@@ -125,6 +132,10 @@ func (m *ApexModuleBase) IsInstallableToApex() bool {
return false
}
func (m *ApexModuleBase) NoApex() bool {
return proptools.Bool(m.ApexProperties.No_apex)
}
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []blueprint.Module {
if len(m.apexVariations) > 0 {
sort.Strings(m.apexVariations)