Merge "Minor refactoring of Append/PrependProperties() methods Test: `m nothing` and compare ninja file Bug: n/a"
diff --git a/android/soongconfig/modules.go b/android/soongconfig/modules.go
index 3a93f47..09a5057 100644
--- a/android/soongconfig/modules.go
+++ b/android/soongconfig/modules.go
@@ -20,6 +20,7 @@
"reflect"
"sort"
"strings"
+ "sync"
"github.com/google/blueprint"
"github.com/google/blueprint/parser"
@@ -239,10 +240,18 @@
ValueVars map[string]bool
}
+var bp2buildSoongConfigVarsLock sync.Mutex
+
// SoongConfigVariablesForBp2build extracts information from a
// SoongConfigDefinition that bp2build needs to generate constraint settings and
// values for, in order to migrate soong_config_module_type usages to Bazel.
func (defs *Bp2BuildSoongConfigDefinitions) AddVars(mtDef SoongConfigDefinition) {
+ // In bp2build mode, this method is called concurrently in goroutines from
+ // loadhooks while parsing soong_config_module_type, so add a mutex to
+ // prevent concurrent map writes. See b/207572723
+ bp2buildSoongConfigVarsLock.Lock()
+ defer bp2buildSoongConfigVarsLock.Unlock()
+
if defs.StringVars == nil {
defs.StringVars = make(map[string]map[string]bool)
}
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 5b070c6..84bdcdd 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -257,8 +257,8 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String())
- entries.SetString("LOCAL_SOONG_INSTALLED_MODULE :=", filepath.Join(p.installDir.String(), fi.stem()))
- entries.SetString("LOCAL_SOONG_INSTALL_PAIRS :=",
+ entries.SetString("LOCAL_SOONG_INSTALLED_MODULE", filepath.Join(p.installDir.String(), fi.stem()))
+ entries.SetString("LOCAL_SOONG_INSTALL_PAIRS",
fi.builtFile.String()+":"+filepath.Join(p.installDir.String(), fi.stem()))
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore