diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/Android.bp | 1 | ||||
-rw-r--r-- | android/androidmk.go | 15 | ||||
-rw-r--r-- | android/module.go | 6 | ||||
-rw-r--r-- | android/raw_files.go | 7 | ||||
-rw-r--r-- | android/test_suites.go | 6 | ||||
-rw-r--r-- | android/util.go | 30 |
6 files changed, 27 insertions, 38 deletions
diff --git a/android/Android.bp b/android/Android.bp index 71e674767..97d634fb5 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -12,6 +12,7 @@ bootstrap_go_package { "blueprint-gobtools", "blueprint-metrics", "blueprint-pool", + "blueprint-syncmap", "sbox_proto", "soong", "soong-android_team_proto", diff --git a/android/androidmk.go b/android/androidmk.go index 7cc6aef00..e32835946 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -435,13 +435,18 @@ func getDistContributions(ctx ConfigAndOtherModuleProviderContext, mod Module) * suffix = *dist.Suffix } - productString := "" - if dist.Append_artifact_with_product != nil && *dist.Append_artifact_with_product { - productString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct()) + prependProductString := "" + if proptools.Bool(dist.Prepend_artifact_with_product) { + prependProductString = fmt.Sprintf("%s-", ctx.Config().DeviceProduct()) } - if suffix != "" || productString != "" { - dest = strings.TrimSuffix(dest, ext) + suffix + productString + ext + appendProductString := "" + if proptools.Bool(dist.Append_artifact_with_product) { + appendProductString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct()) + } + + if suffix != "" || appendProductString != "" || prependProductString != "" { + dest = prependProductString + strings.TrimSuffix(dest, ext) + suffix + appendProductString + ext } if dist.Dir != nil { diff --git a/android/module.go b/android/module.go index c0abfd0a3..1538861d3 100644 --- a/android/module.go +++ b/android/module.go @@ -208,6 +208,12 @@ type Dist struct { // no change to the artifact file name. Append_artifact_with_product *bool `android:"arch_variant"` + // If true, then the artifact file will be prepended with <product name>-. For + // example, if the product is coral and the module is an android_app module + // of name foo, then the artifact would be coral-foo.apk. If false, there is + // no change to the artifact file name. + Prepend_artifact_with_product *bool `android:"arch_variant"` + // A string tag to select the OutputFiles associated with the tag. // // If no tag is specified then it will select the default dist paths provided diff --git a/android/raw_files.go b/android/raw_files.go index fd371965c..ebba4d145 100644 --- a/android/raw_files.go +++ b/android/raw_files.go @@ -26,6 +26,7 @@ import ( "testing" "github.com/google/blueprint" + "github.com/google/blueprint/syncmap" "github.com/google/blueprint/proptools" ) @@ -213,10 +214,10 @@ type rawFileInfo struct { var rawFileSetKey OnceKey = NewOnceKey("raw file set") -func getRawFileSet(config Config) *SyncMap[string, rawFileInfo] { +func getRawFileSet(config Config) *syncmap.SyncMap[string, rawFileInfo] { return config.Once(rawFileSetKey, func() any { - return &SyncMap[string, rawFileInfo]{} - }).(*SyncMap[string, rawFileInfo]) + return &syncmap.SyncMap[string, rawFileInfo]{} + }).(*syncmap.SyncMap[string, rawFileInfo]) } // ContentFromFileRuleForTests returns the content that was passed to a WriteFileRule for use diff --git a/android/test_suites.go b/android/test_suites.go index 9eaf78549..dbcd48c79 100644 --- a/android/test_suites.go +++ b/android/test_suites.go @@ -42,6 +42,12 @@ type TestSuiteInfo struct { var TestSuiteInfoProvider = blueprint.NewProvider[TestSuiteInfo]() +type SupportFilesInfo struct { + SupportFiles InstallPaths +} + +var SupportFilesInfoProvider = blueprint.NewProvider[SupportFilesInfo]() + func (t *testSuiteFiles) GenerateBuildActions(ctx SingletonContext) { files := make(map[string]map[string]InstallPaths) diff --git a/android/util.go b/android/util.go index 7b305b575..4520f400e 100644 --- a/android/util.go +++ b/android/util.go @@ -23,7 +23,6 @@ import ( "runtime" "sort" "strings" - "sync" "github.com/google/blueprint/proptools" ) @@ -646,35 +645,6 @@ func AddToStringSet(set map[string]bool, items []string) { } } -// SyncMap is a wrapper around sync.Map that provides type safety via generics. -type SyncMap[K comparable, V any] struct { - sync.Map -} - -// Load returns the value stored in the map for a key, or the zero value if no -// value is present. -// The ok result indicates whether value was found in the map. -func (m *SyncMap[K, V]) Load(key K) (value V, ok bool) { - v, ok := m.Map.Load(key) - if !ok { - return *new(V), false - } - return v.(V), true -} - -// Store sets the value for a key. -func (m *SyncMap[K, V]) Store(key K, value V) { - m.Map.Store(key, value) -} - -// LoadOrStore returns the existing value for the key if present. -// Otherwise, it stores and returns the given value. -// The loaded result is true if the value was loaded, false if stored. -func (m *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) { - v, loaded := m.Map.LoadOrStore(key, value) - return v.(V), loaded -} - // AppendIfNotZero append the given value to the slice if it is not the zero value // for its type. func AppendIfNotZero[T comparable](slice []T, value T) []T { |