Cache patternSet.asSpec by lazy#1854
Merged
Goooler merged 6 commits intoGradleUp:mainfrom Nov 17, 2025
Merged
Conversation
This prevents some unnecessary allocations during runtime.
1 task
Goooler
reviewed
Nov 17, 2025
Comment on lines
+20
to
+21
| @get:Internal | ||
| internal open val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { |
Member
There was a problem hiding this comment.
Suggested change
| @get:Internal | |
| internal open val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { | |
| private val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { |
Contributor
Author
There was a problem hiding this comment.
I'd prefer, but that prevents overriding it.
Member
There was a problem hiding this comment.
It shouldn't be overridden. We can just mark it public if necessary.
Member
There was a problem hiding this comment.
I noticed it's useful for #1855, we can mark it as protected.
…nsformers/PatternFilterableResourceTransformer.kt
Goooler
reviewed
Nov 17, 2025
Comment on lines
-29
to
-30
| assertThat(transformer.canTransformResource("META-INF/LICENSE.txt")).isTrue() | ||
| assertThat(transformer.canTransformResource("META-INF/LICENSE.log")).isFalse() |
Member
There was a problem hiding this comment.
You shouldn't update these tests, they are unrelated.
Member
There was a problem hiding this comment.
Ooops, I see, the conditions are cached.
Contributor
Author
There was a problem hiding this comment.
But it's a consequence of the by lazy, updating the includes/excludes don't change the spec.
PatternSet.asSpecpatternSet.asSpec by lazy
Goooler
approved these changes
Nov 17, 2025
.../github/jengelman/gradle/plugins/shadow/transformers/ApacheLicenseResourceTransformerTest.kt
Outdated
Show resolved
Hide resolved
...m/github/jengelman/gradle/plugins/shadow/transformers/ApacheNoticeResourceTransformerTest.kt
Outdated
Show resolved
Hide resolved
…nsformers/ApacheLicenseResourceTransformerTest.kt
…nsformers/ApacheNoticeResourceTransformerTest.kt
Goooler
reviewed
Nov 17, 2025
.../github/jengelman/gradle/plugins/shadow/transformers/PatternFilterableResourceTransformer.kt
Outdated
Show resolved
Hide resolved
…nsformers/PatternFilterableResourceTransformer.kt
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 prevents some unnecessary allocations during runtime.
Follow up #1849.