Skip to content

Commit

Permalink
Python code-gen; rename query methods (#6887)
Browse files Browse the repository at this point in the history
The class `TargetTagFilter` is about filtering targets
by tag and is agnostic about its use for the code-gen
filtering. This commit renames the methods to make this
more obvious.
  • Loading branch information
andponlin-canva authored Oct 18, 2024
1 parent c1a3c5a commit d8928b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class BlazeQueryTargetTagFilter implements TargetTagFilter {

@Nullable
@Override
public List<TargetExpression> doFilterCodeGen(
public List<TargetExpression> doFilter(
Project project,
BlazeContext context,
List<TargetExpression> targets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ static boolean hasProvider() {
* @param targets is a list of Bazel targets to filter.
* @return a subset of the supplied targets that include one of the supplied {code tags}.
*/
static List<TargetExpression> filterCodeGen(
static List<TargetExpression> filter(
Project project,
BlazeContext context,
List<TargetExpression> targets,
Set<String> tags) {
return Arrays.stream(EP_NAME.getExtensions())
.map(p -> p.doFilterCodeGen(project, context, targets, tags))
.map(p -> p.doFilter(project, context, targets, tags))
.filter(Objects::nonNull)
.findFirst()
.orElse(ImmutableList.of());
Expand All @@ -65,7 +65,7 @@ static List<TargetExpression> filterCodeGen(
* {@see #filterCodeGen}
*/
@Nullable
List<TargetExpression> doFilterCodeGen(
List<TargetExpression> doFilter(
Project project,
BlazeContext context,
List<TargetExpression> targets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private static ImmutableList<TargetExpression> deriveTargetsFromDirectories(
.collect(Collectors.toSet());

if (!activeLanguageCodeGeneratorTags.isEmpty() && projectViewSet.getScalarValue(EnablePythonCodegenSupport.KEY).orElse(false)) {
retainedByCodeGen = TargetTagFilter.filterCodeGen(
retainedByCodeGen = TargetTagFilter.filter(
project,
context,
rejectedByKind,
Expand Down

0 comments on commit d8928b9

Please sign in to comment.