Support sanitizer variants inside make builds

am: bc6fb16b26

* commit 'bc6fb16b26dedee0e9f10239cb9a6c8a3e647b04':
  Support sanitizer variants inside make builds

Change-Id: I5c75ac2dcc8a11eba3155e0d1d382edb176e8de7
This commit is contained in:
Colin Cross 2016-05-25 19:29:07 +00:00 committed by android-build-merger
commit 991008ce19
3 changed files with 13 additions and 29 deletions

View File

@ -24,6 +24,11 @@ import (
)
func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
if c.Properties.HideFromMake {
ret.Disabled = true
return ret, nil
}
ret.OutputFile = c.outputFile
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) (err error) {
fmt.Fprintln(w, "LOCAL_SANITIZE := never")

View File

@ -427,6 +427,7 @@ type BaseProperties struct {
No_default_compiler_flags *bool
AndroidMkSharedLibs []string `blueprint:"mutated"`
HideFromMake bool `blueprint:"mutated"`
}
type InstallerProperties struct {
@ -992,20 +993,6 @@ func (c *Module) InstallInData() bool {
return c.installer.inData()
}
type appendVariantName interface {
appendVariantName(string)
}
func (c *Module) appendVariantName(name string) {
if c.linker == nil {
return
}
if l, ok := c.linker.(appendVariantName); ok {
l.appendVariantName(name)
}
}
// Compiler
type baseCompiler struct {
@ -1476,7 +1463,6 @@ type libraryLinker struct {
}
var _ linker = (*libraryLinker)(nil)
var _ appendVariantName = (*libraryLinker)(nil)
func (library *libraryLinker) props() []interface{} {
props := library.baseLinker.props()
@ -1667,10 +1653,6 @@ func (library *libraryLinker) installable() bool {
return !library.static()
}
func (library *libraryLinker) appendVariantName(variant string) {
library.Properties.VariantName += variant
}
type libraryInstaller struct {
baseInstaller

View File

@ -335,17 +335,14 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
modules[0].(*Module).sanitize.Properties.InData = true
}
} else if c.sanitize.Properties.SanitizeDep {
modules := mctx.CreateVariations("", t.String())
modules[0].(*Module).sanitize.SetSanitizer(t, false)
modules[1].(*Module).sanitize.SetSanitizer(t, true)
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
modules[1].(*Module).sanitize.Properties.InData = true
if mctx.AConfig().EmbeddedInMake() {
modules := mctx.CreateVariations(t.String())
modules[0].(*Module).sanitize.SetSanitizer(t, true)
modules[0].(*Module).sanitize.Properties.InData = true
} else {
modules := mctx.CreateVariations("", t.String())
modules[0].(*Module).sanitize.SetSanitizer(t, false)
modules[1].(*Module).sanitize.SetSanitizer(t, true)
modules[1].(*Module).appendVariantName("_" + t.String())
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
modules[0].(*Module).Properties.HideFromMake = true
}
}
c.sanitize.Properties.SanitizeDep = false