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

Change Type recipe now shows a Kotlin example only #211

Closed
timtebeek opened this issue Jul 21, 2023 · 16 comments
Closed

Change Type recipe now shows a Kotlin example only #211

timtebeek opened this issue Jul 21, 2023 · 16 comments
Labels
blocked When an issue can't be worked on right now bug Something isn't working documentation Improvements or additions to documentation

Comments

@timtebeek
Copy link
Contributor

Would have expected a Java example at least, not only Kotlin.
https://docs.openrewrite.org/recipes/java/changetype

@timtebeek timtebeek added bug Something isn't working documentation Improvements or additions to documentation labels Jul 21, 2023
@timtebeek
Copy link
Contributor Author

@kunli2 / @mike-solomon not sure if this is in the right repository, or who of you would best know how to resolve this.

@timtebeek timtebeek moved this to Backlog in OpenRewrite Jul 22, 2023
@mike-solomon
Copy link
Contributor

I suspect this is probably going to require a change in the markdown generator and that Kun would have the background for this. I haven’t looked at the auto generated test stuff.

@mike-solomon
Copy link
Contributor

mike-solomon commented Jul 31, 2023

I took a look into this and I'm wondering if the Groovy stuff is perhaps conflicting with the Java stuff. For instance, I see that the ChangeType recipe is using this test in the docs instead of the one I'd expect.

It also is somehow getting a path of file.kt, but I don't see where that is coming from.

I'm not really sure where to go from here. Marking as blocked. Will need assistance from someone else to continue.

@mike-solomon mike-solomon added the blocked When an issue can't be worked on right now label Jul 31, 2023
@timtebeek
Copy link
Contributor Author

I think it's even this test that's picked up, since the docs mention Kotlin:
https://github.com/openrewrite/rewrite-kotlin/blob/678acef1b7d656e8df75e1bedd7c4c6b7cb497ca/src/test/java/org/openrewrite/kotlin/ChangeTypeTest.java#L149-L151

Is there anyway to disambiguate which one gets shown in the docs @kunli2 ?

@mike-solomon
Copy link
Contributor

mike-solomon commented Jul 31, 2023

Ah good find @timtebeek that makes more sense. I think we'll need help from Kun or someone with more of a background on how this test annotation works.

@kunli2
Copy link
Contributor

kunli2 commented Aug 1, 2023

Seems the plug-in doesn't work on the rewrite repo, so the java example yaml file was not generated as expected from rewrite.
however, the plug-in works for other repos.
I'll look into this issue.

@kunli2
Copy link
Contributor

kunli2 commented Aug 2, 2023

I have verified that, after bumping the rewrite version in the plug-in (openrewrite/rewrite-build-gradle-plugin@e034bfd), the parsing error in rewrite is fixed.
Will release rewrite-build-gradle-plugin and rewrite will automatically pick up the latest plug-in and missing java examples will be back

update: released rewrite-build-gradle-plugin 1.12.1

@kunli2
Copy link
Contributor

kunli2 commented Aug 2, 2023

Hi @mike-solomon, do we want to update the doc or wait until the next rewrite release (nothing needs to do)?

@mike-solomon
Copy link
Contributor

@kunli2 I just tried re-generating the docs just now and I still see the Java Change Type recipe showing Kotlin code. Does something else need to happen for these changes to appear?

@kunli2
Copy link
Contributor

kunli2 commented Aug 2, 2023

I think that's because the rewrite didn't pick up the latest rewrite-build-gradle-plugin 1.12.1 but 1.12.0.
you can do this in your local to force pick up the 1.12.1

diff --git a/build.gradle.kts b/build.gradle.kts
index eddf8702a..85038a402 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,6 +1,6 @@
 plugins {
-    id("org.openrewrite.build.root") version("latest.release")
-    id("org.openrewrite.build.java-base") version("latest.release")
+    id("org.openrewrite.build.root") version("1.12.1")
+    id("org.openrewrite.build.java-base") version("1.12.1")
     id("org.openrewrite.rewrite") version("latest.release")
 }

@mike-solomon
Copy link
Contributor

After making the changes, I haven't been able to get the expected results locally. Kun is going to try and run the markdown generator on his machine and see if it works for him.

@mike-solomon
Copy link
Contributor

This should be resolved once the next version of OpenRewrite is released and we re-generate the docs. Leaving as blocked until the next release happens.

@mike-solomon
Copy link
Contributor

mike-solomon commented Aug 7, 2023

@kunli2 I re-generated the docs today and ChangeType no longer has any example associated with it. I remember last week it was mentioned that the example code was slowing down builds. I'm guessing no recipes will have examples anymore right now?

@timtebeek
Copy link
Contributor Author

I'd noticed openrewrite/rewrite-build-gradle-plugin@dec3f04 just now; that'll factor in. Not clear yet why or how to resolve, but figured share it here such you at least know.

@timtebeek
Copy link
Contributor Author

I've just logged openrewrite/rewrite-build-gradle-plugin#20 to track why the examples aren't extracted right now.

@mike-solomon
Copy link
Contributor

As this is similar to this issue and as that issue is probably not going to be resolved anytime soon, I'm going to close this. If examples are ever produced again for the docs, we can come back and ensure that Kotlin ones work appropriately.

@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenRewrite Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked When an issue can't be worked on right now bug Something isn't working documentation Improvements or additions to documentation
Projects
Archived in project
Development

No branches or pull requests

3 participants