Skip to content

Commit 9ae1c96

Browse files
authored
Fix BuildTarget.ProvideFor not checking named data when deciding whether to skip resolution. (#3316)
1 parent 450ec92 commit 9ae1c96

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

ChangeLog

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
Version 17.12.7
2+
---------------
3+
* Fix BuildTarget.ProvideFor not checking named data when deciding whether
4+
to skip resolution. (#3316)
5+
16
Version 17.12.6
2-
--------------
7+
---------------
38
* Add goroutine labels to track what they are getting up to if we suspect a hang (#3292)
49
* Fix deadlock with queuing data for tests (#3306)
510
* Fix potential subinclude lockup (#3305)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17.12.6
1+
17.12.7

src/core/build_target.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,15 @@ func (target *BuildTarget) ProvideFor(other *BuildTarget) []BuildLabel {
12051205
return []BuildLabel{target.Label}
12061206
}
12071207

1208+
func (target *BuildTarget) isDataFor(other *BuildTarget) bool {
1209+
for _, data := range other.AllData() {
1210+
if label, ok := data.Label(); ok && label == target.Label {
1211+
return true
1212+
}
1213+
}
1214+
return false
1215+
}
1216+
12081217
// provideFor is like ProvideFor but returns an empty slice if there is a direct dependency.
12091218
// It's a small optimisation to save allocating extra slices.
12101219
func (target *BuildTarget) provideFor(other *BuildTarget) ([]BuildLabel, bool) {
@@ -1214,10 +1223,8 @@ func (target *BuildTarget) provideFor(other *BuildTarget) ([]BuildLabel, bool) {
12141223
return nil, false
12151224
}
12161225
// Never do this if the other target has a data or tool dependency on us.
1217-
for _, data := range other.Data {
1218-
if label, ok := data.Label(); ok && label == target.Label {
1219-
return nil, false
1220-
}
1226+
if target.isDataFor(other) {
1227+
return nil, false
12211228
}
12221229
if other.IsTool(target.Label) {
12231230
return nil, false

0 commit comments

Comments
 (0)