-
Notifications
You must be signed in to change notification settings - Fork 57
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
Use provided
configuration for optional language dependencies
#411
base: main
Are you sure you want to change the base?
Use provided
configuration for optional language dependencies
#411
Conversation
…s and add file-checkers with a reflection-class-exists-check
Co-authored-by: Tim te Beek <[email protected]>
I'd like to use the old nebula provided configuration plugin instead here, such that the dependency winds up with a |
src/main/java/org/openrewrite/staticanalysis/csharp/CSharpFileChecker.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/staticanalysis/groovy/GroovyFileChecker.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/staticanalysis/kotlin/KotlinFileChecker.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/staticanalysis/internal/ClassPathUtils.java
Outdated
Show resolved
Hide resolved
provided
configuration for optional language dependencies
build.gradle.kts
Outdated
} | ||
apply(plugin = "com.netflix.nebula.provided-base") |
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 have both a plugin id
block above and also an apply
call. This apply
mechanism is an old way of applying plugins.
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.
Thx for the info! I am still trying to make it work; I don't have much experience with Gradle, so this was my first attempt. At the moment, the provided
functions do not work at all 😞. I think it has something to do with Kotlin DSL not supported out-of-the-box.
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.
Ah, now I get it! The plugin does not do anything anymore, it's only an empty plugin today:
LOGGER.warn("nebula.provided-base plugin does nothing. Use the 'compileOnly' configuration")
See alse: history.
What do you propose @jkschneider? Start going for the compileOnly
scope? What do you think @timtebeek ? Maybe you have something to say as well @sambsnyd?
FYI: there is another archived project with the same intention.
import org.openrewrite.marker.SearchResult; | ||
|
||
/** | ||
* Add a search marker if vising a CSharp file | ||
*/ | ||
public class CSharpFileChecker<P> extends TreeVisitor<Tree, P> { | ||
private static final boolean IS_CSHARP_AVAILABLE = ReflectionUtils.isClassAvailable("org.openrewrite.csharp.tree.Cs"); |
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.
Let's make an isLanguageAvailable
function part of ReflectionUtils
or otherwise available in the rewrite core modules as this functionality will end up used in many places
What's changed?
Groovy, Kotlin and CSharp dependencies are changed to
compileOnly
. The filechecker-classes have been adjusted with a reflection checkWhat's your motivation?
compileOnly
configuration for optional language dependencies #410Checklist