jakartaee / validation-tck

Jakarta Validation TCK
http://validator.hibernate.org
Apache License 2.0
38 stars 33 forks source link

BVTCK-62 Investigate how signature files could be created as part of the build #87

Closed marko-bekhta closed 7 years ago

marko-bekhta commented 7 years ago

Adding sigtest maven plugin to generate signature files for BV API. Done based on this wiki

marko-bekhta commented 7 years ago

another option can be like this:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-sigtestdev</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>http://download.java.net/sigtest/3.0/PreRel/sigtest-3_0-dev-bin-b09-24_apr_2013.zip</url>
                            <unpack>true</unpack>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>java</executable>
                    <arguments>
                        <argument>-jar</argument>
                        <argument>${project.build.directory}/sigtest-3.0/lib/sigtestdev.jar</argument>
                        <argument>Setup</argument>
                        <argument>-Classpath</argument>
                        <argument>${env.JAVA_HOME}/jre/lib/rt.jar:${project.build.directory}/lib/validation-api-${validation.api.version}.jar</argument>
                        <argument>-Package</argument>
                        <argument>javax.validation</argument>
                        <argument>-filename</argument>
                        <argument>${project.build.directory}/validation-api-java8.sig</argument>
                    </arguments>
                    <successCodes>95</successCodes>
                </configuration>
            </plugin>
        </plugins>
    </build>

It downloads sigtest zip -> unpacks it -> runs java -jar sigtestdev.jar Setup

gunnarmorling commented 7 years ago

Hey @marko-bekhta, great initiative to tackle this task! Back when I checked no plug-in was available, but that seems to be the case now. Great find!

Some questions/remarks:

Thanks again, this one has been a sore point for a long time, glad to see it being addressed finally!

marko-bekhta commented 7 years ago

Why is it a separate module for the signature file now? The plug-in config could be added to the tests module, just as before.

Just was thinking that this signature is sort of separate artifact :) Moved configuration to tests module.

Comparing the generated sig file to the existing one, it seems to lack any signatures...

Yes. It turned out that all packages and sub-packages should be mentioned as a comma-separated list as packages configuration property. I've updated the config and now it seems to generated signatures for those sub-packages as well:

Selected by -Package: 120 classes
Written to sigfile: 91 classes(and 37 inner classes)

The TCK documentation should be updated, too;

Done. Didn't want to remove the old one for generating and testing with sigtest tool itself rather than via maven plugin. So ended up with creating two sections for maven-plugin test and previous sigtest documentation. :)

marko-bekhta commented 7 years ago

Hi @gunnarmorling, Ok no problem. I just didn't want to remove the previous documentation, as somebody spent their time on it :) and I thought that I'll just add new sections and keep the old ones as is.

I'll look at it again and clean it up a bit :)

gunnarmorling commented 7 years ago

Cool, thanks! On removing other's works, I understand your concern, but sometimes it's the way to go, if things have changed since then :)