Merge "Add ":name" support for manifest and androidManifest properties in apex"

This commit is contained in:
Treehugger Robot 2019-02-15 00:13:28 +00:00 committed by Gerrit Code Review
commit bf920d5264
2 changed files with 25 additions and 3 deletions

View File

@ -511,6 +511,14 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
if cert != "" {
ctx.AddDependency(ctx.Module(), certificateTag, cert)
}
if String(a.properties.Manifest) != "" {
android.ExtractSourceDeps(ctx, a.properties.Manifest)
}
if String(a.properties.AndroidManifest) != "" {
android.ExtractSourceDeps(ctx, a.properties.AndroidManifest)
}
}
func (a *apexBundle) getCertString(ctx android.BaseContext) string {
@ -793,7 +801,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
certificate = java.Certificate{pem, key}
}
manifest := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"))
manifest := ctx.ExpandSource(proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"), "manifest")
var abis []string
for _, target := range ctx.MultiTargets() {
@ -890,7 +898,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
}
if a.properties.AndroidManifest != nil {
androidManifestFile := android.PathForModuleSrc(ctx, proptools.String(a.properties.AndroidManifest))
androidManifestFile := ctx.ExpandSource(proptools.String(a.properties.AndroidManifest), "androidManifest")
implicitInputs = append(implicitInputs, androidManifestFile)
optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String())
}
@ -969,7 +977,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
if a.installable() {
// For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along
// with other ordinary files.
manifest := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"))
manifest := ctx.ExpandSource(proptools.StringDefault(a.properties.Manifest, "apex_manifest.json"), "manifest")
// rename to apex_manifest.json
copiedManifest := android.PathForModuleOut(ctx, "apex_manifest.json")

View File

@ -53,6 +53,7 @@ func testApex(t *testing.T, bp string) *android.TestContext {
ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory))
ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory))
ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory))
ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("image", cc.ImageMutator).Parallel()
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
@ -143,6 +144,7 @@ func testApex(t *testing.T, bp string) *android.TestContext {
"Android.bp": []byte(bp),
"build/target/product/security": nil,
"apex_manifest.json": nil,
"AndroidManifest.xml": nil,
"system/sepolicy/apex/myapex-file_contexts": nil,
"system/sepolicy/apex/myapex_keytest-file_contexts": nil,
"system/sepolicy/apex/otherapex-file_contexts": nil,
@ -214,6 +216,8 @@ func TestBasicApex(t *testing.T) {
ctx := testApex(t, `
apex_defaults {
name: "myapex-defaults",
manifest: ":myapex.manifest",
androidManifest: ":myapex.androidmanifest",
key: "myapex.key",
native_shared_libs: ["mylib"],
multilib: {
@ -234,6 +238,16 @@ func TestBasicApex(t *testing.T) {
private_key: "testkey.pem",
}
filegroup {
name: "myapex.manifest",
srcs: ["apex_manifest.json"],
}
filegroup {
name: "myapex.androidmanifest",
srcs: ["AndroidManifest.xml"],
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],