<?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</groupId>
        <artifactId>smallrye-graphql-common-parent</artifactId>
        <version>1.0.21</version>
    </parent>
    
    <artifactId>smallrye-graphql-schema-builder</artifactId>
    <name>SmallRye: GraphQL Common :: Schema Builder</name>
    <description>Creates the model from a Jandex index</description>
        
    <dependencies>
        
        <!-- The model -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>smallrye-graphql-schema-model</artifactId>
        </dependency>
        
        <!-- Jandex indexer -->
        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jandex</artifactId>
        </dependency>
        
        <!-- Logging -->
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <scope>provided</scope>
        </dependency>
        
        <!-- Test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse</groupId>
            <artifactId>yasson</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>smallrye-graphql-api</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <useFile>false</useFile>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        
        <!-- Run against the current released version -->
        <profile>
            <id>v1.0.x</id>
            <activation>
                <property>
                    <name>!version.eclipse.microprofile.graphql</name>
                </property>
            </activation>
            
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.1.2</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                    <excludes>**/tests/,**/dynamic/,**/*Test.class,**/beans.xml</excludes>
                    
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.eclipse.microprofile.graphql</groupId>
                                            <artifactId>microprofile-graphql-tck</artifactId>
                                            <type>jar</type>
                                        </artifactItem>        
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                        
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <!-- Run against the snapshot version -->
        <profile>
            <id>v1.1-SNAPSHOT</id>
            <activation>
                <property>
                    <name>version.eclipse.microprofile.graphql</name>
                    <value>1.1-SNAPSHOT</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>3.1.2</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                    <excludes>**/tests/,**/dynamic/,**/*Test.class,**/beans.xml</excludes>
                    
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.eclipse.microprofile.graphql</groupId>
                                            <artifactId>microprofile-graphql-server-tck</artifactId>
                                            <type>jar</type>
                                        </artifactItem>        
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                        
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        
        <profile>
            <id>coverage</id>
            <properties>
                <argLine>@{jacocoArgLine}</argLine>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>    
</project>
