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

Do not modify generators files if nothing has changed (close #2895) #3412

Merged
merged 6 commits into from
Aug 28, 2018

Conversation

jgsogo
Copy link
Contributor

@jgsogo jgsogo commented Aug 28, 2018

Add parameter only_if_modified to the utility function save 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.

@jgsogo jgsogo requested review from lasote and memsharded August 28, 2018 10:43
@ghost ghost assigned jgsogo Aug 28, 2018
@ghost ghost added the stage: review label Aug 28, 2018
Copy link
Member

@danimtb danimtb left a 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):
Copy link
Member

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?

Copy link
Member

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.

@jgsogo
Copy link
Contributor Author

jgsogo commented Aug 28, 2018

yes, I will add some for the save and save_files functions (and fix failing ones, of course)

@memsharded memsharded merged commit e3c4aff into conan-io:develop Aug 28, 2018
@memsharded memsharded added this to the 1.8 milestone Aug 28, 2018
@ghost ghost removed the stage: review label Aug 28, 2018
@jgsogo jgsogo deleted the issue/2895 branch September 19, 2018 12:22
grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018
Do not modify generators files if nothing has changed (close conan-io#2895)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants