Skip to content

Commit

Permalink
Exclude test tools during build step (#3286)
Browse files Browse the repository at this point in the history
* Exclude test tools in the same way as normal tools

* version
  • Loading branch information
peterebden authored Nov 6, 2024
1 parent a8b59ff commit 25da70f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 17.12.2
---------------
* Exclude test_tools from dependencies in working dir during build.

Version 17.12.1
---------------
* Ensure build env is sorted on input to config hash (#3279)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.12.1
17.12.2
14 changes: 12 additions & 2 deletions src/core/build_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -1659,12 +1659,22 @@ func (target *BuildTarget) AddMaybeExportedDependency(dep BuildLabel, exported,

// IsTool returns true if the given build label is a tool used by this target.
func (target *BuildTarget) IsTool(tool BuildLabel) bool {
for _, t := range target.Tools {
if target.isTool(tool, target.Tools, target.namedTools) {
return true
} else if target.Test != nil && target.isTool(tool, target.Test.tools, target.Test.namedTools) {
return true
}
return false
}

// isTool returns true if the given build label is a named or unnamed tool in the given sets.
func (target *BuildTarget) isTool(tool BuildLabel, tools []BuildInput, namedTools map[string][]BuildInput) bool {
for _, t := range tools {
if label, ok := t.Label(); ok && label == tool {
return true
}
}
for _, tools := range target.namedTools {
for _, tools := range namedTools {
for _, t := range tools {
if label, ok := t.Label(); ok && label == tool {
return true
Expand Down

0 comments on commit 25da70f

Please sign in to comment.