-
Couldn't load subscription status.
- Fork 3k
Manually enforce platform constraints for conditional dependencies in QuarkusComponentVariants #50388
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
Conversation
df0cf7e to
75b80ed
Compare
|
We definitely want some tests for this change. That would basically mean pre-installing two versions of an extension (as part of a test) that is a conditional dependency. And then writing a few tests:
|
This comment has been minimized.
This comment has been minimized.
5bd8fcf to
5902456
Compare
@aloubyansky should be done now. |
This comment has been minimized.
This comment has been minimized.
devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ManualPlatformSpec.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reaver585 this is looking good to me, thanks a lot!
I added a few remarks but they are not blocking this change from merging.
...-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
Outdated
Show resolved
Hide resolved
devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/PlatformSpec.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| if (matchingConstraints.size() > 1) { | ||
| throw new RuntimeException("Multiple matching constraints for " + dep + ": " + matchingConstraints); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could happen and we shouldn't fail. I think, what could help is catching these clashes early, when we initialize a PlatformSpec.
For example, there could be multiple artifacts mentioned in the BOM with the same group and artifact IDs but different classifiers and/or types. They could even have the same version. Let's make sure this does not result in an error.
Then, on purpose or not, a BOM (the original Maven POM XML, at least) may include different versions of the same artifact. It doesn't make sense but it may happen. In this case, the first occurrence should be the effective one.
A tricky case would be when org.acme:acme-lib:1.0 and org.acme:acme-lib:some-classifier:2.0 are found among the constraints. Then it's kinda difficult to pick a common version for org.acme:acme-lib.
To avoid that, ideally, we should be using groupId:artifactId:classifier:type when recording constraints and during matching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed bilaterally, we are not going to implement such functionality, mapping GA to a list of constraints, because, when we process the platform configuration and its DependencyResultDetails in here, all such DependencyResultDetails are already deduped based on GA. So, multiple constraints for a unique GA aren't exposed to us, despite they are actually declared in Quarkus' platform BOM.
Moreover, neither classifier, nor type, and nor the exludeRules in these processed BOM dependencies.
|
@gsmet quick question: do you know if I can access the test reports? On the previous pipeline run, a test (JVM 25) job failed, GHA logs are definitely not enough, and the uploaded artifacts on the summary page get me an archive (test-reports-JVM Tests - JDK 25) with some dirs but no files at all. |
0aa6b50 to
7336c76
Compare
...-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
Outdated
Show resolved
Hide resolved
207f41c to
9bba02a
Compare
This comment has been minimized.
This comment has been minimized.
...gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/QuarkusComponentVariants.java
Outdated
Show resolved
Hide resolved
9bba02a to
8b5cef2
Compare
...gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/QuarkusComponentVariants.java
Outdated
Show resolved
Hide resolved
… QuarkusComponentVariants Addresses quarkusio#49743
8b5cef2 to
c315a0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @reaver585 !
Status for workflow
|
Addresses #49743