-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Better support for APT in dev mode #37044
Conversation
...ent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/workspace/SourceDir.java
Outdated
Show resolved
Hide resolved
@FroMage do you plan to continue progress on this for 3.7? 3.7.0.CR1 will be released next Wednesday and this looks like a very nice improvement. |
I'm not sure I'd be able to finish this in time, the Gradle part is still entirely missing, and so are tests. |
I've rebased and implemented the change. What remains is being able to test APT processors, really not sure where and how I could do that. And Gradle, and this is even harder. Any guidance, @aloubyansky ? |
Let's begin with some Maven tests. I suppose you want to test a project in dev mode for that. I guess that could be a starting point. |
Thanks! |
Wow, there's sooo many projects in this test. Also, it's been running for an hour locally 😱 I'll run only my tests in the future 😂 |
You probably know @FroMage but just in case you can run individual tests with |
Yeah, thanks. While writing the docs, I noticed that QueryDsl is now advising yet another way to declare APT processors, via the https://github.com/querydsl/querydsl/tree/master/querydsl-jpa#querydsl-jpa |
Actually, based on https://github.com/querydsl/apt-maven-plugin this is legacy, so let's forget it. |
So, while adding a test, I wanted to see if the
|
I think I found a way |
Rebased and added tests and dependency management for APT processors as supported by the latest Maven Java Compiler plugin (see #37477). So now, all that's missing is the Gradle support. Is it required before we merge this, or can we do it in two steps? |
This comment has been minimized.
This comment has been minimized.
Pushed a fix for the NPE |
I think we can add Gradle support in a separate PR |
Fine by me. But still, who's our resident Gradle person who can help me with that? Or better yet, do it 😂 |
I'm not sure why that directory is not created, and who's supposed to create it. I guess probably it's Maven which is supposed to create it. This test is about a non-existent source directory, not output. I wonder if I should auto-create it, or detect that it does not exist and not set it. Perhaps Maven doesn't create it IFF there's no annotation processor? Let's look at the sources. |
Yeah, the Maven compiler creates it if it does not exist. I do wonder why it does not happen in my case, but I'll just create it and call it a week. https://github.com/psiroky/maven-compiler-plugin/blob/master/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java#L757 |
This comment has been minimized.
This comment has been minimized.
Otherwise, Maven places APT-generated sources in target/generated-sources/annotations while quarkus:dev places them in target/classes
This latest rebase and bug fix should fix the remaining Gradle test (not support for Gradle, just preventing it from crashing). |
This comment has been minimized.
This comment has been minimized.
CI failure doesn't seem related, can't reproduce locally, re-running failed job. |
I'll give you some pointers similar to the Maven ones. Unlike Hope that helps? |
Well, I also have to find out how to declare APT processors in Gradle, and how to extract their info, and where Gradle places generated sources. But sure, it does help, thanks :) |
I suppose I should update documentation as part of this PR too. |
Here is one more relevant pointer https://github.com/quarkusio/quarkus/tree/main/integration-tests/gradle/src/main/resources/annotation-processor-simple-module |
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. You can consult the Develocity build scans. |
Fixes #1502
With this, there are three supported ways of running APT:
annotationProcessorPaths
annotationProcessors
This works for Maven, but not Gradle. This needs tests, but not sure where to add them.
Most of this work required passing the right options to
javac
as part of DEV mode, as well as the proper output folder for generated sources (otherwise mvn would put them somewhere, and our DEV mode somewhere else).