Refactor cc
Refactor all of cc in order to use composition instead of inheritance.
All cc module types exported by cc are now *cc.Module objects, with
compilation, linking, and installing steps delegated to different
objects in order to form the full module type. Additional features that
modify dependencies and flags can be inserted in a features object list,
and custom module types can be created by adding a Customizer object
that can modify properties.
Change-Id: Ie1283d14920f7856f6947b0530606b2f4d58fab0
diff --git a/common/androidmk.go b/common/androidmk.go
index 9628a10..49380e0 100644
--- a/common/androidmk.go
+++ b/common/androidmk.go
@@ -39,10 +39,11 @@
type AndroidMkData struct {
Class string
OutputFile OptionalPath
+ Disabled bool
Custom func(w io.Writer, name, prefix string) error
- Extra func(w io.Writer, outputFile Path) error
+ Extra []func(w io.Writer, outputFile Path) error
}
func AndroidMkSingleton() blueprint.Singleton {
@@ -166,6 +167,10 @@
return data.Custom(w, name, prefix)
}
+ if data.Disabled {
+ return nil
+ }
+
if !data.OutputFile.Valid() {
return err
}
@@ -189,8 +194,8 @@
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
}
- if data.Extra != nil {
- err = data.Extra(w, data.OutputFile.Path())
+ for _, extra := range data.Extra {
+ err = extra(w, data.OutputFile.Path())
if err != nil {
return err
}