Merge "Rename vndk apex according to vndk version"
This commit is contained in:
15
apex/apex.go
15
apex/apex.go
@@ -222,12 +222,14 @@ func apexVndkGatherMutator(mctx android.TopDownMutatorContext) {
|
|||||||
if ab.IsNativeBridgeSupported() {
|
if ab.IsNativeBridgeSupported() {
|
||||||
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
|
||||||
}
|
}
|
||||||
vndkVersion := proptools.StringDefault(ab.vndkProperties.Vndk_version, mctx.DeviceConfig().PlatformVndkVersion())
|
|
||||||
|
vndkVersion := proptools.String(ab.vndkProperties.Vndk_version)
|
||||||
|
|
||||||
vndkApexListMutex.Lock()
|
vndkApexListMutex.Lock()
|
||||||
defer vndkApexListMutex.Unlock()
|
defer vndkApexListMutex.Unlock()
|
||||||
vndkApexList := vndkApexList(mctx.Config())
|
vndkApexList := vndkApexList(mctx.Config())
|
||||||
if other, ok := vndkApexList[vndkVersion]; ok {
|
if other, ok := vndkApexList[vndkVersion]; ok {
|
||||||
mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other.Name())
|
mctx.PropertyErrorf("vndk_version", "%v is already defined in %q", vndkVersion, other.BaseModuleName())
|
||||||
}
|
}
|
||||||
vndkApexList[vndkVersion] = ab
|
vndkApexList[vndkVersion] = ab
|
||||||
}
|
}
|
||||||
@@ -1801,6 +1803,15 @@ func vndkApexBundleFactory() android.Module {
|
|||||||
}{
|
}{
|
||||||
proptools.StringPtr("both"),
|
proptools.StringPtr("both"),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vndkVersion := proptools.StringDefault(bundle.vndkProperties.Vndk_version, "current")
|
||||||
|
if vndkVersion == "current" {
|
||||||
|
vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
|
||||||
|
bundle.vndkProperties.Vndk_version = proptools.StringPtr(vndkVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure VNDK APEX mount point is formatted as com.android.vndk.v###
|
||||||
|
bundle.properties.Apex_name = proptools.StringPtr("com.android.vndk.v" + vndkVersion)
|
||||||
})
|
})
|
||||||
return bundle
|
return bundle
|
||||||
}
|
}
|
||||||
|
@@ -1442,6 +1442,37 @@ func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVndkApexNameRule(t *testing.T) {
|
||||||
|
ctx, _ := testApex(t, `
|
||||||
|
apex_vndk {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
file_contexts: "myapex",
|
||||||
|
}
|
||||||
|
apex_vndk {
|
||||||
|
name: "myapex_v28",
|
||||||
|
key: "myapex.key",
|
||||||
|
file_contexts: "myapex",
|
||||||
|
vndk_version: "28",
|
||||||
|
}
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}`)
|
||||||
|
|
||||||
|
assertApexName := func(expected, moduleName string) {
|
||||||
|
bundle := ctx.ModuleForTests(moduleName, "android_common_"+moduleName).Module().(*apexBundle)
|
||||||
|
actual := proptools.String(bundle.properties.Apex_name)
|
||||||
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
|
t.Errorf("Got '%v', expected '%v'", actual, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assertApexName("com.android.vndk.vVER", "myapex")
|
||||||
|
assertApexName("com.android.vndk.v28", "myapex_v28")
|
||||||
|
}
|
||||||
|
|
||||||
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
|
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
|
||||||
ctx, _ := testApex(t, `
|
ctx, _ := testApex(t, `
|
||||||
apex_vndk {
|
apex_vndk {
|
||||||
|
Reference in New Issue
Block a user