Fix transformers deprecation warnings#647
Merged
johnrengelman merged 1 commit intoGradleUp:masterfrom Mar 30, 2021
Merged
Conversation
wolfs
reviewed
Mar 29, 2021
Contributor
wolfs
left a comment
There was a problem hiding this comment.
I left some comments.
I think this looks good and fixes the deprecation warnings with Gradle 7.0 in the production code.
Comment on lines
40
to
41
| @Input | ||
| Set<String> entries = new LinkedHashSet<String>() |
Contributor
There was a problem hiding this comment.
Suggested change
| @Input | |
| Set<String> entries = new LinkedHashSet<String>() | |
| private Set<String> entries = new LinkedHashSet<String>() |
It seems like this is modified while running the transformer, so I think this should be made private.
Comment on lines
43
to
44
| @Input | ||
| Map<String, Set<String>> organizationEntries = new LinkedHashMap<String, Set<String>>() |
Contributor
There was a problem hiding this comment.
Suggested change
| @Input | |
| Map<String, Set<String>> organizationEntries = new LinkedHashMap<String, Set<String>>() | |
| private Map<String, Set<String>> organizationEntries = new LinkedHashMap<String, Set<String>>() |
It seems like this is modified while running the transformer, so I think this should be made private.
| public class IncludeResourceTransformer implements Transformer { | ||
|
|
||
| @InputFile | ||
| @PathSensitive(PathSensitivity.NAME_ONLY) |
Contributor
There was a problem hiding this comment.
Suggested change
| @PathSensitive(PathSensitivity.NAME_ONLY) | |
| @PathSensitive(PathSensitivity.NONE) |
I think the name doesn't matter here.
Merged
db07762 to
e794c8c
Compare
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR annotates transformers' configuration fields as inputs to solve the deprecation warnings.
Closes #601
Fixes the remaining warnings in #530 (only the first one was addressed in #569)
Caveats:
PropertiesFileTransformer.keyTransformeras internal, while I believe it should also be an input. Just annotating it with@Inputwill cause Gradle to eagerly calculate its value (passingnullas parameter) which is not desirable. The solution may be wrapping the closure withProperty<>, but I'm not totally sure. At least one other plugin in a similar situation seem to have gone with internal as well (https://github.com/ben-manes/gradle-versions-plugin/blob/master/src/main/groovy/com/github/benmanes/gradle/versions/updates/DependencyUpdatesTask.groovy#L76)ManifestResourceTransformer, because as far as I can see, that transformer has been broken sinceJarOutputStreamwas replaced byZipOutputStreamin version 0.9.0/1.0.0. This is independent of the changes in this PR and should be solved when this is released upstream: Override ZipOutputStream.write(int) apache/ant#145