-
Notifications
You must be signed in to change notification settings - Fork 364
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
Change Dependency recipes do not work with dependencies defined in jvm-test-suites #4373
Comments
I think you're correct in expecting such cases to be handled by |
Thanks for getting back to me @timtebeek. I have created a PR with the failing test. |
I'll share this oldie, but goodie reference. I envision a state that any of the Gradle dependency recipes work correctly over JVM test suites. As you can tell from the comment and what you've probably gathered from the recipes' behaviors, this is yet another location for dependencies to be declared and handled correctly. This particular aspect will be made a little bit easier when the |
Thanks @shanman190. If someone could outline a high-level solution, along with any areas of potential difficulty, or point me to some specific areas to familiarize myself with, then I'd be happy to take a look and see if I can make progress. |
So for this one, I'd start by debugging the existing recipes to see if the If that isn't the case, then I'd reuse something that I formulated for the The Groovy parser a lot of the time will leave off the type information and rely upon its dynamic dispatch, so that's what makes the initial variable hard to tie down. |
Thanks @shanman190. I will take a look |
@shanman190 The issue was that the dependencies block is not being picked up as a I have updated my PR. This is not a complete solution, but was sufficient to make my failing test pass and to illustrate the problem. For a more complete solution, I have a few questions
interface SuitesSpec {
void test (@DelegatesTo(strategy=Closure.DELEGATE_ONLY, value=SuiteTestSpec) Closure cl)
} |
Hi @sihutch, That's unfortunate to hear that the method was not being type attributed as a As far as more stable remediation, what I'd probably now pivot to is code based upon a new PR of mine found here which introduces the Gradle I think the trait should receive one small update near the beginning of the block to confirm that the current method invocation is contained within a parent method invocation named So envisioning something about like this:
|
@shanman190 - Cool. That's a much better solution |
@shanman190 I have picked this issue up again as this PR #4354 seems to have stalled, and we need this functionality. I have implemented the trait approach from above, and it works; however, I am getting a single failing test in 'ChangeDependencyTest` This test is failing. I have debugged a bit, and it is because the |
@sihutch, alright, the issue with that test is that we are grabbing the configurations from the project, but the |
Closing as fixed by #4376 |
I am using
How are you running OpenRewrite?
I am running OpenRewrite using the Gradle Plugin, and my project is a single module project.
My build.gradle has the same dependency defined in the main dependencies and also with a jvm-test-suites section as shown below
When I run either of the two recipes shown below only the
javax.servlet:javax.servlet-api:3.1.0
in the main dependencies section is changed.I have created an example project here
I was expecting the dependencies in the jvm-test-suite block to also be changed. Can you please confirm whether this is a bug or something that is not implemented ? If that later, is there another recipe that you can recommend that can handle the jvm-test-suite case ?
Thanks
Si
The text was updated successfully, but these errors were encountered: