Merge "Add overrides to runtime_resource_overlay" into rvc-dev
This commit is contained in:
commit
c6026cd4ea
|
@ -671,6 +671,7 @@ func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries {
|
||||||
func(entries *android.AndroidMkEntries) {
|
func(entries *android.AndroidMkEntries) {
|
||||||
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
||||||
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
|
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
|
||||||
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -1374,6 +1374,13 @@ type RuntimeResourceOverlayProperties struct {
|
||||||
|
|
||||||
// list of android_app modules whose resources are extracted and linked against
|
// list of android_app modules whose resources are extracted and linked against
|
||||||
Resource_libs []string
|
Resource_libs []string
|
||||||
|
|
||||||
|
// Names of modules to be overridden. Listed modules can only be other overlays
|
||||||
|
// (in Make or Soong).
|
||||||
|
// This does not completely prevent installation of the overridden overlays, but if both
|
||||||
|
// overlays would be installed by default (in PRODUCT_PACKAGES) the other overlay will be removed
|
||||||
|
// from PRODUCT_PACKAGES.
|
||||||
|
Overrides []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
|
|
@ -2463,6 +2463,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||||
certificate: "platform",
|
certificate: "platform",
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
theme: "faza",
|
theme: "faza",
|
||||||
|
overrides: ["foo"],
|
||||||
}
|
}
|
||||||
|
|
||||||
android_library {
|
android_library {
|
||||||
|
@ -2510,14 +2511,15 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||||
if expected != signingFlag {
|
if expected != signingFlag {
|
||||||
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
|
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
|
||||||
}
|
}
|
||||||
path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_CERTIFICATE"]
|
androidMkEntries := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
|
||||||
|
path := androidMkEntries.EntryMap["LOCAL_CERTIFICATE"]
|
||||||
expectedPath := []string{"build/make/target/product/security/platform.x509.pem"}
|
expectedPath := []string{"build/make/target/product/security/platform.x509.pem"}
|
||||||
if !reflect.DeepEqual(path, expectedPath) {
|
if !reflect.DeepEqual(path, expectedPath) {
|
||||||
t.Errorf("Unexpected LOCAL_CERTIFICATE value: %v, expected: %v", path, expectedPath)
|
t.Errorf("Unexpected LOCAL_CERTIFICATE value: %v, expected: %v", path, expectedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check device location.
|
// Check device location.
|
||||||
path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
|
path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
|
||||||
expectedPath = []string{"/tmp/target/product/test_device/product/overlay"}
|
expectedPath = []string{"/tmp/target/product/test_device/product/overlay"}
|
||||||
if !reflect.DeepEqual(path, expectedPath) {
|
if !reflect.DeepEqual(path, expectedPath) {
|
||||||
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
|
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
|
||||||
|
@ -2525,9 +2527,16 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||||
|
|
||||||
// A themed module has a different device location
|
// A themed module has a different device location
|
||||||
m = ctx.ModuleForTests("foo_themed", "android_common")
|
m = ctx.ModuleForTests("foo_themed", "android_common")
|
||||||
path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
|
androidMkEntries = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
|
||||||
|
path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
|
||||||
expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"}
|
expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"}
|
||||||
if !reflect.DeepEqual(path, expectedPath) {
|
if !reflect.DeepEqual(path, expectedPath) {
|
||||||
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
|
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
overrides := androidMkEntries.EntryMap["LOCAL_OVERRIDES_PACKAGES"]
|
||||||
|
expectedOverrides := []string{"foo"}
|
||||||
|
if !reflect.DeepEqual(overrides, expectedOverrides) {
|
||||||
|
t.Errorf("Unexpected LOCAL_OVERRIDES_PACKAGES value: %v, expected: %v", overrides, expectedOverrides)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue