This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
forked from GradleUp/shadow
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into trunk
- Loading branch information
Showing
12 changed files
with
92 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base" | ||
"config:base", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 17 additions & 15 deletions
32
src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/CleanProperties.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
/* | ||
* Source https://stackoverflow.com/a/39043903/519333 | ||
*/ | ||
package com.github.jengelman.gradle.plugins.shadow.internal | ||
|
||
class CleanProperties extends Properties { | ||
private static class StripFirstLineStream extends FilterOutputStream { | ||
|
||
private boolean firstLineSeen = false | ||
private static class StripCommentsWithTimestampBufferedWriter extends BufferedWriter { | ||
|
||
StripFirstLineStream(final OutputStream out) { | ||
private final int lengthOfExpectedTimestamp | ||
|
||
StripCommentsWithTimestampBufferedWriter(final Writer out) { | ||
super(out) | ||
|
||
lengthOfExpectedTimestamp = ("#" + new Date().toString()).length() | ||
} | ||
|
||
@Override | ||
void write(final int b) throws IOException { | ||
if (firstLineSeen) { | ||
super.write(b) | ||
} else if (b == '\n') { | ||
super.write(b) | ||
|
||
firstLineSeen = true | ||
void write(final String str) throws IOException { | ||
if (couldBeCommentWithTimestamp(str)) { | ||
return | ||
} | ||
super.write(str) | ||
} | ||
|
||
private boolean couldBeCommentWithTimestamp(final String str) { | ||
return str != null && | ||
str.startsWith("#") && | ||
str.length() == lengthOfExpectedTimestamp | ||
} | ||
} | ||
|
||
@Override | ||
void store(final OutputStream out, final String comments) throws IOException { | ||
super.store(new StripFirstLineStream(out), null) | ||
void store(final Writer writer, final String comments) throws IOException { | ||
super.store(new StripCommentsWithTimestampBufferedWriter(writer), comments) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters