Merge "Avoid extra copy of JNI libs zip" into main am: a706cc8c15
am: 286806fe61
am: d0f8e7b899
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2678496 Change-Id: I934f3d358f2334207b8b3d14abe92a44ca10fdc0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -225,8 +225,6 @@ func BuildBundleModule(ctx android.ModuleContext, outputFile android.WritablePat
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const jniJarOutputPathString = "jniJarOutput.zip"
|
|
||||||
|
|
||||||
func TransformJniLibsToJar(
|
func TransformJniLibsToJar(
|
||||||
ctx android.ModuleContext,
|
ctx android.ModuleContext,
|
||||||
outputFile android.WritablePath,
|
outputFile android.WritablePath,
|
||||||
@@ -258,7 +256,10 @@ func TransformJniLibsToJar(
|
|||||||
rule = zipRE
|
rule = zipRE
|
||||||
args["implicits"] = strings.Join(deps.Strings(), ",")
|
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{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: rule,
|
Rule: rule,
|
||||||
Description: "zip jni libs",
|
Description: "zip jni libs",
|
||||||
@@ -266,12 +267,14 @@ func TransformJniLibsToJar(
|
|||||||
Implicits: deps,
|
Implicits: deps,
|
||||||
Args: args,
|
Args: args,
|
||||||
})
|
})
|
||||||
ctx.Build(pctx, android.BuildParams{
|
if len(prebuiltJniPackages) > 0 {
|
||||||
Rule: mergeAssetsRule,
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Description: "merge prebuilt JNI packages",
|
Rule: mergeAssetsRule,
|
||||||
Inputs: append(prebuiltJniPackages, jniJarPath),
|
Description: "merge prebuilt JNI packages",
|
||||||
Output: outputFile,
|
Inputs: append(prebuiltJniPackages, jniJarPath),
|
||||||
})
|
Output: outputFile,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
|
func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
|
||||||
|
@@ -1742,7 +1742,7 @@ func TestJNIABI(t *testing.T) {
|
|||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
app := ctx.ModuleForTests(test.name, "android_common")
|
app := ctx.ModuleForTests(test.name, "android_common")
|
||||||
jniLibZip := app.Output(jniJarOutputPathString)
|
jniLibZip := app.Output("jnilibs.zip")
|
||||||
var abis []string
|
var abis []string
|
||||||
args := strings.Fields(jniLibZip.Args["jarArgs"])
|
args := strings.Fields(jniLibZip.Args["jarArgs"])
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
@@ -1875,7 +1875,7 @@ func TestJNIPackaging(t *testing.T) {
|
|||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
app := ctx.ModuleForTests(test.name, "android_common")
|
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 {
|
if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
|
||||||
t.Errorf("expected jni packaged %v, got %v", w, g)
|
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) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
app := ctx.ModuleForTests(test.name, "android_common")
|
app := ctx.ModuleForTests(test.name, "android_common")
|
||||||
|
|
||||||
jniLibZip := app.MaybeOutput(jniJarOutputPathString)
|
jniLibZip := app.MaybeOutput("jnilibs.zip")
|
||||||
if len(jniLibZip.Implicits) != 1 {
|
if len(jniLibZip.Implicits) != 1 {
|
||||||
t.Fatalf("expected exactly one jni library, got %q", jniLibZip.Implicits.Strings())
|
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 {
|
for _, test := range testCases {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
app := ctx.ModuleForTests(test.name, "android_common")
|
app := ctx.ModuleForTests(test.name, "android_common")
|
||||||
jniLibZip := app.Output(jniJarOutputPathString)
|
jniLibZip := app.Output("jnilibs.zip")
|
||||||
var jnis []string
|
var jnis []string
|
||||||
args := strings.Fields(jniLibZip.Args["jarArgs"])
|
args := strings.Fields(jniLibZip.Args["jarArgs"])
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
|
Reference in New Issue
Block a user