Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BuildTarget.ProvideFor not checking named data when deciding whether to skip resolution. #3316

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
22 changes: 18 additions & 4 deletions src/core/build_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,22 @@ func (target *BuildTarget) ProvideFor(other *BuildTarget) []BuildLabel {
return []BuildLabel{target.Label}
}

func (target *BuildTarget) isDataFor(other *BuildTarget) bool {
for _, data := range other.Data {
toastwaffle marked this conversation as resolved.
Show resolved Hide resolved
if label, ok := data.Label(); ok && label == target.Label {
return true
}
}
for _, v := range other.NamedData {
for _, data := range v {
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 +1230,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
Loading