Skip to content

Commit

Permalink
Allow use of filter-incompatible-targets for Bazel >= 7.4.0 (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
freeform-andre authored Oct 7, 2024
1 parent acd98d2 commit 5506d15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/target_determinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ func doQueryDeps(context *Context, targets TargetsList) (*QueryResults, error) {

// Work around https://github.com/bazelbuild/bazel/issues/21010
var incompatibleTargetsToFilter map[label.Label]bool
hasIncompatibleTargetsBug, explanation := versions.ReleaseIsInRange(bazelRelease, version.Must(version.NewVersion("7.0.0-pre.20230628.2")), nil)
hasIncompatibleTargetsBug, explanation := versions.ReleaseIsInRange(bazelRelease, version.Must(version.NewVersion("7.0.0-pre.20230628.2")), version.Must(version.NewVersion("7.4.0")))
if hasIncompatibleTargetsBug != nil && *hasIncompatibleTargetsBug {
if !context.FilterIncompatibleTargets {
return nil, fmt.Errorf("requested not to filter incompatible targets, but bazel version %s has a bug requiring filtering incompatible targets - see https://github.com/bazelbuild/bazel/issues/21010", bazelRelease)
Expand Down

1 comment on commit 5506d15

@sitaktif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed there's a small bug here: versions.ReleaseIsInRange is inclusive, which means hasIncompatibleTargetsBug will evaluate to true up to -and including- 7.4.0.

Bazel 7.4.1 is just around the corner though, so it's probably ok to leave the code as it is.

Please sign in to comment.