<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.smallrye.reactive</groupId>
        <artifactId>smallrye-mutiny-vertx-bindings-projects</artifactId>
        <version>3.21.5</version>
    </parent>

    <artifactId>vertx-mutiny-generator</artifactId>
    <name>SmallRye Mutiny - Code Generator</name>

    <properties>
        <lang>java</lang>
        <!-- There is an issue with source plugin because we don't get the generated sources
             because of BSC plugin, also the source is messy because we keep a version of vert.x core
             so better use the assembly plugin instead -->
        <source.skip>true</source.skip>
        <format.skip>true</format.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.smallrye.reactive</groupId>
            <artifactId>smallrye-mutiny-vertx-runtime</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-codegen</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.common</groupId>
            <artifactId>smallrye-common-annotation</artifactId>
        </dependency>

        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-codegen</artifactId>
            <classifier>tck-sources</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-core</artifactId>
            <classifier>sources</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-core</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Configure the execution of the compiler to execute the codegen processor -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <executions>
                    <execution>
                        <id>compile-tck</id>
                        <phase>process-test-sources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <release>17</release>
                            <annotationProcessors>
                                <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                            </annotationProcessors>
                            <compilerArgs>
                                <arg>-Acodegen.output=${project.basedir}/src/tck/java</arg>
                                <arg>-Acodegen.generators=mutiny</arg>
                            </compilerArgs>
                            <testIncludes>${project.basedir}/src/tck/java/**/*</testIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/tck/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <!-- Unpack codegen source code to src/test/java -->
                    <execution>
                        <id>unpack-codegen</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>io.vertx</includeGroupIds>
                            <includeArtifactIds>vertx-codegen</includeArtifactIds>
                            <includeTypes>jar</includeTypes>
                            <includeClassifiers>tck-sources</includeClassifiers>
                            <outputDirectory>src/tck/java</outputDirectory>
                            <excludes>**/META-INF*</excludes>
                        </configuration>
                    </execution>
                    <!-- Unpack codegen source code to src/test/java -->
                    <execution>
                        <id>unpack-core</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>io.vertx</includeGroupIds>
                            <includeArtifactIds>vertx-core</includeArtifactIds>
                            <includeTypes>jar</includeTypes>
                            <includeClassifiers>sources</includeClassifiers>
                            <outputDirectory>src/tck/java</outputDirectory>
                            <includes>io/vertx/core/streams/*.java</includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>io.smallrye.mutiny.vertx.codegen.generatorv4</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
</project>
