Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/, which is also the one used for the apex variations. Introduce a callback to retrieve that name consistently for all APEX modules (apex, override_apex, prebuilt_apex, and apex_set), and update some apex mutator code paths to use it. For APEX source modules (apex and override_apex), it's necessary to add a new field in apexBundle, since the name property gets overridden for the override variant that override_apex creates. Cherry-picked from https://r.android.com/1748294. Test: m nothing Bug: 191269918 Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5 Merged-In: If8612639bffdf91cbcab3387b0603bf5dffef1f5
This commit is contained in:
@@ -3670,13 +3670,13 @@ func TestApexName(t *testing.T) {
|
||||
}
|
||||
`)
|
||||
|
||||
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
|
||||
module := ctx.ModuleForTests("myapex", "android_common_com.android.myapex_image")
|
||||
apexManifestRule := module.Rule("apexManifestRule")
|
||||
ensureContains(t, apexManifestRule.Args["opt"], "-v name com.android.myapex")
|
||||
apexRule := module.Rule("apexRule")
|
||||
ensureContains(t, apexRule.Args["opt_flags"], "--do_not_check_keyname")
|
||||
|
||||
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
|
||||
apexBundle := module.Module().(*apexBundle)
|
||||
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
|
||||
name := apexBundle.BaseModuleName()
|
||||
prefix := "TARGET_"
|
||||
@@ -4219,6 +4219,59 @@ func TestPrebuiltOverrides(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrebuiltApexName(t *testing.T) {
|
||||
testApex(t, `
|
||||
prebuilt_apex {
|
||||
name: "com.company.android.myapex",
|
||||
apex_name: "com.android.myapex",
|
||||
src: "company-myapex-arm.apex",
|
||||
}
|
||||
`).ModuleForTests("com.company.android.myapex", "android_common_com.android.myapex")
|
||||
|
||||
testApex(t, `
|
||||
apex_set {
|
||||
name: "com.company.android.myapex",
|
||||
apex_name: "com.android.myapex",
|
||||
set: "company-myapex.apks",
|
||||
}
|
||||
`).ModuleForTests("com.company.android.myapex", "android_common_com.android.myapex")
|
||||
}
|
||||
|
||||
func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) {
|
||||
_ = android.GroupFixturePreparers(
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithApexBuildComponents,
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
platform_bootclasspath {
|
||||
name: "platform-bootclasspath",
|
||||
fragments: [
|
||||
{
|
||||
apex: "com.android.art",
|
||||
module: "art-bootclasspath-fragment",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_apex {
|
||||
name: "com.company.android.art",
|
||||
apex_name: "com.android.art",
|
||||
src: "com.company.android.art-arm.apex",
|
||||
exported_bootclasspath_fragments: ["art-bootclasspath-fragment"],
|
||||
}
|
||||
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "art-bootclasspath-fragment",
|
||||
contents: ["core-oj"],
|
||||
}
|
||||
|
||||
java_import {
|
||||
name: "core-oj",
|
||||
jars: ["prebuilt.jar"],
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
}
|
||||
|
||||
// These tests verify that the prebuilt_apex/deapexer to java_import wiring allows for the
|
||||
// propagation of paths to dex implementation jars from the former to the latter.
|
||||
func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user