Package coverage files as a zip.
Test: make NATIVE_COVERAGE=true COVERAGE_PATHS="*"
Change-Id: I955212a20ea19c854ebc88635252a1d174ea8f7f
diff --git a/cc/builder.go b/cc/builder.go
index d2727b3..88a6534 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -227,6 +227,14 @@
blueprint.RuleParams{
Command: "gunzip -c $in > $out",
})
+
+ zip = pctx.AndroidStaticRule("zip",
+ blueprint.RuleParams{
+ Command: "cat $out.rsp | tr ' ' '\\n' | tr -d \\' | sort -u > ${out}.tmp && ${SoongZipCmd} -o ${out} -C $$OUT_DIR -l ${out}.tmp",
+ CommandDeps: []string{"${SoongZipCmd}"},
+ Rspfile: "$out.rsp",
+ RspfileContent: "$in",
+ })
)
func init() {
@@ -239,6 +247,8 @@
// Darwin doesn't have /proc
pctx.StaticVariable("relPwd", "")
}
+
+ pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
}
type builderFlags struct {
@@ -877,13 +887,18 @@
})
}
-func TransformCoverageFilesToLib(ctx android.ModuleContext,
- inputs Objects, flags builderFlags, baseName string) android.OptionalPath {
+func TransformCoverageFilesToZip(ctx android.ModuleContext,
+ inputs Objects, baseName string) android.OptionalPath {
if len(inputs.coverageFiles) > 0 {
- outputFile := android.PathForModuleOut(ctx, baseName+".gcnodir")
+ outputFile := android.PathForModuleOut(ctx, baseName+".zip")
- TransformObjToStaticLib(ctx, inputs.coverageFiles, flags, outputFile, nil)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: zip,
+ Description: "zip " + outputFile.Base(),
+ Inputs: inputs.coverageFiles,
+ Output: outputFile,
+ })
return android.OptionalPathForPath(outputFile)
}