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

Add a whitespace trimming mode to ManifestAppenderTransformer #620

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jeremyk-91
Copy link

Hi there,

We use the ManifestAppenderTransformer in a Gradle plugin that wraps the Shadow plugin: https://github.com/palantir/gradle-shadow-jar.

We've tried to use the ManifestAppenderTransformer to add tags to an existing manifest file. However, existing manifest files often have a blank line at the end, and so the current transformer if used to extend such a file will leave a blank line between the existing content and any added tags. In other words, if we tried to add the tag bar: 1234 to a manifest with a tag foo: 123 and a blank line at the end, we get

foo: 123

bar: 1234

This PR extends the transformer with a mode where it trims whitespace, so that tags are added to the last section of the manifest (as opposed to beginning a new section). This would allow using this transformer to add tags to the main section of an existing manifest (which is what we are trying to do with the plugin when shading a multi-release jar). With this mode you would obtain

foo: 123
bar: 1234

This is strictly opt-in, so existing users should not be affected.

@iamdanfox for SA

@johnrengelman
Copy link
Collaborator

Is there a reason why wouldn’t want to simply always do this? Does it really need to be configurable?

@johnrengelman johnrengelman added this to the 6.2 milestone Feb 21, 2021
@jeremyk-91
Copy link
Author

Ah, I was concerned (maybe too concerned?) about breaking users who might rely on existing whitespace, though I can't think of a use case for that offhand. If you think this will be fine, I'll change it to not be configurable.

@johnrengelman
Copy link
Collaborator

I think maybe level it configurable but default it to enabled. So if someone does have a problem, they could disable it.

@johnrengelman johnrengelman modified the milestones: 7.0, 8.0 Apr 26, 2021
@johnrengelman johnrengelman removed this from the 8.0 milestone Feb 25, 2023
@Goooler Goooler deleted the branch GradleUp:main July 28, 2024 13:54
@Goooler Goooler closed this Jul 28, 2024
@Goooler Goooler reopened this Jul 28, 2024
@Goooler Goooler changed the base branch from master to main July 28, 2024 14:08
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.

3 participants