From 2adba487bb28d7195eeaca1820cd5121face59c5 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Thu, 22 Feb 2024 17:27:53 +0900 Subject: [PATCH] apex: run host_apex_verifier For now, the tool checks .rc files: - .rc files are okay. - services should run binary in apex. Bug: 223896570 Test: m Change-Id: I469c20afeff01cf10955ff2419113d6ac2d4cf45 --- apex/builder.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apex/builder.go b/apex/builder.go index 0d084834d..31f9c9097 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -83,6 +83,7 @@ func init() { pctx.HostBinToolVariable("assemble_vintf", "assemble_vintf") pctx.HostBinToolVariable("apex_elf_checker", "apex_elf_checker") pctx.HostBinToolVariable("aconfig", "aconfig") + pctx.HostBinToolVariable("host_apex_verifier", "host_apex_verifier") } type createStorageStruct struct { @@ -249,6 +250,13 @@ var ( Description: "run apex_linkerconfig_validation", }, "image_dir") + apexHostVerifierRule = pctx.StaticRule("apexHostVerifierRule", blueprint.RuleParams{ + Command: `${host_apex_verifier} --deapexer=${deapexer} --debugfs=${debugfs_static} ` + + `--fsckerofs=${fsck_erofs} --apex=${in} && touch ${out}`, + CommandDeps: []string{"${host_apex_verifier}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}"}, + Description: "run host_apex_verifier", + }) + assembleVintfRule = pctx.StaticRule("assembleVintfRule", blueprint.RuleParams{ Command: `rm -f $out && VINTF_IGNORE_TARGET_FCM_VERSION=true ${assemble_vintf} -i $in -o $out`, CommandDeps: []string{"${assemble_vintf}"}, @@ -952,6 +960,9 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { validations = append(validations, runApexElfCheckerUnwanted(ctx, unsignedOutputFile.OutputPath, a.properties.Unwanted_transitive_deps)) } + if !a.testApex && android.InList(a.payloadFsType, []fsType{ext4, erofs}) { + validations = append(validations, runApexHostVerifier(ctx, unsignedOutputFile.OutputPath)) + } ctx.Build(pctx, android.BuildParams{ Rule: rule, Description: "signapk", @@ -1246,3 +1257,13 @@ func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.Outpu }) return timestamp } + +func runApexHostVerifier(ctx android.ModuleContext, apexFile android.OutputPath) android.Path { + timestamp := android.PathForModuleOut(ctx, "host_apex_verifier.timestamp") + ctx.Build(pctx, android.BuildParams{ + Rule: apexHostVerifierRule, + Input: apexFile, + Output: timestamp, + }) + return timestamp +}