-
Notifications
You must be signed in to change notification settings - Fork 989
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
Do not modify generators files if nothing has changed (close #2895) #3412
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.
LGTM, just some tests
@@ -112,20 +112,28 @@ def save_append(path, content): | |||
handle.write(to_file_bytes(content)) | |||
|
|||
|
|||
def save(path, content): | |||
def save(path, content, only_if_modified=False): |
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.
As this is only used internally (tools.save()
is not affected by this) and mostly for testing (I think). Would it be possible to benefit from a defaulted only_if_modified=True
?
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.
No, do not change the current default, dangerous. And I don't see the benefit, you mean performance? I doubt it, it will be slower.
yes, I will add some for the |
Do not modify generators files if nothing has changed (close conan-io#2895)
Add parameter
only_if_modified
to the utility functionsave
to skip actual writing to disk if nothing has changed.Implement this functionality in generators generated files.
Changelog: Fix: The generator files are only written in disk if the content of the generated file changes.