Closed BoykoAlex closed 11 months ago
Should we transfer this issue to https://github.com/openrewrite/rewrite-all ? That's where we maintain the OmniParser
.
It certainly could. I'm guessing that a similar change is coming for the Maven plugin as well.
One aspect that's a bit different from the maven plugin is that the MavenParser
is used outside of the resource parsing and the GradleParser
was only used within the Gradle plugin. What this means is that historically, these build files would only be parsed when using the respective build plugin. So moving this logic to the OmniParser
would have a change in behavior such that it would enabling parsing regardless of build tool.
It's very uncommon for both build tool descriptors to be present, but there is the exception for sample projects. For those, they often have both in an attempt to meet the end user where they are comfortable. By moving this logic from the build plugins to the OmniParser
it would actually enable the trait that later on recipes would be able to modify both build descriptors in one pass rather than having to perform two passes, one with each respective build tool.
I don't think that OmniParser
should have GradleParser
by default... I think it should be added from Gradle Plugin code with proper classpaths for build script and settings script parsing...
Yeah, that's true. It's probably going to be pretty difficult to accurately get those classpath entries from anywhere other than the Gradle plugin.
It should be also be noted though that after a release this morning, this issue is now present in the latest release.
@jkschneider the latest rewrite-gradle-plugin release does not parse .gradle
files anymore. Is that something you'd like to take on yourself to avoid conflicts as you continue to work on the parsers & plugins?
Likely fixed in https://github.com/openrewrite/rewrite-gradle-plugin/commit/099e0a77047fd1b11ba18c5177a3a65ee98ff22b by @sambsnyd
Marking this as resolved; thanks all!
This issues is only in the current snapshot and is the result of
DefaultProjectParser
refactoring - this is just a reminder not to forget this thing.The switch to
OmniParser
fromResourceParser
resulted in.gradle
files not parsed becauseOmniParser
does not haveGradleParser
therefore this parser with proper build script and settings classpaths needs to be added to the OmniParser. Addition of a parser is inconvenient because it adds a parser at the end which meansPlainTextParser
would intercept.gradle
files...