Open abetaev-equinix opened 8 months ago
Hi @abetaev-equinix ; Generally we recommend folks apply the plugin to the root project and any subprojects through that, as recipes that parse for instance classes often need the output of other modules too for type resolution. Your case here is of course an exception where things are simplfied to a great extent. I'm not sure if we can generalize the case for running against a submodule that easily, with an eye towards more complex recipes and type resolution, but you're welcome to help explore that.
while looking for a way to walk this around i have noticed even weirder behavior: i have
root
|-module
| |-submodule
| | |- ...
| | |- gradlew
| | |- settings.gradle.kts
| | |- rewrite.yml
| | '- init.gradle
| '- ...
|- ...
'- settings.gradle.kts
and when i run ./gradlew
while module/submodule
is being CWD, it still creates that gradle.properties
on top-level project, i.e. near top-level settings.gradle.kts
file.
this is definitely not the way it supposed to work: settings.gradle.kts
indicates root project for gradle.
and that module/submodule
is not even in top-level settings file...
as recipes that parse for instance classes often need the output of other modules too for type resolution
@timtebeek , I am afraid that is not exactly the reason.
The parser does not use source files for dependencies, and it always uses .class
files for both third-party, inter-project, and same-project dependencies.
In other words, it is fine if parsing one of the projects requires compilation of something else, however, it does not mean the parser must observe all the sources at once every time.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Gradle plugin, and my project is a multi-module project. I have
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
gradle.properties
is created inmodule/submodule/
directory.What did you see instead?
gradle.properties
is created in root directory.Are you interested in contributing a fix to OpenRewrite?
If this is a bug, I can think of how this can be fixed. The plugin's documentation does not state what is path relative to. I would expect the module where task runs, as per the Gradle plugin documentation: