Merge "Prevent concurrent read/writes to a map" into main
This commit is contained in:
@@ -17,6 +17,7 @@ package android
|
|||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"android/soong/bazel"
|
"android/soong/bazel"
|
||||||
|
|
||||||
@@ -349,6 +350,7 @@ type PkgPathInterface interface {
|
|||||||
var (
|
var (
|
||||||
protoIncludeDirGeneratedSuffix = ".include_dir_bp2build_generated_proto"
|
protoIncludeDirGeneratedSuffix = ".include_dir_bp2build_generated_proto"
|
||||||
protoIncludeDirsBp2buildKey = NewOnceKey("protoIncludeDirsBp2build")
|
protoIncludeDirsBp2buildKey = NewOnceKey("protoIncludeDirsBp2build")
|
||||||
|
protoIncludeDirsBp2buildLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
func getProtoIncludeDirsBp2build(config Config) *map[protoIncludeDirKey]bool {
|
func getProtoIncludeDirsBp2build(config Config) *map[protoIncludeDirKey]bool {
|
||||||
@@ -368,6 +370,9 @@ type protoIncludeDirKey struct {
|
|||||||
// might create the targets in a subdirectory of `includeDir`
|
// might create the targets in a subdirectory of `includeDir`
|
||||||
// Returns the labels of the proto_library targets
|
// Returns the labels of the proto_library targets
|
||||||
func createProtoLibraryTargetsForIncludeDirs(ctx Bp2buildMutatorContext, includeDirs []string) bazel.LabelList {
|
func createProtoLibraryTargetsForIncludeDirs(ctx Bp2buildMutatorContext, includeDirs []string) bazel.LabelList {
|
||||||
|
protoIncludeDirsBp2buildLock.Lock()
|
||||||
|
defer protoIncludeDirsBp2buildLock.Unlock()
|
||||||
|
|
||||||
var ret bazel.LabelList
|
var ret bazel.LabelList
|
||||||
for _, dir := range includeDirs {
|
for _, dir := range includeDirs {
|
||||||
if exists, _, _ := ctx.Config().fs.Exists(filepath.Join(dir, "Android.bp")); !exists {
|
if exists, _, _ := ctx.Config().fs.Exists(filepath.Join(dir, "Android.bp")); !exists {
|
||||||
|
Reference in New Issue
Block a user