Skip to content

Commit

Permalink
Fix BuildTarget.ProvideFor not checking named data when deciding whet…
Browse files Browse the repository at this point in the history
…her to skip resolution. (#3316)
  • Loading branch information
toastwaffle authored Dec 13, 2024
1 parent 450ec92 commit 9ae1c96
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Version 17.12.7
---------------
* Fix BuildTarget.ProvideFor not checking named data when deciding whether
to skip resolution. (#3316)

Version 17.12.6
--------------
---------------
* Add goroutine labels to track what they are getting up to if we suspect a hang (#3292)
* Fix deadlock with queuing data for tests (#3306)
* Fix potential subinclude lockup (#3305)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.12.6
17.12.7
15 changes: 11 additions & 4 deletions src/core/build_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,15 @@ func (target *BuildTarget) ProvideFor(other *BuildTarget) []BuildLabel {
return []BuildLabel{target.Label}
}

func (target *BuildTarget) isDataFor(other *BuildTarget) bool {
for _, data := range other.AllData() {
if label, ok := data.Label(); ok && label == target.Label {
return true
}
}
return false
}

// provideFor is like ProvideFor but returns an empty slice if there is a direct dependency.
// It's a small optimisation to save allocating extra slices.
func (target *BuildTarget) provideFor(other *BuildTarget) ([]BuildLabel, bool) {
Expand All @@ -1214,10 +1223,8 @@ func (target *BuildTarget) provideFor(other *BuildTarget) ([]BuildLabel, bool) {
return nil, false
}
// Never do this if the other target has a data or tool dependency on us.
for _, data := range other.Data {
if label, ok := data.Label(); ok && label == target.Label {
return nil, false
}
if target.isDataFor(other) {
return nil, false
}
if other.IsTool(target.Label) {
return nil, false
Expand Down

0 comments on commit 9ae1c96

Please sign in to comment.