diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-02-04 00:43:58 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-02-04 00:43:58 +0000 |
| commit | abc4f820a1e5c7bd69412c802dbaf0743a2f18db (patch) | |
| tree | e053ab8d3f4ad9e9caeb65d762de1ba86083b65f /apex/apex.go | |
| parent | c2cf2c5dbe777e67d0dfc9f3130c265c81dd6198 (diff) | |
| parent | 49932f3e6975f5a39d8f9f5b064431d105740ada (diff) | |
| download | build_soong-abc4f820a1e5c7bd69412c802dbaf0743a2f18db.tar.gz build_soong-abc4f820a1e5c7bd69412c802dbaf0743a2f18db.tar.bz2 build_soong-abc4f820a1e5c7bd69412c802dbaf0743a2f18db.zip | |
Merge "Build native coverage variant of APEXes when needed" into qt-dev
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 e5d431ed..cb789eb2 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -267,6 +267,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 { @@ -549,7 +553,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 { @@ -584,6 +588,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. @@ -1083,6 +1099,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)) @@ -1172,8 +1193,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 { |
