n0mer/gradle-git-properties

git.properties is missing when building with gradle 5.1.x, gradle 5.2.x

tha2015 opened this issue · 3 comments

For single project: on the first time when building the code (after checking out form git), the git.properties file might be missing.
example.zip
Issue happens all the time

For a project with subprojects, the issue will happen all the time.
project2.zip
Issue happens only for the first time

Root cause: processResources task which is executed after generateGitProperties task might delete build\resources\main directory (including the git.properties inside) because it thinks the folder is not clean

generateGitProperties task ->processResources task (will print message: Deleting stale output file: build\resources\main)

Example projects are attached above

n0mer commented

@tha2015 can you please clarify, what is suggested work-around?

@n0mer No, I don't know how to avoid it.
BTW currently Gradle has newer versions (5.3, 5.4, 5.5) so maybe we don't have to fix it? I put a note in the README about this issue.
Do you think we can go ahead and release a new version without fixing it?

In v2.2.0, the new property key ( gitPropertiesResourceDir ) will allow putting git.properties file in a different directory to avoid this issue. So closing this issue.