Package coverage files as a zip.
Test: make NATIVE_COVERAGE=true COVERAGE_PATHS="*" Change-Id: I955212a20ea19c854ebc88635252a1d174ea8f7f
This commit is contained in:
@@ -388,7 +388,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
|||||||
|
|
||||||
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
|
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
|
||||||
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
|
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
|
||||||
binary.coverageOutputFile = TransformCoverageFilesToLib(ctx, objs, builderFlags, binary.getStem(ctx))
|
binary.coverageOutputFile = TransformCoverageFilesToZip(ctx, objs, binary.getStem(ctx))
|
||||||
|
|
||||||
// Need to determine symlinks early since some targets (ie APEX) need this
|
// Need to determine symlinks early since some targets (ie APEX) need this
|
||||||
// information but will not call 'install'
|
// information but will not call 'install'
|
||||||
|
@@ -227,6 +227,14 @@ var (
|
|||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: "gunzip -c $in > $out",
|
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() {
|
func init() {
|
||||||
@@ -239,6 +247,8 @@ func init() {
|
|||||||
// Darwin doesn't have /proc
|
// Darwin doesn't have /proc
|
||||||
pctx.StaticVariable("relPwd", "")
|
pctx.StaticVariable("relPwd", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
||||||
}
|
}
|
||||||
|
|
||||||
type builderFlags struct {
|
type builderFlags struct {
|
||||||
@@ -877,13 +887,18 @@ func TransformDarwinStrip(ctx android.ModuleContext, inputFile android.Path,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TransformCoverageFilesToLib(ctx android.ModuleContext,
|
func TransformCoverageFilesToZip(ctx android.ModuleContext,
|
||||||
inputs Objects, flags builderFlags, baseName string) android.OptionalPath {
|
inputs Objects, baseName string) android.OptionalPath {
|
||||||
|
|
||||||
if len(inputs.coverageFiles) > 0 {
|
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)
|
return android.OptionalPathForPath(outputFile)
|
||||||
}
|
}
|
||||||
|
@@ -643,7 +643,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
|
|||||||
|
|
||||||
TransformObjToStaticLib(ctx, library.objects.objFiles, builderFlags, outputFile, objs.tidyFiles)
|
TransformObjToStaticLib(ctx, library.objects.objFiles, builderFlags, outputFile, objs.tidyFiles)
|
||||||
|
|
||||||
library.coverageOutputFile = TransformCoverageFilesToLib(ctx, library.objects, builderFlags,
|
library.coverageOutputFile = TransformCoverageFilesToZip(ctx, library.objects,
|
||||||
ctx.ModuleName()+library.MutatedProperties.VariantName)
|
ctx.ModuleName()+library.MutatedProperties.VariantName)
|
||||||
|
|
||||||
library.wholeStaticMissingDeps = ctx.GetMissingDependencies()
|
library.wholeStaticMissingDeps = ctx.GetMissingDependencies()
|
||||||
@@ -755,7 +755,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
|||||||
objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.sAbiDumpFiles...)
|
objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.sAbiDumpFiles...)
|
||||||
objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
|
objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
|
||||||
|
|
||||||
library.coverageOutputFile = TransformCoverageFilesToLib(ctx, objs, builderFlags, library.getLibName(ctx))
|
library.coverageOutputFile = TransformCoverageFilesToZip(ctx, objs, library.getLibName(ctx))
|
||||||
library.linkSAbiDumpFiles(ctx, objs, fileName, ret)
|
library.linkSAbiDumpFiles(ctx, objs, fileName, ret)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
Reference in New Issue
Block a user