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

Clarify ValidationErrorBuildItem/ArtifactResultBuildItem/EmptyBuildItem #27427

Merged
merged 1 commit into from Aug 29, 2022

Conversation

Sgitario
Copy link
Contributor

Fix #27314

  • Use ValidationErrorBuildItem wherever we currently use @Produce(EmptyBuildItem.class) in Quarkus core
  • Update the error message for build steps that don't produce anything to remove the mention of @Produce(EmptyBuildItem.class)
  • Add a check to make the build fail whenever a build step uses @Produce(EmptyBuildItem.class) (or maybe more generally when it consumes/produces an abstract class, since that simply cannot work?)
  • Improve the javadoc of ArtifactBuildItem
  • Update the documentation ("Writing extensions") to mention ArtifactBuildItem and explain when it's used.
  • Update the documentation ("Writing extensions") to mention ValidationErrorBuildItem and explain when it's used; include a link to https://quarkus.io/guides/cdi-integration#use-case-i-need-to-validate-the-deployment .
  • Maybe, update the error message for build steps that don't produce anything to mention ArtifactBuildItem/ValidationErrorBuildItem

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 23, 2022

/cc @Sanne, @gsmet, @yrodiere

@quarkus-bot quarkus-bot bot added this to To do in Quarkus Documentation Aug 23, 2022
@Sgitario
Copy link
Contributor Author

@yrodiere I think I've already done all the bullets from the description, but the one about to update the javadocs of ArtifactResultBuildItem because I was not sure what else to describe there.

gsmet
gsmet previously requested changes Aug 23, 2022
docs/src/main/asciidoc/writing-extensions.adoc Outdated Show resolved Hide resolved
Quarkus Documentation automation moved this from To do to Review pending Aug 23, 2022
Copy link
Member

@yrodiere yrodiere 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 taking care of this!

It looks good to me, except for a little something in the documentation, see below.

but the one about to update the javadocs of ArtifactResultBuildItem because I was not sure what else to describe there

I don't know either, to be honest. It looks fine to me as it is. That item in the to-do list was referring to the discussion between @stuartwdouglas and @mkouba. Unless they chime in to tell us what kind of improvement they wanted in this javadoc, I'd leave it alone.

docs/src/main/asciidoc/writing-extensions.adoc Outdated Show resolved Hide resolved
@Sgitario
Copy link
Contributor Author

I've just updated the section you mentioned. Let me know if it looks better now.

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

Ah, but... I didn't mean we should remove all the documentation your added, just that one specific change! The sections about ValidationErrorBuildItem/ArtifactResultBuildItem were great...

I hope you can still find your commit in git reflog?

docs/src/main/asciidoc/writing-extensions.adoc Outdated Show resolved Hide resolved
@quarkus-bot

This comment has been minimized.

@Sgitario
Copy link
Contributor Author

Ah, but... I didn't mean we should remove all the documentation your added, just that one specific change! The sections about ValidationErrorBuildItem/ArtifactResultBuildItem were great...

I hope you can still find your commit in git reflog?

ah ok! I've recovered it back :)

@Sgitario Sgitario requested a review from yrodiere August 23, 2022 19:27
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@@ -85,14 +85,15 @@ AdditionalBeanBuildItem registerRestLinksProviderProducer() {
}

@BuildStep
@Produce(EmptyBuildItem.class)
@Produce(ArtifactResultBuildItem.class)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not use the ValidationErrorBuildItem here because it was causing cycle detected issues. Using ArtifactResultBuildItem did work here.

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@yrodiere yrodiere added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Aug 24, 2022
Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

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

Looks good.

@yrodiere yrodiere dismissed gsmet’s stale review August 26, 2022 13:53

Requested changes have been addressed

Quarkus Documentation automation moved this from Review pending to Reviewer approved Aug 26, 2022
@quarkus-bot

This comment has been minimized.

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 26, 2022

Failing Jobs - Building 0876202

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 18 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 18 #

- Failing: integration-tests/micrometer-prometheus 

📦 integration-tests/micrometer-prometheus

io.quarkus.it.micrometer.prometheus.ClientRequestTest.testClientRequests line 36 - More details - Source on GitHub

java.lang.AssertionError: 
1 expectation failed.
Response body doesn't match expectation.

@yrodiere
Copy link
Member

The failing test is unrelated; merging. Thanks!

@yrodiere yrodiere merged commit ec68e68 into quarkusio:main Aug 29, 2022
Quarkus Documentation automation moved this from Reviewer approved to Done Aug 29, 2022
@quarkus-bot quarkus-bot bot added this to the 2.13 - main milestone Aug 29, 2022
@quarkus-bot quarkus-bot bot added kind/bugfix and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Aug 29, 2022
@Sgitario Sgitario deleted the improve_empty_build_item branch August 29, 2022 06:43
@gsmet
Copy link
Member

gsmet commented Sep 5, 2022

@Sgitario I won't backport this because Kogito released a version with the EmptyBuildItem: kiegroup/kogito-runtimes@587672e .

Any chance you could prepare a commit for kogito-runtimes that they could include in the next version? And backport if they can.

@yrodiere
Copy link
Member

yrodiere commented Sep 5, 2022

Any chance you could prepare a commit for kogito-runtimes

To clarify, the commit needs to replace @Produce(EmptyBuildItem.class) (which doesn't work and will lead to an exception after we backport this PR) with @Produce(ArtifactResultBuildItem.class) (which does work).

Sgitario added a commit to Sgitario/kogito-runtimes that referenced this pull request Sep 6, 2022
In next versions of Quarkus, it won't allow using `@Produce(EmptyBuildItem.class)` (an exception will be thrown). 
More information about this change can be found here: quarkusio/quarkus#27427
Moreover, for the use case you were using `@Produce(EmptyBuildItem.class)`, validations, we should use `ValidationErrorBuildItem`. I didn't do it because it would require adding the dependency `quarkus-arc-deployment`, so I replaced it with `@Produce(ArtifactResultBuildItem.class)` which is guaranteed that the build step will be executed.
@Sgitario
Copy link
Contributor Author

Sgitario commented Sep 6, 2022

@Sgitario I won't backport this because Kogito released a version with the EmptyBuildItem: kiegroup/kogito-runtimes@587672e .

Any chance you could prepare a commit for kogito-runtimes that they could include in the next version? And backport if they can.

Done: https://github.com/kiegroup/kogito-runtimes/pull/2442

@gsmet
Copy link
Member

gsmet commented Sep 6, 2022

Thanks @Sgitario !

Sgitario added a commit to Sgitario/kogito-runtimes that referenced this pull request Sep 7, 2022
In next versions of Quarkus, it won't allow using `@Produce(EmptyBuildItem.class)` (an exception will be thrown). 
More information about this change can be found here: quarkusio/quarkus#27427
Moreover, for the use case you were using `@Produce(EmptyBuildItem.class)`, validations, we should use `ValidationErrorBuildItem`. I didn't do it because it would require adding the dependency `quarkus-arc-deployment`, so I replaced it with `@Produce(ArtifactResultBuildItem.class)` which is guaranteed that the build step will be executed.
Note that the `process-svg` addon won't validate the check anymore as it was not expected (according to Christiano)
cristianonicolai added a commit to apache/incubator-kie-kogito-runtimes that referenced this pull request Sep 9, 2022
* Replace EmptyBuildItem with ArtifactResultBuildItem

In next versions of Quarkus, it won't allow using `@Produce(EmptyBuildItem.class)` (an exception will be thrown). 
More information about this change can be found here: quarkusio/quarkus#27427
Moreover, for the use case you were using `@Produce(EmptyBuildItem.class)`, validations, we should use `ValidationErrorBuildItem`. I didn't do it because it would require adding the dependency `quarkus-arc-deployment`, so I replaced it with `@Produce(ArtifactResultBuildItem.class)` which is guaranteed that the build step will be executed.
Note that the `process-svg` addon won't validate the check anymore as it was not expected (according to Christiano)

* Remove messaging required capabilities

Co-authored-by: Cristiano Nicolai <570894+cristianonicolai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

@Produce(EmptyBuildItem.class) not working
4 participants