File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 48
48
buildFilenames = []string {"BUILD" , "BUILD.bazel" }
49
49
)
50
50
51
- func GetActualKindName (kind string , args language. GenerateArgs ) string {
52
- if kindOverride , ok := args . Config .KindMap [kind ]; ok {
51
+ func GetActualKindName (kind string , c * config. Config ) string {
52
+ if kindOverride , ok := c .KindMap [kind ]; ok {
53
53
return kindOverride .KindName
54
54
}
55
55
return kind
@@ -90,9 +90,9 @@ func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateRes
90
90
}
91
91
}
92
92
93
- actualPyBinaryKind := GetActualKindName (pyBinaryKind , args )
94
- actualPyLibraryKind := GetActualKindName (pyLibraryKind , args )
95
- actualPyTestKind := GetActualKindName (pyTestKind , args )
93
+ actualPyBinaryKind := GetActualKindName (pyBinaryKind , args . Config )
94
+ actualPyLibraryKind := GetActualKindName (pyLibraryKind , args . Config )
95
+ actualPyTestKind := GetActualKindName (pyTestKind , args . Config )
96
96
97
97
pythonProjectRoot := cfg .PythonProjectRoot ()
98
98
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ func (*Resolver) Name() string { return languageName }
57
57
func (py * Resolver ) Imports (c * config.Config , r * rule.Rule , f * rule.File ) []resolve.ImportSpec {
58
58
cfgs := c .Exts [languageName ].(pythonconfig.Configs )
59
59
cfg := cfgs [f .Pkg ]
60
+ if ! cfg .PerFileGeneration () && GetActualKindName (r .Kind (), c ) == pyBinaryKind {
61
+ // Don't index py_binary in except in file mode, because all non-test Python files
62
+ // are in py_library already.
63
+ return nil
64
+ }
60
65
srcs := r .AttrStrings ("srcs" )
61
66
provides := make ([]resolve.ImportSpec , 0 , len (srcs )+ 1 )
62
67
for _ , src := range srcs {
You can’t perform that action at this time.
0 commit comments