Merge "Create sanitizer variants of APEX only when SANITIZE_TARGET is set"

This commit is contained in:
Treehugger Robot
2019-01-29 02:46:31 +00:00
committed by Gerrit Code Review
2 changed files with 13 additions and 5 deletions

View File

@@ -483,9 +483,17 @@ func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
} }
} }
func (a *apexBundle) IsSanitizerEnabled() bool { func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
// APEX can be mutated for sanitizers globalSanitizerNames := []string{}
return true if a.Host() {
globalSanitizerNames = ctx.Config().SanitizeHost()
} else {
arches := ctx.Config().SanitizeDeviceArch()
if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) {
globalSanitizerNames = ctx.Config().SanitizeDevice()
}
}
return android.InList(sanitizerName, globalSanitizerNames)
} }
func getCopyManifestForNativeLibrary(cc *cc.Module) (fileToCopy android.Path, dirInApex string) { func getCopyManifestForNativeLibrary(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {

View File

@@ -820,7 +820,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
type Sanitizeable interface { type Sanitizeable interface {
android.Module android.Module
IsSanitizerEnabled() bool IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool
} }
// Create sanitized variants for modules that need them // Create sanitized variants for modules that need them
@@ -924,7 +924,7 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
} }
} }
c.sanitize.Properties.SanitizeDep = false c.sanitize.Properties.SanitizeDep = false
} else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled() { } else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok && sanitizeable.IsSanitizerEnabled(mctx, t.String()) {
// APEX modules fall here // APEX modules fall here
mctx.CreateVariations(t.String()) mctx.CreateVariations(t.String())
} }