-
-
Notifications
You must be signed in to change notification settings - Fork 424
Cache patternSet.asSpec by lazy
#1854
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
Conversation
This prevents some unnecessary allocations during runtime.
| @get:Internal | ||
| internal open val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { |
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.
| @get:Internal | |
| internal open val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { | |
| private val patternSpec: Spec<FileTreeElement> by lazy(LazyThreadSafetyMode.NONE) { |
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.
I'd prefer, but that prevents overriding it.
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.
It shouldn't be overridden. We can just mark it public if necessary.
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.
I noticed it's useful for #1855, we can mark it as protected.
…nsformers/PatternFilterableResourceTransformer.kt
| assertThat(transformer.canTransformResource("META-INF/LICENSE.txt")).isTrue() | ||
| assertThat(transformer.canTransformResource("META-INF/LICENSE.log")).isFalse() |
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.
You shouldn't update these tests, they are unrelated.
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.
Ooops, I see, the conditions are cached.
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.
But it's a consequence of the by lazy, updating the includes/excludes don't change the spec.
PatternSet.asSpecpatternSet.asSpec by lazy
.../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
.../github/jengelman/gradle/plugins/shadow/transformers/PatternFilterableResourceTransformer.kt
Outdated
Show resolved
Hide resolved
…nsformers/PatternFilterableResourceTransformer.kt
This prevents some unnecessary allocations during runtime.
Follow up #1849.