Use compileOnly
configuration for optional language dependencies
#410
Labels
enhancement
New feature or request
What problem are you trying to solve?
Currently, the
rewrite-static-analysis
has runtime dependencies on language bindings likerewrite-csharp
andrewrite-kotlin
(more to follow). These can be "heavy" and if the user doesn't care about them, they shouldn't have to bring them in.Describe the solution you'd like
These dependencies (except for
rewrite-java
of course) should be optional. Thus, a dependency onrewrite-static-analysis
should not automatically pull them in. Instead the client application should provide them andrewrite-static-analysis
should mark them as "provided" (Maven parlance), which I believe would translate to thecompileOnly
Gradle configuration.Additionally, the recipes need to make sure to not fail with runtime exceptions, if these dependencies are "missing". Thus, utility visitors like
CSharpFileChecker
should be based on reflection. (Possibly it would make sense to have a generic visitor inrewrite-core
, which can be instantiated with a class name, but this is optional and maybe not even a good idea.)Have you considered any alternatives or workarounds?
Additional context
Are you interested in contributing this feature to OpenRewrite?
The text was updated successfully, but these errors were encountered: