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

sourceFiles should ignore empty dirs #530

Merged
merged 1 commit into from
Nov 5, 2021

Conversation

wolfs
Copy link
Contributor

@wolfs wolfs commented Oct 28, 2021

The GenerateProto task only relies on source files, so it should ignore empty directories. Gradle 6.8 introduced the IgnoreEmptyDirectories annotation, which allows declaring that.

In this PR, I add the IgnoreEmptyDirectories annotation to GenerateProto.sourceFiles.

@wolfs wolfs mentioned this pull request Oct 28, 2021
@wolfs wolfs marked this pull request as draft November 2, 2021 09:37
@wolfs
Copy link
Contributor Author

wolfs commented Nov 2, 2021

This PR builds on #531, so it should only contain adding the annotation in the end.

@wolfs wolfs force-pushed the sources-ignore-empty-dirs branch 2 times, most recently from 82400ab to 92bc05a Compare November 3, 2021 17:30
Empty directories should not matter for source files, so let's ignore
them for up-to-date checks as well.
@wolfs wolfs marked this pull request as ready for review November 4, 2021 21:52
@wolfs
Copy link
Contributor Author

wolfs commented Nov 4, 2021

@ejona86 This is ready for review now. Please take a look.

@ejona86
Copy link
Collaborator

ejona86 commented Nov 4, 2021

so it should ignore empty directories

What is the harm if it doesn't?

@wolfs
Copy link
Contributor Author

wolfs commented Nov 5, 2021

so it should ignore empty directories

What is the harm if it doesn't?

The harm is two fold:

  • Right now, the task will be out-of-date when you add an empty directory to the source folder. There will also be a build cache miss if the only difference between the sources is an empty directory somewhere.
  • In Gradle 8.0, the task won't skip any more if there are only empty directories in the source folder and no actual files. That is because the behaviour for skipping when empty and up-to-date checking will be more consistent.

@ejona86 ejona86 merged commit fb32f4a into google:master Nov 5, 2021
@ejona86
Copy link
Collaborator

ejona86 commented Nov 5, 2021

Thanks! I included those notes in the commit message.

@wolfs
Copy link
Contributor Author

wolfs commented Nov 5, 2021

@ejona86 Awesome, thank you for the quick turnaround! Any idea when you have time to publish a release of the plugin including this changes?

@ejona86
Copy link
Collaborator

ejona86 commented Nov 5, 2021

I was going to give some time to see if #523 can make it into the release. I was expecting to do the release early next week.

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.

2 participants