You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix UpgradePluginVersion to handle plugins with 'apply false' (#6269)
* Fix UpgradePluginVersion to handle plugins with 'apply false'
The previous implementation only checked the immediate parent of the
version() method call for the plugins() method. This failed when other
method calls (like 'apply false') were chained between version() and
plugins().
This change walks up the entire method invocation chain to find the
plugins() method, correctly handling patterns like:
id(...) version "x.y.z" apply false
Added test coverage for both Kotlin DSL and Groovy DSL with apply false.
* Add missing newline at end of UpgradePluginVersionTest.java
POSIX standard requires text files to end with a newline character.
* Use GradlePlugin trait in UpgradePluginVersion to simplify plugin matching
Replace manual VERSION_MATCHER, isPluginVersion(), and kotlin special-casing
with the GradlePlugin trait which already understands all plugin declaration
forms. Also fix the trait to unwrap J.Parentheses when extracting version
literals and walk up chained method invocations in withinPlugins().
* Leverage trait's plugin ID matching and remove version method filter
Address PR review feedback:
- Remove "version" method name filter in scanner; let trait match any
plugin chain element
- Use trait's built-in pluginIdPattern filtering instead of custom
matchesPluginId, translating "kotlin" shorthand to
"org.jetbrains.kotlin.*"
- Keep "version" check in visitor only where we modify arguments
* Remove kotlin shorthand translation; use full plugin ID patterns
The trait already expands kotlin("jvm") to org.jetbrains.kotlin.jvm,
so tests should use org.jetbrains.kotlin.* as the pattern rather than
relying on a "kotlin" shorthand translation.
---------
Co-authored-by: baggwanbin <flex-gwanbin@flex.team>
Co-authored-by: Tim te Beek <tim@moderne.io>
0 commit comments