-
Notifications
You must be signed in to change notification settings - Fork 378
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
feat: support only updating existing BUILD files #1921
base: master
Are you sure you want to change the base?
Conversation
@@ -73,7 +86,7 @@ func (*Configurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) | |||
func (*Configurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error { return nil } | |||
|
|||
func (*Configurer) KnownDirectives() []string { | |||
return []string{"exclude", "follow", "ignore"} | |||
return []string{"generation_mode", "exclude", "follow", "ignore"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the directive named used by the Aspect plugins today. I think we need something better here that doesn't include the word "mode" which already has a meaning within gazelle.
Ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_file_action?
create_build_files yes/no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to try to this patch at Airtable. I am thinking instead of manually specifying generation_mode
to isntead do something like (pseudocode) collectionOnly := f == nil !any(file.endswith('.go') for file in ents)
, since we have go code spread throughout the tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think different repos will have different preferences and we can't really make any assumptions based on which files exist.
c4a69da
to
bcf35e8
Compare
d1e111d
to
496ec9e
Compare
496ec9e
to
fb71250
Compare
Close #1832
What type of PR is this?
Feature
What package or component does this PR mostly affect?
What does this PR do? Why is it needed?
Add an option to enable only updating existing BUILDs and not creating any new ones.
I think this is common among extension authors, normally implemented with a quick-exit within
Configure
if the*rule.File
isnil
. However all the subdirs then need to be manually traversed to find files in subdirectories with no BUILD.I've always maintained a patch similar to this PR to avoid plugins having to do manual fs operations.
Which issues(s) does this PR fix?
Fixes #1832
Other notes for review