questdb/rust-maven-plugin

Add `cargo test` support.

amunra opened this issue · 3 comments

Add `cargo test` support.

..or maybe we should support cargo-nextest instead which provides JUnit XML output?

It would be nice to tie the cargo test to the test maven phase.

I'm relatively new to writing maven plugins, but it looks like it would be trivial to add a test mojo that extends the existing CargoBuildMojo (or some other composition/inheritance relationship).

I don't see a way to make a single mojo behave differently in different build phases, so you may be stuck with the relatively verbose double execution:

 <plugin>
    <groupId>io.questdb</groupId>
    <artifactId>rust-maven-plugin</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <executions>
        <execution>
            <id>build-myrust</id>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
        <execution>
             <id>test-myrust</id>
             <goals>
                 <goal>test</goal>
             </goals>
        </execution>
    </executions>
    <configuration>
        <path>src/main/rust/myrust</path>
        <release>true</release>
        <copyTo>${project.build.directory}/bin</copyTo>
    </configuration>
</plugin>

Yeah, I think that's the approach. 😊