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

Support wildcards in resolve directives #817

Closed
jayconrod opened this issue Jun 15, 2020 · 1 comment
Closed

Support wildcards in resolve directives #817

jayconrod opened this issue Jun 15, 2020 · 1 comment

Comments

@jayconrod
Copy link
Contributor

This came up in discussion in #771.

Currently, resolve directives have two forms:

# gazelle:resolve lang import-string dep-string
# gazelle:resolve src-lang dep-lang import-string dep-string

We currently don't support any form of wildcard, so if a repository needs to use resolve directives for a large number of rules (for example, when using a custom naming convention or a large number of rules in a directory), it needs a large number of resolve directives, which can be very repetitively.

We should support some sort of wildcard in the import-string which could also appear in the dep-string. The simplest and most familiar way to do this would probably be to introduce a resolve_regexp directive, where import-string is a regular expression, and dep-string is something that could be passed to regexp.ReplaceAll (with $1 and so on for matched groups).

@ChuntaoLu
Copy link

Hey, any update on this issue?

DolceTriade added a commit to DolceTriade/bazel-gazelle that referenced this issue May 23, 2023
Similar to the resolve directive, resolve_regexp will match the import
string against a regex instead of a direct string match. This is useful
when matching protos which are part of single rule.

Fixes bazel-contrib#817
DolceTriade added a commit to DolceTriade/bazel-gazelle that referenced this issue May 25, 2023
Similar to the resolve directive, resolve_regexp will match the import
string against a regex instead of a direct string match. This is useful
when matching protos which are part of single rule.

Fixes bazel-contrib#817
DolceTriade added a commit to DolceTriade/bazel-gazelle that referenced this issue Jun 21, 2023
Similar to the resolve directive, resolve_regexp will match the import
string against a regex instead of a direct string match. This is useful
when matching protos which are part of single rule.

Fixes bazel-contrib#817
@fmeum fmeum closed this as completed in 1857d0c Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants