Merge "Refactor sanitized library on-disk layout - Soong."
This commit is contained in:
commit
94e1747051
|
@ -89,6 +89,7 @@ type ModuleContext interface {
|
||||||
AddMissingDependencies(deps []string)
|
AddMissingDependencies(deps []string)
|
||||||
|
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
InstallInSanitizerDir() bool
|
||||||
|
|
||||||
RequiredModuleNames() []string
|
RequiredModuleNames() []string
|
||||||
}
|
}
|
||||||
|
@ -103,6 +104,7 @@ type Module interface {
|
||||||
Enabled() bool
|
Enabled() bool
|
||||||
Target() Target
|
Target() Target
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
|
InstallInSanitizerDir() bool
|
||||||
SkipInstall()
|
SkipInstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +401,10 @@ func (p *ModuleBase) InstallInData() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ModuleBase) InstallInSanitizerDir() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (a *ModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) {
|
func (a *ModuleBase) generateModuleTarget(ctx blueprint.ModuleContext) {
|
||||||
allInstalledFiles := Paths{}
|
allInstalledFiles := Paths{}
|
||||||
allCheckbuildFiles := Paths{}
|
allCheckbuildFiles := Paths{}
|
||||||
|
@ -629,6 +635,10 @@ func (a *androidModuleContext) InstallInData() bool {
|
||||||
return a.module.InstallInData()
|
return a.module.InstallInData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) InstallInSanitizerDir() bool {
|
||||||
|
return a.module.InstallInSanitizerDir()
|
||||||
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path,
|
func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path,
|
||||||
deps ...Path) OutputPath {
|
deps ...Path) OutputPath {
|
||||||
|
|
||||||
|
|
|
@ -652,7 +652,10 @@ func PathForModuleInstall(ctx ModuleContext, paths ...string) OutputPath {
|
||||||
if ctx.Proprietary() {
|
if ctx.Proprietary() {
|
||||||
partition = ctx.DeviceConfig().VendorPath()
|
partition = ctx.DeviceConfig().VendorPath()
|
||||||
}
|
}
|
||||||
if ctx.InstallInData() {
|
|
||||||
|
if ctx.InstallInSanitizerDir() {
|
||||||
|
partition = "data/asan/" + partition
|
||||||
|
} else if ctx.InstallInData() {
|
||||||
partition = "data"
|
partition = "data"
|
||||||
}
|
}
|
||||||
outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), partition}
|
outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), partition}
|
||||||
|
|
12
cc/cc.go
12
cc/cc.go
|
@ -212,6 +212,7 @@ type installer interface {
|
||||||
installerProps() []interface{}
|
installerProps() []interface{}
|
||||||
install(ctx ModuleContext, path android.Path)
|
install(ctx ModuleContext, path android.Path)
|
||||||
inData() bool
|
inData() bool
|
||||||
|
inSanitizerDir() bool
|
||||||
hostToolPath() android.OptionalPath
|
hostToolPath() android.OptionalPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,10 +994,17 @@ func (c *Module) InstallInData() bool {
|
||||||
if c.installer == nil {
|
if c.installer == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if c.sanitize != nil && c.sanitize.inData() {
|
return c.installer.inData()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Module) InstallInSanitizerDir() bool {
|
||||||
|
if c.installer == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if c.sanitize != nil && c.sanitize.inSanitizerDir() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return c.installer.inData()
|
return c.installer.inSanitizerDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) HostToolPath() android.OptionalPath {
|
func (c *Module) HostToolPath() android.OptionalPath {
|
||||||
|
|
|
@ -32,6 +32,7 @@ type installLocation int
|
||||||
const (
|
const (
|
||||||
InstallInSystem installLocation = 0
|
InstallInSystem installLocation = 0
|
||||||
InstallInData = iota
|
InstallInData = iota
|
||||||
|
InstallInSanitizerDir = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewBaseInstaller(dir, dir64 string, location installLocation) *baseInstaller {
|
func NewBaseInstaller(dir, dir64 string, location installLocation) *baseInstaller {
|
||||||
|
@ -78,6 +79,10 @@ func (installer *baseInstaller) inData() bool {
|
||||||
return installer.location == InstallInData
|
return installer.location == InstallInData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (installer *baseInstaller) inSanitizerDir() bool {
|
||||||
|
return installer.location == InstallInSanitizerDir
|
||||||
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) hostToolPath() android.OptionalPath {
|
func (installer *baseInstaller) hostToolPath() android.OptionalPath {
|
||||||
return android.OptionalPath{}
|
return android.OptionalPath{}
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,8 +349,8 @@ func (library *libraryDecorator) getLibName(ctx ModuleContext) string {
|
||||||
|
|
||||||
func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
|
func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
|
||||||
location := InstallInSystem
|
location := InstallInSystem
|
||||||
if library.sanitize.inData() {
|
if library.sanitize.inSanitizerDir() {
|
||||||
location = InstallInData
|
location = InstallInSanitizerDir
|
||||||
}
|
}
|
||||||
library.baseInstaller.location = location
|
library.baseInstaller.location = location
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ type SanitizeProperties struct {
|
||||||
|
|
||||||
SanitizerEnabled bool `blueprint:"mutated"`
|
SanitizerEnabled bool `blueprint:"mutated"`
|
||||||
SanitizeDep bool `blueprint:"mutated"`
|
SanitizeDep bool `blueprint:"mutated"`
|
||||||
InData bool `blueprint:"mutated"`
|
InSanitizerDir bool `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type sanitize struct {
|
type sanitize struct {
|
||||||
|
@ -383,8 +383,8 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sanitize *sanitize) inData() bool {
|
func (sanitize *sanitize) inSanitizerDir() bool {
|
||||||
return sanitize.Properties.InData
|
return sanitize.Properties.InSanitizerDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sanitize *sanitize) Sanitizer(t sanitizerType) bool {
|
func (sanitize *sanitize) Sanitizer(t sanitizerType) bool {
|
||||||
|
@ -447,7 +447,7 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
|
||||||
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
|
modules[0].(*Module).sanitize.Properties.SanitizeDep = false
|
||||||
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
|
modules[1].(*Module).sanitize.Properties.SanitizeDep = false
|
||||||
if mctx.Device() {
|
if mctx.Device() {
|
||||||
modules[1].(*Module).sanitize.Properties.InData = true
|
modules[1].(*Module).sanitize.Properties.InSanitizerDir = true
|
||||||
} else {
|
} else {
|
||||||
modules[0].(*Module).Properties.PreventInstall = true
|
modules[0].(*Module).Properties.PreventInstall = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue