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 plug a custom rule resolver #19

Closed
lburgazzoli opened this issue Feb 13, 2020 · 9 comments
Closed

Allow to plug a custom rule resolver #19

lburgazzoli opened this issue Feb 13, 2020 · 9 comments
Labels
wontfix This will not be worked on

Comments

@lburgazzoli
Copy link

As today to provide rules one has to create a property like:

<mvnd.builder.rule>
    camel-quarkus-core-xml-deployment,camel-quarkus-file-deployment,camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-timer-deployment
</mvnd.builder.rule>

Would be nice if mvnd would allow to plug a custom rule resolver so that there won't be the need to pollute poms.

As the example above is taken from camel-quarkus, one could develop a custom resolver that could compute the rules from the dependencies.

@gnodet
Copy link
Contributor

gnodet commented Feb 13, 2020

I understand, but the rules are in addition to dependency ordering.
That's mostly used in the cases the build is somewhat deficient and relies on the modules order defined in the <modules> section instead of relying on proper dependencies.
That said, I think an external file would be a good idea, something like a mvnd.properties file in the root directory of the project.

In general, a good alternative would be to fix the pom to have explicit dependencies instead of implicit dependencies defined by the modules order.

@ppalaga
Copy link
Contributor

ppalaga commented Feb 13, 2020

That said, I think an external file would be a good idea, something like a mvnd.properties file in the root directory of the project.

This is not what @lburgazzoli asks for. He'd rather like an SPI for plugging in a custom piece of code that can produce the missing rules on demand.

In case Camel Quarkus and Quarkus, any form of hard coded rules will get outdated when there is a change in the dependencies of the itest. Having a dynamic lookup for that would avoid the maintenance costs. Moreover, the dynamic lookup implentation could perhaps be the same for Camel Quarkus, Quarkus and any other project having Quarkus extensions and their itests in the same source tree.

In general, a good alternative would be to fix the pom to have explicit dependencies instead of implicit dependencies defined by the modules order.

Yes, this should be preferred, but I am afraid that's not possible with Quarkus itests. The deployment modules are hidden by design and adding them would actually break the build.

@lburgazzoli
Copy link
Author

@ppalaga thx for clarify the issue and btw it was not supposed to be sent as it did lack lot of contextual info.

@gnodet the origin of the issue is from here

@gnodet
Copy link
Contributor

gnodet commented Feb 13, 2020

I see. I rejected the pluggable rule at first glance as I saw it as a bad way to solve pom problems. The reason is that we have the same kind of problems in camel main tree (where a bunch of modules should depend on all components).
I'll have a look at a pluggable rules producer. I suppose a groovy script that would receive the MavenSession or MavenProject object as the input and produce a list of strings would be ok ?

@ppalaga
Copy link
Contributor

ppalaga commented Feb 13, 2020

I suppose a groovy script that would receive the MavenSession or MavenProject object as the input and produce a list of strings would be ok ?

What a flexibility! Sounds much easier than having a proper jar available in a remote Maven repo.

@lburgazzoli
Copy link
Author

I suppose a groovy script that would receive the MavenSession or MavenProject object as the input and produce a list of strings would be ok ?

What a flexibility! Sounds much easier than having a proper jar available in a remote Maven repo.

At some point, we'll end up with gradle :P

@ppalaga
Copy link
Contributor

ppalaga commented Feb 13, 2020

No, no, nobody asks for too much Gradle!

@ppalaga
Copy link
Contributor

ppalaga commented Feb 14, 2020

I suppose a groovy script that would receive the MavenSession or MavenProject object as the input and produce a list of strings would be ok ?

Thinking of it again, for the particular case of Quarkus itests, it would be much more performant if the script is called just once for the whole source tree. Figuring out which modules in the source tree are extensions should be done just once.

@gnodet gnodet closed this as completed in 4e684aa Feb 17, 2020
@gnodet
Copy link
Contributor

gnodet commented Feb 17, 2020

I added a way to provide a custom groovy provider.
You need to provide either a script or a url to a script:

        <mvnd.builder.rules.provider.url>tooling/mvnd.rules.provider.groovy</mvnd.builder.rules.provider.url>

or

        <mvnd.builder.rules.provider.script><![CDATA[
        return """
            camel-quarkus-core-deployment,camel-quarkus-aws-*-deployment,camel-quarkus-log-deployment,camel-quarkus-timer-deployment -> camel-quarkus-integration-test-aws
            camel-quarkus-core-deployment,camel-quarkus-bean-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-bean
            camel-quarkus-core-deployment,camel-quarkus-direct-deployment,camel-quarkus-core-xml-deployment -> camel-quarkus-integration-test-core-cdi
            camel-quarkus-core-deployment,camel-quarkus-core-cloud-deployment -> camel-quarkus-integration-test-core-impl
            camel-quarkus-core-deployment,camel-quarkus-csv-deployment,camel-quarkus-direct-deployment -> camel-quarkus-integration-test-csv
            camel-quarkus-core-deployment,camel-quarkus-infinispan-deployment,camel-quarkus-log-deployment,camel-quarkus-netty-http-deployment -> camel-quarkus-integration-test-infinispan
            camel-quarkus-core-deployment,camel-quarkus-jdbc-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-jdbc
            camel-quarkus-core-deployment,camel-quarkus-mail-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-mail
            camel-quarkus-core-deployment,camel-quarkus-microprofile-metrics-deployment,camel-quarkus-direct-deployment -> camel-quarkus-integration-test-microprofile-metrics
            camel-quarkus-core-deployment,camel-quarkus-netty-http-deployment,camel-quarkus-core-deployment -> camel-quarkus-integration-test-netty-http
            camel-quarkus-core-deployment,camel-quarkus-paho-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-paho
            camel-quarkus-core-deployment,camel-quarkus-salesforce-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-salesforce
            camel-quarkus-core-deployment,camel-quarkus-servlet-deployment,camel-quarkus-rest-deployment,camel-quarkus-core-cloud-deployment -> camel-quarkus-integration-test-servlet
            camel-quarkus-core-deployment,camel-quarkus-twitter-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-twitter
            camel-quarkus-core-deployment,camel-quarkus-zipfile-deployment,camel-quarkus-direct-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-zipfile
            camel-quarkus-core-deployment,camel-quarkus-controlbus-deployment,camel-quarkus-direct-deployment,camel-quarkus-timer-deployment,camel-quarkus-log-deployment -> camel-quarkus-integration-test-controlbus
            """
        ]]></mvnd.builder.rules.provider.script>

Be aware that the url form could cause problems with relative directories though...

ppalaga pushed a commit to ppalaga/mvnd that referenced this issue Jul 14, 2020
@ppalaga ppalaga added this to the Black hole milestone Jul 30, 2020
@gnodet gnodet added the wontfix This will not be worked on label Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants