Refactor cc modules to use decorators instead of inheritance
For example , instead of trying to have libraryLinker inherit from baseLinker and libraryCompiler inherit from baseCompiler, create a single decorator object that wraps both baseLinker and baseCompiler. Test: Builds, no unexpected changes to build.ninja Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
This commit is contained in:
11
cc/object.go
11
cc/object.go
@@ -32,13 +32,16 @@ func init() {
|
||||
}
|
||||
|
||||
type objectLinker struct {
|
||||
*baseLinker
|
||||
Properties ObjectLinkerProperties
|
||||
}
|
||||
|
||||
func objectFactory() (blueprint.Module, []interface{}) {
|
||||
module := newBaseModule(android.DeviceSupported, android.MultilibBoth)
|
||||
module.compiler = &baseCompiler{}
|
||||
module.linker = &objectLinker{}
|
||||
module.linker = &objectLinker{
|
||||
baseLinker: NewBaseLinker(),
|
||||
}
|
||||
module.compiler = NewBaseCompiler()
|
||||
return module.Init()
|
||||
}
|
||||
|
||||
@@ -84,7 +87,3 @@ func (object *objectLinker) link(ctx ModuleContext,
|
||||
ctx.CheckbuildFile(outputFile)
|
||||
return outputFile
|
||||
}
|
||||
|
||||
func (*objectLinker) installable() bool {
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user