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
The OpenRewrite gradle plugin does not work with Android projects because it has no knowledge of sourcesets defined by the Android Gradle Plugin (AGP). When running a recipe on an Android project all source files are parsed as Quark's and recipes have no effect.
Describe the solution you'd like
It would be great if the plugin could support Android projects as they are a big part of the Java and Kotlin ecosystem. Many Android projects are large multi-module gradle projects and OpenRewrite would be a great tool to help with refactors and migrations.
Have you considered any alternatives or workarounds?
I've explored adding support, but I don't have enough context on the inner workings of the plugin to be very effective. But I am willing to work with someone to help validate and test against a large Android project (700+ modules)
The text was updated successfully, but these errors were encountered:
Hi @wbonnefond ; good seeing you here again & thanks for the offer to help! We should have some rudimentary support already based on this earlier discussion (#290 (comment)) but it's clear from your post that more could be done. From these lines down there's some handling of Kotlin which might help you cross reference to what you have
But perhaps it's good to have a minimized example of how you've configured your sourcesets, such that we can work out what needs to be done to support that going forward.
Hey @timtebeek, so this block doesn't actually work for Android gradle modules. They are, by definition, not kotlin multiplatform modules. For android modules it would need to look for one of com.android.library, com.android.application, or com.android.test plugins, and then get the sourcesets from there. Android modules also have a notion of build variants which can have different sourcesets.
This is a very rough WIP. It's been a long time since I've written java code, so I opted to do most of it in kotlin. But it will definitely need to be reworked to reduce duplication with the existing parse code:
What problem are you trying to solve?
The OpenRewrite gradle plugin does not work with Android projects because it has no knowledge of sourcesets defined by the Android Gradle Plugin (AGP). When running a recipe on an Android project all source files are parsed as
Quark
's and recipes have no effect.Describe the solution you'd like
It would be great if the plugin could support Android projects as they are a big part of the Java and Kotlin ecosystem. Many Android projects are large multi-module gradle projects and OpenRewrite would be a great tool to help with refactors and migrations.
Have you considered any alternatives or workarounds?
As far as I can tell, there isn't a workaround.
Additional context
Are you interested in contributing this feature to OpenRewrite?
I've explored adding support, but I don't have enough context on the inner workings of the plugin to be very effective. But I am willing to work with someone to help validate and test against a large Android project (700+ modules)
The text was updated successfully, but these errors were encountered: