Loading apex/apex.go +11 −3 Original line number Original line Diff line number Diff line Loading @@ -511,6 +511,14 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { if cert != "" { if cert != "" { ctx.AddDependency(ctx.Module(), certificateTag, 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 { func (a *apexBundle) getCertString(ctx android.BaseContext) string { Loading Loading @@ -793,7 +801,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and certificate = java.Certificate{pem, key} 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 var abis []string for _, target := range ctx.MultiTargets() { for _, target := range ctx.MultiTargets() { Loading Loading @@ -890,7 +898,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and } } if a.properties.AndroidManifest != nil { 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) implicitInputs = append(implicitInputs, androidManifestFile) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) } } Loading Loading @@ -969,7 +977,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { if a.installable() { if a.installable() { // For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along // For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along // with other ordinary files. // 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 // rename to apex_manifest.json copiedManifest := android.PathForModuleOut(ctx, "apex_manifest.json") copiedManifest := android.PathForModuleOut(ctx, "apex_manifest.json") Loading apex/apex_test.go +14 −0 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ func testApex(t *testing.T, bp string) *android.TestContext { ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() Loading Loading @@ -143,6 +144,7 @@ func testApex(t *testing.T, bp string) *android.TestContext { "Android.bp": []byte(bp), "Android.bp": []byte(bp), "build/target/product/security": nil, "build/target/product/security": nil, "apex_manifest.json": nil, "apex_manifest.json": nil, "AndroidManifest.xml": nil, "system/sepolicy/apex/myapex-file_contexts": nil, "system/sepolicy/apex/myapex-file_contexts": nil, "system/sepolicy/apex/myapex_keytest-file_contexts": nil, "system/sepolicy/apex/myapex_keytest-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, Loading Loading @@ -214,6 +216,8 @@ func TestBasicApex(t *testing.T) { ctx := testApex(t, ` ctx := testApex(t, ` apex_defaults { apex_defaults { name: "myapex-defaults", name: "myapex-defaults", manifest: ":myapex.manifest", androidManifest: ":myapex.androidmanifest", key: "myapex.key", key: "myapex.key", native_shared_libs: ["mylib"], native_shared_libs: ["mylib"], multilib: { multilib: { Loading @@ -234,6 +238,16 @@ func TestBasicApex(t *testing.T) { private_key: "testkey.pem", private_key: "testkey.pem", } } filegroup { name: "myapex.manifest", srcs: ["apex_manifest.json"], } filegroup { name: "myapex.androidmanifest", srcs: ["AndroidManifest.xml"], } cc_library { cc_library { name: "mylib", name: "mylib", srcs: ["mylib.cpp"], srcs: ["mylib.cpp"], Loading Loading
apex/apex.go +11 −3 Original line number Original line Diff line number Diff line Loading @@ -511,6 +511,14 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { if cert != "" { if cert != "" { ctx.AddDependency(ctx.Module(), certificateTag, 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 { func (a *apexBundle) getCertString(ctx android.BaseContext) string { Loading Loading @@ -793,7 +801,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and certificate = java.Certificate{pem, key} 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 var abis []string for _, target := range ctx.MultiTargets() { for _, target := range ctx.MultiTargets() { Loading Loading @@ -890,7 +898,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and } } if a.properties.AndroidManifest != nil { 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) implicitInputs = append(implicitInputs, androidManifestFile) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) } } Loading Loading @@ -969,7 +977,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { if a.installable() { if a.installable() { // For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along // For flattened APEX, do nothing but make sure that apex_manifest.json file is also copied along // with other ordinary files. // 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 // rename to apex_manifest.json copiedManifest := android.PathForModuleOut(ctx, "apex_manifest.json") copiedManifest := android.PathForModuleOut(ctx, "apex_manifest.json") Loading
apex/apex_test.go +14 −0 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ func testApex(t *testing.T, bp string) *android.TestContext { ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory)) ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) ctx.RegisterModuleType("android_app_certificate", android.ModuleFactoryAdaptor(java.AndroidAppCertificateFactory)) ctx.RegisterModuleType("filegroup", android.ModuleFactoryAdaptor(android.FileGroupFactory)) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("image", cc.ImageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() ctx.BottomUp("link", cc.LinkageMutator).Parallel() Loading Loading @@ -143,6 +144,7 @@ func testApex(t *testing.T, bp string) *android.TestContext { "Android.bp": []byte(bp), "Android.bp": []byte(bp), "build/target/product/security": nil, "build/target/product/security": nil, "apex_manifest.json": nil, "apex_manifest.json": nil, "AndroidManifest.xml": nil, "system/sepolicy/apex/myapex-file_contexts": nil, "system/sepolicy/apex/myapex-file_contexts": nil, "system/sepolicy/apex/myapex_keytest-file_contexts": nil, "system/sepolicy/apex/myapex_keytest-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, "system/sepolicy/apex/otherapex-file_contexts": nil, Loading Loading @@ -214,6 +216,8 @@ func TestBasicApex(t *testing.T) { ctx := testApex(t, ` ctx := testApex(t, ` apex_defaults { apex_defaults { name: "myapex-defaults", name: "myapex-defaults", manifest: ":myapex.manifest", androidManifest: ":myapex.androidmanifest", key: "myapex.key", key: "myapex.key", native_shared_libs: ["mylib"], native_shared_libs: ["mylib"], multilib: { multilib: { Loading @@ -234,6 +238,16 @@ func TestBasicApex(t *testing.T) { private_key: "testkey.pem", private_key: "testkey.pem", } } filegroup { name: "myapex.manifest", srcs: ["apex_manifest.json"], } filegroup { name: "myapex.androidmanifest", srcs: ["AndroidManifest.xml"], } cc_library { cc_library { name: "mylib", name: "mylib", srcs: ["mylib.cpp"], srcs: ["mylib.cpp"], Loading