summaryrefslogtreecommitdiff
path: root/android/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/config.go')
-rw-r--r--android/config.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index bc1aa3a4d..cae419b8f 100644
--- a/android/config.go
+++ b/android/config.go
@@ -68,6 +68,14 @@ func (c Config) BuildDir() string {
return c.buildDir
}
+func (c Config) NinjaBuildDir() string {
+ return c.buildDir
+}
+
+func (c Config) SrcDir() string {
+ return c.srcDir
+}
+
// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
@@ -1411,6 +1419,62 @@ func (c *deviceConfig) RecoverySnapshotModules() map[string]bool {
return c.config.productVariables.RecoverySnapshotModules
}
+func createDirsMap(previous map[string]bool, dirs []string) (map[string]bool, error) {
+ var ret = make(map[string]bool)
+ for _, dir := range dirs {
+ clean := filepath.Clean(dir)
+ if previous[clean] || ret[clean] {
+ return nil, fmt.Errorf("Duplicate entry %s", dir)
+ }
+ ret[clean] = true
+ }
+ return ret, nil
+}
+
+func (c *deviceConfig) createDirsMapOnce(onceKey OnceKey, previous map[string]bool, dirs []string) map[string]bool {
+ dirMap := c.Once(onceKey, func() interface{} {
+ ret, err := createDirsMap(previous, dirs)
+ if err != nil {
+ panic(fmt.Errorf("%s: %w", onceKey.key, err))
+ }
+ return ret
+ })
+ if dirMap == nil {
+ return nil
+ }
+ return dirMap.(map[string]bool)
+}
+
+var vendorSnapshotDirsExcludedKey = NewOnceKey("VendorSnapshotDirsExcludedMap")
+
+func (c *deviceConfig) VendorSnapshotDirsExcludedMap() map[string]bool {
+ return c.createDirsMapOnce(vendorSnapshotDirsExcludedKey, nil,
+ c.config.productVariables.VendorSnapshotDirsExcluded)
+}
+
+var vendorSnapshotDirsIncludedKey = NewOnceKey("VendorSnapshotDirsIncludedMap")
+
+func (c *deviceConfig) VendorSnapshotDirsIncludedMap() map[string]bool {
+ excludedMap := c.VendorSnapshotDirsExcludedMap()
+ return c.createDirsMapOnce(vendorSnapshotDirsIncludedKey, excludedMap,
+ c.config.productVariables.VendorSnapshotDirsIncluded)
+}
+
+var recoverySnapshotDirsExcludedKey = NewOnceKey("RecoverySnapshotDirsExcludedMap")
+
+func (c *deviceConfig) RecoverySnapshotDirsExcludedMap() map[string]bool {
+ return c.createDirsMapOnce(recoverySnapshotDirsExcludedKey, nil,
+ c.config.productVariables.RecoverySnapshotDirsExcluded)
+}
+
+var recoverySnapshotDirsIncludedKey = NewOnceKey("RecoverySnapshotDirsIncludedMap")
+
+func (c *deviceConfig) RecoverySnapshotDirsIncludedMap() map[string]bool {
+ excludedMap := c.RecoverySnapshotDirsExcludedMap()
+ return c.createDirsMapOnce(recoverySnapshotDirsIncludedKey, excludedMap,
+ c.config.productVariables.RecoverySnapshotDirsIncluded)
+}
+
func (c *deviceConfig) ShippingApiLevel() ApiLevel {
if c.config.productVariables.ShippingApiLevel == nil {
return NoneApiLevel