summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-08-30 02:40:07 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-08-30 02:40:07 +0000
commit662b09e8c3b2776987d5205b0b5038d35ef407ed (patch)
tree4e2290f9f6d4b608363893cec62be4467971c080
parent8bbe26cad78f2d36e113a356c3cfa5e8d37c8c16 (diff)
parentfc6e64564557b91fd89f58738d0a1669436bb978 (diff)
Merge "Prevent concurrent read/writes to a map" into main
-rw-r--r--android/proto.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/android/proto.go b/android/proto.go
index 4cd73e3a8..3c4b4c7cd 100644
--- a/android/proto.go
+++ b/android/proto.go
@@ -17,6 +17,7 @@ package android
import (
"path/filepath"
"strings"
+ "sync"
"android/soong/bazel"
@@ -349,6 +350,7 @@ type PkgPathInterface interface {
var (
protoIncludeDirGeneratedSuffix = ".include_dir_bp2build_generated_proto"
protoIncludeDirsBp2buildKey = NewOnceKey("protoIncludeDirsBp2build")
+ protoIncludeDirsBp2buildLock sync.Mutex
)
func getProtoIncludeDirsBp2build(config Config) *map[protoIncludeDirKey]bool {
@@ -368,6 +370,9 @@ type protoIncludeDirKey struct {
// might create the targets in a subdirectory of `includeDir`
// Returns the labels of the proto_library targets
func createProtoLibraryTargetsForIncludeDirs(ctx Bp2buildMutatorContext, includeDirs []string) bazel.LabelList {
+ protoIncludeDirsBp2buildLock.Lock()
+ defer protoIncludeDirsBp2buildLock.Unlock()
+
var ret bazel.LabelList
for _, dir := range includeDirs {
if exists, _, _ := ctx.Config().fs.Exists(filepath.Join(dir, "Android.bp")); !exists {