-
Notifications
You must be signed in to change notification settings - Fork 988
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
custom global generators in cache extensions/generators folder #13718
custom global generators in cache extensions/generators folder #13718
Conversation
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.
Looks good. Just one minor suggestion. Thanks
@@ -188,6 +188,10 @@ def settings_path(self): | |||
def custom_commands_path(self): | |||
return os.path.join(self.cache_folder, EXTENSIONS_FOLDER, CUSTOM_COMMANDS_FOLDER) | |||
|
|||
@property | |||
def custom_generators_path(self): | |||
return os.path.join(self.cache_folder, EXTENSIONS_FOLDER, "generators") |
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.
Consider defining GENERATORS_EXTENSION_FOLDER analogous to DEPLOYERS_EXTENSION_FOLDER at line 30. Also, if it is not too late, it would read better if DEPLOYERS_EXTENSION_FOLDER was defined to be "deployers" rather than "deploy". Lastly, this code might be more logically placed at line 211.
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 afraid that it would be better not to change the deploy
folders, as we are aware of some users already using them, and it would be breaking, probably not worth it.
Regarding GENERATORS_EXTENSION_FOLDER
I am tempted to go in the other direction, if no one else in the whole codebase uses the constant, then, tit is better encapsulated in the custom_generators_path
, so I was tempted to remove the CUSTOM_COMMANDS_FOLDER
global const, and make it an implementation detail over custom_commands_path
, which is the abstraction to use, not the constant. I will double check that.
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.
Yeah, most of those consts, defined as public in the global module scope are unused in the rest of the codebase. I typically prefer to provide the less possible scope and indirection when it is artificial/unused/premature, so I'd probably propose an internal simplification PR for that (but I'll do it in another PR to keep this one minimal).
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.
Hi @memsharded,
Thanks for the additional insights. Regarding "deploy" vs. "deployers", would it be possible to look in both "deployers" and "deploy" but issues a deprecation warning for any files found in the older one? Thanks
Changelog: Feature: New global custom generators in cache "extensions/generators" that can be used by name.
Docs: conan-io/docs#3213
Close #13709