diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-03 19:13:16 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-02-03 19:13:16 +0000 |
commit | 3756ab846048d0cc0e581ae51706936afd1b6c78 (patch) | |
tree | eead4840c7c62b2cc2954ba4fa415e56eac1a852 | |
parent | 93567935fd147a7a0086fd94594ccf113953bfd8 (diff) | |
parent | baa54c6ed830a7cd1cb7fe5405c7a33b65c9a2cc (diff) | |
download | build_soong-3756ab846048d0cc0e581ae51706936afd1b6c78.tar.gz build_soong-3756ab846048d0cc0e581ae51706936afd1b6c78.tar.bz2 build_soong-3756ab846048d0cc0e581ae51706936afd1b6c78.zip |
Package coverage files as a zip. am: baa54c6ed8
Change-Id: I6c9890781efb0eb2a0667d1e8e22c06a07411aaa
-rw-r--r-- | cc/binary.go | 2 | ||||
-rw-r--r-- | cc/builder.go | 23 | ||||
-rw-r--r-- | cc/library.go | 4 |
3 files changed, 22 insertions, 7 deletions
diff --git a/cc/binary.go b/cc/binary.go index aa5b2794..1b749146 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -388,7 +388,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext, objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.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 // information but will not call 'install' diff --git a/cc/builder.go b/cc/builder.go index fc5400c7..a9ee4e92 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -227,6 +227,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() { @@ -239,6 +247,8 @@ func init() { // Darwin doesn't have /proc pctx.StaticVariable("relPwd", "") } + + pctx.HostBinToolVariable("SoongZipCmd", "soong_zip") } type builderFlags struct { @@ -867,13 +877,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) } diff --git a/cc/library.go b/cc/library.go index d8eb5b4e..71d8170e 100644 --- a/cc/library.go +++ b/cc/library.go @@ -629,7 +629,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext, 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) library.wholeStaticMissingDeps = ctx.GetMissingDependencies() @@ -741,7 +741,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext, objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.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) return ret |