Skip to content
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 compileOnly configuration for optional language dependencies #410

Open
knutwannheden opened this issue Dec 18, 2024 · 0 comments · May be fixed by #411
Open

Use compileOnly configuration for optional language dependencies #410

knutwannheden opened this issue Dec 18, 2024 · 0 comments · May be fixed by #411
Assignees
Labels
enhancement New feature or request

Comments

@knutwannheden
Copy link
Contributor

What problem are you trying to solve?

Currently, the rewrite-static-analysis has runtime dependencies on language bindings like rewrite-csharp and rewrite-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 on rewrite-static-analysis should not automatically pull them in. Instead the client application should provide them and rewrite-static-analysis should mark them as "provided" (Maven parlance), which I believe would translate to the compileOnly 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 in rewrite-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?

@knutwannheden knutwannheden added the enhancement New feature or request label Dec 18, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Dec 18, 2024
@jevanlingen jevanlingen self-assigned this Dec 23, 2024
@jevanlingen jevanlingen moved this from Backlog to In Progress in OpenRewrite Dec 23, 2024
@jevanlingen jevanlingen linked a pull request Dec 23, 2024 that will close this issue
3 tasks
@jevanlingen jevanlingen linked a pull request Dec 23, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants