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

Allow to exclude JAX-RS classes with annotations #15215

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

essobedo
Copy link
Contributor

@essobedo essobedo commented Feb 20, 2021

fixes #15214

Motivation

The idea of this feature is to provide an easy way to include/exclude JAX-RS resource, provider and feature classes at build time by relying on the build time conditions

Modifications:

  • Makes ResteasyReactiveCommonProcessor#handleApplication and ResteasyServerCommonProcessor#build depend on BuildTimeConditionBuildItem to have access to all computed build time conditions.
  • Adds a method getExcludedClasses to both extensions to retrieve the list of classes that need to be excluded
  • Adds the property buildTimeConditionAware to both extensions to be able to disable the feature if needed knowing that it is enabled by default
  • Ensures that the feature will be disabled if a JAX-RS Application with classes to include has been defined
  • Adds a new build item PreAdditionalBeanBuildTimeConditionBuildItem to be able evaluate build time conditions before processing AdditionalBeanBuildItem to avoid a circular dependency.

Result

The JAX-RS classes can now be included/excluded thanks to the build time conditions

@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/resteasy-classic area/rest labels Feb 20, 2021
@essobedo essobedo force-pushed the 15214/exclude-jaxrs-classes branch from 0f5312c to fba16b4 Compare February 20, 2021 13:37
Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

Thanks for this work!

I like the idea, but I have a couple hesitations:

  1. I don't think it will work properly for RESTEasy Classic for anything besides JAX-RS Resources
  2. If we have support for IfBuildProfile, we should also have support for UnlessBuildProfile

@essobedo
Copy link
Contributor Author

essobedo commented Feb 22, 2021

Thanks for this work!

I like the idea, but I have a couple hesitations:

  1. I don't think it will work properly for RESTEasy Classic for anything besides JAX-RS Resources
  2. If we have support for IfBuildProfile, we should also have support for UnlessBuildProfile

@geoand I'm glad that you like the idea 😄

About your remark:

  1. If you check well in my PR I cover both (classic and reactive) and according to my ITs it works on both unless I miss your point
  2. The PR actually covers IfBuildProfile, UnlessBuildProfile, IfBuildProperty and UnlessBuildProperty as you can see in the IT

@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

Thanks for this work!
I like the idea, but I have a couple hesitations:

  1. I don't think it will work properly for RESTEasy Classic for anything besides JAX-RS Resources
  2. If we have support for IfBuildProfile, we should also have support for UnlessBuildProfile

@geoand I'm glad that you like the idea

About your remark:

  1. If you check well in my PR I cover both (classic and reactive and according) to my IT it works on both unless I miss your point

Yeah, I saw that. I am just sceptical that some other use case will come along that won't work.
For RESTEasy Reactive I am confident it will work :)

  1. The PR actually covers IfBuildProfile, UnlessBuildProfile, IfBuildProperty and UnlessBuildProperty as you can see in the IT

Well, I don't see that actually :P

@essobedo
Copy link
Contributor Author

essobedo commented Feb 22, 2021

Well, I don't see that actually :P

@geoand In the Integration Test you have:

  • IfBuildProfile here
  • UnlessBuildProfile here
  • IfBuildProperty here
  • UnlessBuildProperty here

@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

OK thanks.

If CI has passed on your fork, then go ahead and take the PR out of draft.
Furthermore, we'll need some documentation bits

@essobedo essobedo marked this pull request as ready for review February 22, 2021 08:55
@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

Also, don't forget to squash the commits once the review is done (I can't promise you a timeline for this ufortunately)

@essobedo essobedo force-pushed the 15214/exclude-jaxrs-classes branch from 04bec49 to ba68e3f Compare February 22, 2021 10:54
@essobedo
Copy link
Contributor Author

Also, don't forget to squash the commits once the review is done (I can't promise you a timeline for this ufortunately)

@geoand ok, no problem, meanwhile I squashed my commits

@essobedo
Copy link
Contributor Author

essobedo commented Feb 22, 2021

FYI the test that fails on the CI, doesn't fail on my local machine, maybe it is known as a random failure?

@geoand
Copy link
Contributor

geoand commented Feb 22, 2021

Most likely it's a flaky test, I'll rerun it

@essobedo essobedo force-pushed the 15214/exclude-jaxrs-classes branch from ba68e3f to 4ab150f Compare February 23, 2021 14:39
@essobedo essobedo requested a review from geoand February 23, 2021 14:42
@essobedo essobedo force-pushed the 15214/exclude-jaxrs-classes branch 2 times, most recently from 5156ff8 to 9fb0605 Compare February 23, 2021 15:15
@essobedo essobedo requested a review from geoand February 23, 2021 15:17
Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

This is great work, thanks!

Once the doc issues I suggested are addressed and CI finishes, let's merge

@geoand geoand added triage/waiting-for-ci Ready to merge when CI successfully finishes and removed area/arc Issue related to ARC (dependency injection) area/documentation labels Feb 23, 2021
@geoand
Copy link
Contributor

geoand commented Feb 23, 2021

And of course we'll need the commits squashed :)

@essobedo essobedo force-pushed the 15214/exclude-jaxrs-classes branch from 12f88dd to c03a357 Compare February 23, 2021 15:23
@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/documentation labels Feb 23, 2021
@essobedo essobedo requested a review from geoand February 23, 2021 15:23
@geoand
Copy link
Contributor

geoand commented Feb 23, 2021

Just to satisfy my curiousity, how do you plan to use this feature?

@essobedo
Copy link
Contributor Author

And of course we'll need the commits squashed :)

@geoand done

@essobedo
Copy link
Contributor Author

essobedo commented Feb 23, 2021

Just to satisfy my curiousity, how do you plan to use this feature?

@geoand Good question 😄 . This is actually one part of my need, my second need (next contribution if accepted by you, the Quarkus team?) is to be able to manage several artifacts with different classifiers in the same module with the maven plugin, pretty much like when you propose the same artifact but for different target JDK versions. The idea behind is to have the same module in which you have everything mixed but annotated with build time conditions and build your final artifact with different build profiles. You would then be able to create an artifact for 'dev', 'stating' and 'prod' from the same module with one single maven command instead of launching the build command for each profile.

@geoand
Copy link
Contributor

geoand commented Feb 23, 2021

Understood, thanks for the info

@gsmet gsmet merged commit faa48d7 into quarkusio:master Feb 24, 2021
@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Feb 24, 2021
@essobedo essobedo deleted the 15214/exclude-jaxrs-classes branch February 24, 2021 08:57
@famod famod removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to exclude JAX-RS classes with annotations
4 participants