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

Commit 03b470da authored by Mohammad Islam's avatar Mohammad Islam Committed by Automerger Merge Worker
Browse files

Merge "Relax restriction on suffix of apex_set filename to include .capex" am:...

Merge "Relax restriction on suffix of apex_set filename to include .capex" am: 385cde82 am: 17544fe2 am: 2bfa44c7 am: f8366ac0

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821656

Change-Id: I6aac02541a0fb2b42aa20c437f3df0b285709a04
parents 51d1651c f8366ac0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -382,7 +382,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
				fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String())
				stemSuffix := apexType.suffix()
				if a.isCompressed {
					stemSuffix = ".capex"
					stemSuffix = imageCapexSuffix
				}
				fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+stemSuffix)
				fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
+4 −3
Original line number Diff line number Diff line
@@ -1142,6 +1142,7 @@ const (
const (
	// File extensions of an APEX for different packaging methods
	imageApexSuffix  = ".apex"
	imageCapexSuffix = ".capex"
	zipApexSuffix    = ".zipapex"
	flattenedSuffix  = ".flattened"

+29 −0
Original line number Diff line number Diff line
@@ -4490,6 +4490,35 @@ func TestPrebuiltFilenameOverride(t *testing.T) {
	}
}

func TestApexSetFilenameOverride(t *testing.T) {
	testApex(t, `
		apex_set {
 			name: "com.company.android.myapex",
			apex_name: "com.android.myapex",
			set: "company-myapex.apks",
      filename: "com.company.android.myapex.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",
      filename: "com.company.android.myapex.capex"
		}
	`).ModuleForTests("com.company.android.myapex", "android_common_com.android.myapex")

	testApexError(t, `filename should end in .apex or .capex for apex_set`, `
		apex_set {
 			name: "com.company.android.myapex",
			apex_name: "com.android.myapex",
			set: "company-myapex.apks",
      filename: "some-random-suffix"
		}
	`)
}

func TestPrebuiltOverrides(t *testing.T) {
	ctx := testApex(t, `
		prebuilt_apex {
+2 −2
Original line number Diff line number Diff line
@@ -786,7 +786,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {

	if apexType == imageApex && (compressionEnabled || a.testOnlyShouldForceCompression()) {
		a.isCompressed = true
		unsignedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+".capex.unsigned")
		unsignedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+imageCapexSuffix+".unsigned")

		compressRule := android.NewRuleBuilder(pctx, ctx)
		compressRule.Command().
@@ -800,7 +800,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
			FlagWithOutput("--output ", unsignedCompressedOutputFile)
		compressRule.Build("compressRule", "Generate unsigned compressed APEX file")

		signedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+".capex")
		signedCompressedOutputFile := android.PathForModuleOut(ctx, a.Name()+imageCapexSuffix)
		if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_SIGNAPK") {
			args["outCommaList"] = signedCompressedOutputFile.String()
		}
+2 −2
Original line number Diff line number Diff line
@@ -919,8 +919,8 @@ func (a *ApexSet) ApexInfoMutator(mctx android.TopDownMutatorContext) {

func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	a.installFilename = a.InstallFilename()
	if !strings.HasSuffix(a.installFilename, imageApexSuffix) {
		ctx.ModuleErrorf("filename should end in %s for apex_set", imageApexSuffix)
	if !strings.HasSuffix(a.installFilename, imageApexSuffix) && !strings.HasSuffix(a.installFilename, imageCapexSuffix) {
		ctx.ModuleErrorf("filename should end in %s or %s for apex_set", imageApexSuffix, imageCapexSuffix)
	}

	inputApex := android.OptionalPathForModuleSrc(ctx, a.prebuiltCommonProperties.Selected_apex).Path()