gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sync/locking/BUILD (about) 1 load("//pkg/sync/locking:locking.bzl", "declare_mutex", "declare_rwmutex") 2 load("//tools:defs.bzl", "go_library", "go_test") 3 load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance") 4 5 package( 6 default_applicable_licenses = ["//:license"], 7 default_visibility = ["//:sandbox"], 8 licenses = ["notice"], 9 ) 10 11 go_library( 12 name = "locking", 13 srcs = [ 14 "atomicptrmap_ancestors_unsafe.go", 15 "atomicptrmap_goroutine_unsafe.go", 16 "lockdep.go", 17 "lockdep_norace.go", 18 "locking.go", 19 ], 20 marshal = False, 21 stateify = False, 22 visibility = ["//:sandbox"], 23 deps = [ 24 "//pkg/gohacks", 25 "//pkg/goid", 26 "//pkg/log", 27 "//pkg/sync", 28 ], 29 ) 30 31 go_template_instance( 32 name = "atomicptrmap_goroutine", 33 out = "atomicptrmap_goroutine_unsafe.go", 34 package = "locking", 35 prefix = "goroutineLocks", 36 template = "//pkg/sync/atomicptrmap:generic_atomicptrmap", 37 types = { 38 "Key": "int64", 39 "Value": "goroutineLocks", 40 }, 41 ) 42 43 go_template_instance( 44 name = "atomicptrmap_ancestors", 45 out = "atomicptrmap_ancestors_unsafe.go", 46 imports = { 47 "reflect": "reflect", 48 }, 49 package = "locking", 50 prefix = "ancestors", 51 template = "//pkg/sync/atomicptrmap:generic_atomicptrmap", 52 types = { 53 "Key": "*MutexClass", 54 "Value": "string", 55 }, 56 ) 57 58 go_template( 59 name = "generic_mutex", 60 srcs = ["generic_mutex.go"], 61 visibility = ["//:sandbox"], 62 ) 63 64 go_template( 65 name = "generic_rwmutex", 66 srcs = ["generic_rwmutex.go"], 67 visibility = ["//:sandbox"], 68 ) 69 70 declare_mutex( 71 name = "mutex_test", 72 out = "mutex_test.go", 73 nested_lock_names = [ 74 "m2", 75 "m3", 76 ], 77 package = "locking_test", 78 prefix = "test", 79 ) 80 81 declare_rwmutex( 82 name = "mutex_test2", 83 out = "mutex_test2.go", 84 package = "locking_test", 85 prefix = "test2", 86 ) 87 88 declare_mutex( 89 name = "mutex_test3", 90 out = "mutex_test3.go", 91 package = "locking_test", 92 prefix = "test3", 93 ) 94 95 go_test( 96 name = "locking_test", 97 size = "small", 98 srcs = [ 99 "lockdep_nolockdep_test.go", 100 "lockdep_test.go", 101 "mutex_test.go", 102 "mutex_test2.go", 103 "mutex_test3.go", 104 ], 105 deps = [ 106 "//pkg/sync", 107 "//pkg/sync/locking", 108 ], 109 )