Merge "Override modules should always override source modules" into main
This commit is contained in:
@@ -253,6 +253,15 @@ type overrideBaseDependencyTag struct {
|
|||||||
|
|
||||||
var overrideBaseDepTag overrideBaseDependencyTag
|
var overrideBaseDepTag overrideBaseDependencyTag
|
||||||
|
|
||||||
|
// Override module should always override the source module.
|
||||||
|
// Overrides are implemented as a variant of the overridden module, and the build actions are created in the
|
||||||
|
// module context of the overridden module.
|
||||||
|
// If we replace override module with the prebuilt of the overridden module, `GenerateAndroidBuildActions` for
|
||||||
|
// the override module will have a very different meaning.
|
||||||
|
func (tag overrideBaseDependencyTag) ReplaceSourceWithPrebuilt() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Adds dependency on the base module to the overriding module so that they can be visited in the
|
// Adds dependency on the base module to the overriding module so that they can be visited in the
|
||||||
// next phase.
|
// next phase.
|
||||||
func overrideModuleDepsMutator(ctx BottomUpMutatorContext) {
|
func overrideModuleDepsMutator(ctx BottomUpMutatorContext) {
|
||||||
|
@@ -11671,3 +11671,38 @@ func TestApexMinSdkVersionOverride(t *testing.T) {
|
|||||||
checkMinSdkVersion(t, overridingModuleDifferentMinSdkVersion, "31")
|
checkMinSdkVersion(t, overridingModuleDifferentMinSdkVersion, "31")
|
||||||
checkHasDep(t, ctx, overridingModuleDifferentMinSdkVersion.Module(), javalibApex31Variant.Module())
|
checkHasDep(t, ctx, overridingModuleDifferentMinSdkVersion.Module(), javalibApex31Variant.Module())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestOverrideApexWithPrebuiltApexPreferred(t *testing.T) {
|
||||||
|
context := android.GroupFixturePreparers(
|
||||||
|
android.PrepareForIntegrationTestWithAndroid,
|
||||||
|
PrepareForTestWithApexBuildComponents,
|
||||||
|
android.FixtureMergeMockFs(android.MockFS{
|
||||||
|
"system/sepolicy/apex/foo-file_contexts": nil,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
res := context.RunTestWithBp(t, `
|
||||||
|
apex {
|
||||||
|
name: "foo",
|
||||||
|
key: "myapex.key",
|
||||||
|
apex_available_name: "com.android.foo",
|
||||||
|
variant_version: "0",
|
||||||
|
updatable: false,
|
||||||
|
}
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
prebuilt_apex {
|
||||||
|
name: "foo",
|
||||||
|
src: "foo.apex",
|
||||||
|
prefer: true,
|
||||||
|
}
|
||||||
|
override_apex {
|
||||||
|
name: "myoverrideapex",
|
||||||
|
base: "foo",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
java.CheckModuleHasDependency(t, res.TestContext, "myoverrideapex", "android_common_myoverrideapex_myoverrideapex", "foo")
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user