Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ccf6449 authored by Jiyong Park's avatar Jiyong Park Committed by android-build-merger
Browse files

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

am: bf920d52

Change-Id: Id4eaf24164cebb8678628ccac8ca34158526a47f
parents a83face4 bf920d52
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -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 {
@@ -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() {
@@ -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())
		}
		}
@@ -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")
+14 −0
Original line number Original line Diff line number Diff line
@@ -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()
@@ -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,
@@ -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: {
@@ -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"],