diff options
| author | Jiyong Park <jiyong@google.com> | 2019-08-09 14:44:36 +0900 |
|---|---|---|
| committer | Jiyong Park <jiyong@google.com> | 2019-08-16 00:01:18 +0900 |
| commit | 49932f3e6975f5a39d8f9f5b064431d105740ada (patch) | |
| tree | ff6e1a682bd4c163d2811660a474d3c0bf701529 /apex/apex.go | |
| parent | 1bc40c56b9f9f02191d14bf9812101e0ae55bb2f (diff) | |
| download | build_soong-49932f3e6975f5a39d8f9f5b064431d105740ada.tar.gz build_soong-49932f3e6975f5a39d8f9f5b064431d105740ada.tar.bz2 build_soong-49932f3e6975f5a39d8f9f5b064431d105740ada.zip | |
Build native coverage variant of APEXes when needed
When the native coverage is enabled, APEXes (and files there) are built
for native coverage as well.
Bug: 138952487
Test: make -j NATIVE_COVERAGE=true COVERAGE_PATHS='*' com.android.resolv
find out -name "*.gcno" | grep DnsResolver shows files
Test: libnetd_resolv.zip is found under
$(TARGET_OUT)/apex/com.android.resolv/lib directory
Merged-In: I97bcee9bf8ffc0dc71453abbdb613ed56ea2cdb4
(cherry picked from commit ee9a98d88ec9a792c3d67b9aed9e4571bf2544cf)
Change-Id: I97bcee9bf8ffc0dc71453abbdb613ed56ea2cdb4
Diffstat (limited to 'apex/apex.go')
| -rw-r--r-- | apex/apex.go | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/apex/apex.go b/apex/apex.go index 69a50f1c..214ed086 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -266,6 +266,10 @@ type apexBundleProperties struct { // List of sanitizer names that this APEX is enabled for SanitizerNames []string `blueprint:"mutated"` + + PreventInstall bool `blueprint:"mutated"` + + HideFromMake bool `blueprint:"mutated"` } type apexTargetBundleProperties struct { @@ -548,7 +552,7 @@ func (a *apexBundle) Srcs() android.Paths { } func (a *apexBundle) installable() bool { - return a.properties.Installable == nil || proptools.Bool(a.properties.Installable) + return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable)) } func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { @@ -583,6 +587,18 @@ func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizer return android.InList(sanitizerName, globalSanitizerNames) } +func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseContext) bool { + return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled() +} + +func (a *apexBundle) PreventInstall() { + a.properties.PreventInstall = true +} + +func (a *apexBundle) HideFromMake() { + a.properties.HideFromMake = true +} + func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fileToCopy android.Path, dirInApex string) { // Decide the APEX-local directory by the multilib of the library // In the future, we may query this to the module. @@ -1082,6 +1098,11 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) { } func (a *apexBundle) AndroidMk() android.AndroidMkData { + if a.properties.HideFromMake { + return android.AndroidMkData{ + Disabled: true, + } + } writers := []android.AndroidMkData{} if a.apexTypes.image() { writers = append(writers, a.androidMkForType(imageApex)) @@ -1171,8 +1192,13 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, name, moduleDir string, apex fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") } else if fi.class == nativeSharedLib || fi.class == nativeExecutable { fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base()) - if cc, ok := fi.module.(*cc.Module); ok && cc.UnstrippedOutputFile() != nil { - fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String()) + if cc, ok := fi.module.(*cc.Module); ok { + if cc.UnstrippedOutputFile() != nil { + fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String()) + } + if cc.CoverageOutputFile().Valid() { + fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", cc.CoverageOutputFile().String()) + } } fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk") } else { |
