From 9ab4933a1ca3d8627b94d3d6b69b952451ceedd4 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Wed, 10 Jun 2020 15:44:25 +0100 Subject: [PATCH] Remove host boot image from boot.zip. Host boot image is not needed in boot.zip, which is used for the ART APK scanner and runs on target. This commit also changes the paths in the boot.zip by removing OS subdirectory. Test: lunch aosp_cf_x86_phone-userdebug && m Test: m out/soong/vsoc_x86/dex_bootjars/boot.zip \ && zipinfo -1 out/soong/vsoc_x86/dex_bootjars/boot.zip system/framework/x86/boot-framework.art system/framework/x86/boot-framework.oat system/framework/x86/boot-ext.art system/framework/x86/boot-ext.oat system/framework/x86/boot-core-icu4j.art system/framework/x86/boot-core-icu4j.oat system/framework/x86/boot-telephony-common.art system/framework/x86/boot-telephony-common.oat system/framework/x86/boot-voip-common.art system/framework/x86/boot-voip-common.oat system/framework/x86/boot-ims-common.art system/framework/x86/boot-ims-common.oat system/framework/x86/boot-framework-atb-backward-compatibility.art system/framework/x86/boot-framework-atb-backward-compatibility.oat system/framework/x86/boot-framework.vdex system/framework/x86/boot-ext.vdex system/framework/x86/boot-core-icu4j.vdex system/framework/x86/boot-telephony-common.vdex system/framework/x86/boot-voip-common.vdex system/framework/x86/boot-ims-common.vdex system/framework/x86/boot-framework-atb-backward-compatibility.vdex Change-Id: Idf0541908059c454348181d90b0b3e5d6d350057 --- java/dexpreopt_bootjars.go | 10 ++++++---- java/dexpreopt_bootjars_test.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 9d9383814..e6a431343 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -340,10 +340,12 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI bootFrameworkProfileRule(ctx, image, missingDeps) updatableBcpPackagesRule(ctx, image, missingDeps) - var allFiles android.Paths + var zipFiles android.Paths for _, variant := range image.variants { files := buildBootImageVariant(ctx, variant, profile, missingDeps) - allFiles = append(allFiles, files.Paths()...) + if variant.target.Os == android.Android { + zipFiles = append(zipFiles, files.Paths()...) + } } if image.zip != nil { @@ -351,8 +353,8 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI rule.Command(). BuiltTool(ctx, "soong_zip"). FlagWithOutput("-o ", image.zip). - FlagWithArg("-C ", image.dir.String()). - FlagWithInputList("-f ", allFiles, " -f ") + FlagWithArg("-C ", image.dir.Join(ctx, android.Android.String()).String()). + FlagWithInputList("-f ", zipFiles, " -f ") rule.Build(pctx, ctx, "zip_"+image.name, "zip "+image.name+" image") } diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index e9704dc2a..9670c7f4b 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -118,7 +118,7 @@ func TestDexpreoptBootZip(t *testing.T) { ctx := android.PathContextForTesting(testConfig(nil, "", nil)) expectedInputs := []string{} - for _, target := range dexpreoptTargets(ctx) { + for _, target := range ctx.Config().Targets[android.Android] { for _, ext := range []string{".art", ".oat", ".vdex"} { for _, jar := range []string{"foo", "bar", "baz"} { expectedInputs = append(expectedInputs,