-
Notifications
You must be signed in to change notification settings - Fork 1
Fix for PropertiesFileTransformer breaks Reproducible builds in 8.1.1 #102
Conversation
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
Outdated
Show resolved
Hide resolved
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
Outdated
Show resolved
Hide resolved
...com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerTest.groovy
Outdated
Show resolved
Hide resolved
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
Outdated
Show resolved
Hide resolved
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
Outdated
Show resolved
Hide resolved
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
Outdated
Show resolved
Hide resolved
StripCommentsWithTimestampBufferedWriter(final Writer out) { | ||
super(out); | ||
|
||
lengthOfExpectedTimestamp = ("#" + new Date().toString()).length() |
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.
This Date
is related to your locale, how can we make sure the device locale is matched with the jar locale?
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.
The idea of this is to just remove the comment lines which include the timestamp, which is generated when the properties file is written, so I assume locale is the same. Timestamp is not coming from other jar files. Either way I agree is a bit tricky.
Another option could be try to parse the date to see if it's a date or not, or maybe keep it simple and strip all comment lines.
Probably these changes are a mitigation as the real solution should come from the component writing the properties file, but anyway is more solid than the previous one which was removing only the first line.
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.
Timestamp is not coming from other jar files.
In this case, seems the fix is solid.
Another option could be try to parse the date to see if it's a date or not
In this case, seems we still have to determine the real locale is.
I've published this in https://github.com/Goooler/shadow/releases/tag/v8.1.8 |
Closes GradleUp#858.
Please have a look, added a test (which should fail with 8.1.1) and a fix on CleanProperties.
Removing the timestamp which default Properties class is adding could be tricky. I changed the previous mechanism to be bit more flexible (was not working either as some blank comment line is added now), but either way don't know if is a good approach. Please check