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

Restore @DocumentExamples in the docs either through RewriteRecipeExamplesPlugin or alternative #20

Closed
timtebeek opened this issue Aug 16, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@timtebeek
Copy link
Contributor

What problem are you trying to solve?

RewriteRecipeExamplesPlugin was disabed in dec3f04 at the time when some recipes produced invalid yaml(?).
Not exactly clear what circumstances lead to disabling the plugin; not ideal to retry without that context.

Describe the solution you'd like

Would like to see the examples restored in the docs and on the platform, as the @DocumentExample cases help visualize what effect a recipe has, in addition to the name and description.

Have you considered any alternatives or workarounds?

We might call the ExamplesExtractor (or similar) from rewrite-recipe-markdown-generator, such that there's no risk of tripping up the platform with invalid Yaml resources.

Additional context

@knutwannheden
Copy link
Contributor

knutwannheden commented Aug 16, 2023

I believe one problem was that it caused CI builds to be extremely slow or even time out in some repos (rewrite-cobol if I am not mistaken). @jkschneider or @sambsnyd will know more. Please verify that first again. Otherwise we could provide an explicit opt-in or opt-out property.

@timtebeek
Copy link
Contributor Author

Discussed internally as well. Main points copied here.

S: We should disable that at least until we can support lombok in the java parser. The more lombok we use the more missing type information, the slower java parsing goes.
O: maybe we disable it across the board. it fits more with docs generation or some on demand task that in the main build

@timtebeek timtebeek changed the title Restore RewriteRecipeExamplesPlugin Restore @DocumentExamples in the docs either through RewriteRecipeExamplesPlugin or alternative Aug 16, 2023
@timtebeek timtebeek added the documentation Improvements or additions to documentation label Aug 21, 2023
@timtebeek timtebeek moved this to Backlog in OpenRewrite Aug 21, 2023
@timtebeek
Copy link
Contributor Author

So as discussed on the stand up: we can potentially move this to rewrite-recipe-markdown-generator. The steps there are roughly:

  1. Pull over the RecipeExamplesTask method that extracts examples to RRMG; should not need any dependency on Gradle there; we're only interested in how it executes a recipe using a JavaParser, and the underlying ExamplesExtractor it uses.
  2. the RRMG task needs access to the source code of the individual OpenRewrite modules. One way to do that would be to download those from Maven Central, where we also publish -sources.jar files. These can be extracted as regular tar files, to get access to the sources.
  3. The output of the RRMG us currently Yaml files; we likely have some flexibility there in getting those merged into the actual docs. Not sure if GitBook allows you to include files from elsewhere, but that could be easiest. Otherwise it'd be a lookup per recipe if we have a corresponding Yaml recipe example.

That's very high over; there may be specifics or alternatives that I haven't thought of yet, but figured write this down such that Mike can challenge that.

Again, this would only make those docs available on docs.openrewrite.org; unless we're able to fix the performance issues with the RewriteRecipeExamplesPlugin we had before, which we're unlikely to attempt now given the potential impact on run durations.

Alternatively we can only run the existing plugin when we for instance publish a release; but then still there's negative effects on getting a timely release out.

@timtebeek
Copy link
Contributor Author

Closing as a duplicate, with alternative approach listed here which does not require examples to be bundled.

@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenRewrite Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants