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

Jakarta rewrite infrastructure #24584

Merged
merged 7 commits into from
Mar 28, 2022
Merged

Jakarta rewrite infrastructure #24584

merged 7 commits into from
Mar 28, 2022

Conversation

gsmet
Copy link
Member

@gsmet gsmet commented Mar 28, 2022

Hey @manovotn @Sanne @maxandersen @n1hility @radcortez ,

Here is the promised PR with the Jakarta rewrite infrastructure. It required quite a lot of experiments but I'm quite happy with the result (it looks far more simple in the end than all the experiments I had to do to get to this result). The hardest part was to find a way to apply the changes without ending up with something you can't build anymore as OpenRewrite needs the Maven build to work.

I went until the ArC extension in this first PR. My next step is to be able to build the Hibernate Validator one as it shouldn't be too hard on the HV side but will unblock quite a lot of dependencies as a lot of them are built on the same model and will require the same dependencies for them to work.
It should be far faster now that I figured out a way to orchestrate this thing.

I added a jakarta/README.md explaining the general approach and I would be happy to present the approach to you anytime.

Note that this requires (but good news, everything is taken care of in the jakarta/transform.sh script so you don't have to do anything related to this):

  • a patched version of OpenRewrite (I'm contributing my patches back there so that's until they merged them)
  • a patched version of the Rewrite Maven Plugin
  • a patched version of the Kotlin Maven Plugin (yes, I know... but I need to be able to skip the main compilation which the Kotlin plugin does not support, it only supports maven.test.skip for the test compilation)
  • the script also builds SmallRye Config while waiting for the CR2 promised by Roberto

Please see the jakarta/README.md before experimenting with this as it has a few advices on how to experiment.

Let's wait for CI on this one as I had to do some more build fixes in addition to the ones that I already merged. These build fixes are in separate commits.

Questions welcome. Happy to present this work in a call.

@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/core area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform area/spring Issues relating to the Spring integration area/testing labels Mar 28, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 28, 2022

/cc @manovotn, @maxandersen, @radcortez, @Sanne

You can for instance use the following approach:

- create a `quarkus-jakarta` copy of your `quarkus` repository
- add a `jakarta` remote to this `quarkus-jakarta` copy: `git remote add jakarta ../quarkus/`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:
git worktree add ../quarkus-jakarta


The active recipes have to be declared in the target POM with a `plugin` block in the `<build><plugins>` section similar to:

```xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we not avoid all the pom.xml changes by putting this plugin config in parent and have it pickup rewrite.yml ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's already what is done for what you can centralize (it's still there several times because of the independent projects).

But as explained in the README, we want to apply different recipes to different pom files so you can't centralize the active recipes.

In any case, it's just a matter of doing a clean afterwards, it should take 5 minutes or so. And it doesn't have any consequences on the build if you don't call the plugin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack - its just that if there is a rewrite.yml next to the pom.xml my jbang based runner for rewrite could be used in a parallel and removed need to change each pom.xml ...just add rewrite.yml where needed.

@Sanne
Copy link
Member

Sanne commented Mar 28, 2022

It's failing for me with:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.377 s
[INFO] Finished at: 2022-03-28T15:01:17+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'rewrite' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/sanne/.m2/repository), jboss-public-repository (https://repository.jboss.org/nexus/content/groups/public/), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

Is that a reasonable clue for you?

@gsmet
Copy link
Member Author

gsmet commented Mar 28, 2022

Is that a reasonable clue for you?

Not really. Which particular project is failing with this error?
I should have declared the plugin in all the independent projects and I have run these things so many times I'm surprised you can have a problem with it vanilla.

@Sanne
Copy link
Member

Sanne commented Mar 28, 2022

Attaching the full logs:
transform.log.gz

@gsmet
Copy link
Member Author

gsmet commented Mar 28, 2022

OK, so the problem Sanne has is that they released a new version of the rewrite-maven-plugin since I started working on this and it messes things up.
I forked it too to make things more stable.

@gsmet gsmet force-pushed the jakarta-bootstrap branch from 243f26b to 27257e4 Compare March 28, 2022 15:09
@Sanne
Copy link
Member

Sanne commented Mar 28, 2022

Excellent, works fine for me as well now.

@quarkus-bot

This comment has been minimized.

@gsmet gsmet force-pushed the jakarta-bootstrap branch from 27257e4 to 511edcb Compare March 28, 2022 15:45
@radcortez
Copy link
Member

Excellent work @gsmet. Thanks!

@Sanne Sanne added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Mar 28, 2022
gsmet added 7 commits March 28, 2022 22:30
This simplifies things a lot but requires a few adjustments to be able
to skip compilation during the run.
Obviously, you need to have a previous build complete so that you have
all pieces around.
Also you might miss the latest adjustments to OpenRewrite so make sure
you do a full build from time to time.
@gsmet
Copy link
Member Author

gsmet commented Mar 28, 2022

CI was green. I'm force pushing to squash a !fixup commit.

@gsmet gsmet force-pushed the jakarta-bootstrap branch from 511edcb to 4c31674 Compare March 28, 2022 20:32
@gsmet gsmet merged commit 583010c into quarkusio:main Mar 28, 2022
@quarkus-bot quarkus-bot bot added this to the 2.9 - main milestone Mar 28, 2022
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) area/core area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/jakarta area/platform Issues related to definition and interaction with Quarkus Platform area/spring Issues relating to the Spring integration area/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants