Remove EnforceRROExemptedTargets
There is no more target relying on EnforceRROExemptedTargets Bug: 150820813 Test: m Change-Id: If50d22c0e4f99e8c50d6a30cb94a0c3a5646b6fa
This commit is contained in:
parent
abf3f3c0ef
commit
cee5ba973d
4 changed files with 21 additions and 52 deletions
|
@ -946,13 +946,7 @@ func (c *config) ArtUseReadBarrier() bool {
|
||||||
// More info: https://source.android.com/devices/architecture/rros
|
// More info: https://source.android.com/devices/architecture/rros
|
||||||
func (c *config) EnforceRROForModule(name string) bool {
|
func (c *config) EnforceRROForModule(name string) bool {
|
||||||
enforceList := c.productVariables.EnforceRROTargets
|
enforceList := c.productVariables.EnforceRROTargets
|
||||||
// TODO(b/150820813) Some modules depend on static overlay, remove this after eliminating the dependency.
|
|
||||||
exemptedList := c.productVariables.EnforceRROExemptedTargets
|
|
||||||
if len(exemptedList) > 0 {
|
|
||||||
if InList(name, exemptedList) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(enforceList) > 0 {
|
if len(enforceList) > 0 {
|
||||||
if InList("*", enforceList) {
|
if InList("*", enforceList) {
|
||||||
return true
|
return true
|
||||||
|
@ -961,11 +955,6 @@ func (c *config) EnforceRROForModule(name string) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *config) EnforceRROExemptedForModule(name string) bool {
|
|
||||||
return InList(name, c.productVariables.EnforceRROExemptedTargets)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *config) EnforceRROExcludedOverlay(path string) bool {
|
func (c *config) EnforceRROExcludedOverlay(path string) bool {
|
||||||
excluded := c.productVariables.EnforceRROExcludedOverlays
|
excluded := c.productVariables.EnforceRROExcludedOverlays
|
||||||
if len(excluded) > 0 {
|
if len(excluded) > 0 {
|
||||||
|
|
|
@ -199,11 +199,9 @@ type productVariables struct {
|
||||||
CrossHostArch *string `json:",omitempty"`
|
CrossHostArch *string `json:",omitempty"`
|
||||||
CrossHostSecondaryArch *string `json:",omitempty"`
|
CrossHostSecondaryArch *string `json:",omitempty"`
|
||||||
|
|
||||||
DeviceResourceOverlays []string `json:",omitempty"`
|
DeviceResourceOverlays []string `json:",omitempty"`
|
||||||
ProductResourceOverlays []string `json:",omitempty"`
|
ProductResourceOverlays []string `json:",omitempty"`
|
||||||
EnforceRROTargets []string `json:",omitempty"`
|
EnforceRROTargets []string `json:",omitempty"`
|
||||||
// TODO(b/150820813) Some modules depend on static overlay, remove this after eliminating the dependency.
|
|
||||||
EnforceRROExemptedTargets []string `json:",omitempty"`
|
|
||||||
EnforceRROExcludedOverlays []string `json:",omitempty"`
|
EnforceRROExcludedOverlays []string `json:",omitempty"`
|
||||||
|
|
||||||
AAPTCharacteristics *string `json:",omitempty"`
|
AAPTCharacteristics *string `json:",omitempty"`
|
||||||
|
|
18
java/aar.go
18
java/aar.go
|
@ -160,8 +160,8 @@ func (a *aapt) SetRROEnforcedForDependent(enforce bool) {
|
||||||
func (a *aapt) IsRROEnforced(ctx android.BaseModuleContext) bool {
|
func (a *aapt) IsRROEnforced(ctx android.BaseModuleContext) bool {
|
||||||
// True if RRO is enforced for this module or...
|
// True if RRO is enforced for this module or...
|
||||||
return ctx.Config().EnforceRROForModule(ctx.ModuleName()) ||
|
return ctx.Config().EnforceRROForModule(ctx.ModuleName()) ||
|
||||||
// if RRO is enforced for any of its dependents, and this module is not exempted.
|
// if RRO is enforced for any of its dependents.
|
||||||
(a.aaptProperties.RROEnforcedForDependent && !ctx.Config().EnforceRROExemptedForModule(ctx.ModuleName()))
|
a.aaptProperties.RROEnforcedForDependent
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext,
|
func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext,
|
||||||
|
@ -443,16 +443,14 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
|
||||||
assets = append(assets, aarDep.ExportedAssets().Path())
|
assets = append(assets, aarDep.ExportedAssets().Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.Config().EnforceRROExemptedForModule(ctx.ModuleName()) {
|
outer:
|
||||||
outer:
|
for _, d := range aarDep.ExportedRRODirs() {
|
||||||
for _, d := range aarDep.ExportedRRODirs() {
|
for _, e := range staticRRODirs {
|
||||||
for _, e := range staticRRODirs {
|
if d.path == e.path {
|
||||||
if d.path == e.path {
|
continue outer
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
staticRRODirs = append(staticRRODirs, d)
|
|
||||||
}
|
}
|
||||||
|
staticRRODirs = append(staticRRODirs, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,47 +263,34 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
|
||||||
|
|
||||||
func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
|
func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
enforceRROTargets []string
|
enforceRROTargets []string
|
||||||
enforceRROExemptTargets []string
|
rroDirs map[string][]string
|
||||||
rroDirs map[string][]string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "no RRO",
|
name: "no RRO",
|
||||||
enforceRROTargets: nil,
|
enforceRROTargets: nil,
|
||||||
enforceRROExemptTargets: nil,
|
|
||||||
rroDirs: map[string][]string{
|
rroDirs: map[string][]string{
|
||||||
"foo": nil,
|
"foo": nil,
|
||||||
"bar": nil,
|
"bar": nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enforce RRO on all",
|
name: "enforce RRO on all",
|
||||||
enforceRROTargets: []string{"*"},
|
enforceRROTargets: []string{"*"},
|
||||||
enforceRROExemptTargets: nil,
|
|
||||||
rroDirs: map[string][]string{
|
rroDirs: map[string][]string{
|
||||||
"foo": {"product/vendor/blah/overlay/lib2/res"},
|
"foo": {"product/vendor/blah/overlay/lib2/res"},
|
||||||
"bar": {"product/vendor/blah/overlay/lib2/res"},
|
"bar": {"product/vendor/blah/overlay/lib2/res"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "enforce RRO on foo",
|
name: "enforce RRO on foo",
|
||||||
enforceRROTargets: []string{"foo"},
|
enforceRROTargets: []string{"foo"},
|
||||||
enforceRROExemptTargets: nil,
|
|
||||||
rroDirs: map[string][]string{
|
rroDirs: map[string][]string{
|
||||||
"foo": {"product/vendor/blah/overlay/lib2/res"},
|
"foo": {"product/vendor/blah/overlay/lib2/res"},
|
||||||
"bar": {"product/vendor/blah/overlay/lib2/res"},
|
"bar": {"product/vendor/blah/overlay/lib2/res"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "enforce RRO on foo, bar exempted",
|
|
||||||
enforceRROTargets: []string{"foo"},
|
|
||||||
enforceRROExemptTargets: []string{"bar"},
|
|
||||||
rroDirs: map[string][]string{
|
|
||||||
"foo": {"product/vendor/blah/overlay/lib2/res"},
|
|
||||||
"bar": nil,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
productResourceOverlays := []string{
|
productResourceOverlays := []string{
|
||||||
|
@ -351,9 +338,6 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
|
||||||
if testCase.enforceRROTargets != nil {
|
if testCase.enforceRROTargets != nil {
|
||||||
config.TestProductVariables.EnforceRROTargets = testCase.enforceRROTargets
|
config.TestProductVariables.EnforceRROTargets = testCase.enforceRROTargets
|
||||||
}
|
}
|
||||||
if testCase.enforceRROExemptTargets != nil {
|
|
||||||
config.TestProductVariables.EnforceRROExemptedTargets = testCase.enforceRROExemptTargets
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := testContext(config)
|
ctx := testContext(config)
|
||||||
run(t, ctx, config)
|
run(t, ctx, config)
|
||||||
|
|
Loading…
Reference in a new issue