Merge "Package coverage files as a zip."

This commit is contained in:
Treehugger Robot
2019-06-12 02:00:01 +00:00
committed by Gerrit Code Review
3 changed files with 22 additions and 7 deletions

View File

@@ -228,6 +228,14 @@ var (
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() {
@@ -240,6 +248,8 @@ func init() {
// Darwin doesn't have /proc
pctx.StaticVariable("relPwd", "")
}
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
}
type builderFlags struct {
@@ -883,13 +893,18 @@ func TransformDarwinStrip(ctx android.ModuleContext, inputFile android.Path,
})
}
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)
}