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

Commit a706cc8c authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Avoid extra copy of JNI libs zip" into main

parents c8a5d7c7 b3168bac
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -225,8 +225,6 @@ func BuildBundleModule(ctx android.ModuleContext, outputFile android.WritablePat
	})
}

const jniJarOutputPathString = "jniJarOutput.zip"

func TransformJniLibsToJar(
	ctx android.ModuleContext,
	outputFile android.WritablePath,
@@ -258,7 +256,10 @@ func TransformJniLibsToJar(
		rule = zipRE
		args["implicits"] = strings.Join(deps.Strings(), ",")
	}
	jniJarPath := android.PathForModuleOut(ctx, jniJarOutputPathString)
	var jniJarPath android.WritablePath = android.PathForModuleOut(ctx, "jniJarOutput.zip")
	if len(prebuiltJniPackages) == 0 {
		jniJarPath = outputFile
	}
	ctx.Build(pctx, android.BuildParams{
		Rule:        rule,
		Description: "zip jni libs",
@@ -266,6 +267,7 @@ func TransformJniLibsToJar(
		Implicits:   deps,
		Args:        args,
	})
	if len(prebuiltJniPackages) > 0 {
		ctx.Build(pctx, android.BuildParams{
			Rule:        mergeAssetsRule,
			Description: "merge prebuilt JNI packages",
@@ -273,6 +275,7 @@ func TransformJniLibsToJar(
			Output:      outputFile,
		})
	}
}

func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
	javaApiUsedByOutputFile := android.PathForModuleOut(ctx, a.installApkName+"_using.xml")
+4 −4
Original line number Diff line number Diff line
@@ -1742,7 +1742,7 @@ func TestJNIABI(t *testing.T) {
	for _, test := range testCases {
		t.Run(test.name, func(t *testing.T) {
			app := ctx.ModuleForTests(test.name, "android_common")
			jniLibZip := app.Output(jniJarOutputPathString)
			jniLibZip := app.Output("jnilibs.zip")
			var abis []string
			args := strings.Fields(jniLibZip.Args["jarArgs"])
			for i := 0; i < len(args); i++ {
@@ -1875,7 +1875,7 @@ func TestJNIPackaging(t *testing.T) {
	for _, test := range testCases {
		t.Run(test.name, func(t *testing.T) {
			app := ctx.ModuleForTests(test.name, "android_common")
			jniLibZip := app.MaybeOutput(jniJarOutputPathString)
			jniLibZip := app.MaybeOutput("jnilibs.zip")
			if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
				t.Errorf("expected jni packaged %v, got %v", w, g)
			}
@@ -1966,7 +1966,7 @@ func TestJNISDK(t *testing.T) {
		t.Run(test.name, func(t *testing.T) {
			app := ctx.ModuleForTests(test.name, "android_common")

			jniLibZip := app.MaybeOutput(jniJarOutputPathString)
			jniLibZip := app.MaybeOutput("jnilibs.zip")
			if len(jniLibZip.Implicits) != 1 {
				t.Fatalf("expected exactly one jni library, got %q", jniLibZip.Implicits.Strings())
			}
@@ -2986,7 +2986,7 @@ func TestStl(t *testing.T) {
	for _, test := range testCases {
		t.Run(test.name, func(t *testing.T) {
			app := ctx.ModuleForTests(test.name, "android_common")
			jniLibZip := app.Output(jniJarOutputPathString)
			jniLibZip := app.Output("jnilibs.zip")
			var jnis []string
			args := strings.Fields(jniLibZip.Args["jarArgs"])
			for i := 0; i < len(args); i++ {