Let Kotlin DSL gracefully handle lambdas registered as extensions #10758
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.
Local Groovy Closure, local Kotlin lambda, local Java lambda, all makes the Kotlin DSL fails throwing an exception starting with Gradle 5.6. This is due to changes in
kotlin-reflect
1.3.41 that is now more correct and refuse to answer queries it can't complete.This PR lets the
ProjectSchemaProvider
skip local, anonymous and synthetic classes when finding the nearest public type visible to Kotlin when gathering the schema elements.This plugin got broken with the Kotlin DSL in Gradle 5.6 and triggered this work. It registers a local Groovy Closure as an extension: https://github.com/wpilibsuite/GradleRIO/blob/304f416e374874fd73b994999aa9fab6cbf7e4a0/src/main/groovy/edu/wpi/first/gradlerio/frc/FRCPlugin.groovy#L76-L78