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
diff --git a/cc/installer.go b/cc/installer.go
index 9a1e1fa..a133bf2 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -30,12 +30,27 @@
Symlinks []string `android:"arch_variant"`
}
+type installLocation int
+
+const (
+ InstallInSystem installLocation = 0
+ InstallInData = iota
+)
+
+func NewBaseInstaller(dir, dir64 string, location installLocation) *baseInstaller {
+ return &baseInstaller{
+ dir: dir,
+ dir64: dir64,
+ location: location,
+ }
+}
+
type baseInstaller struct {
Properties InstallerProperties
- dir string
- dir64 string
- data bool
+ dir string
+ dir64 string
+ location installLocation
path android.OutputPath
}
@@ -62,5 +77,5 @@
}
func (installer *baseInstaller) inData() bool {
- return installer.data
+ return installer.location == InstallInData
}