<?xml version="1.0"?>
<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">
    <parent>
        <groupId>io.debezium</groupId>
        <artifactId>debezium-parent</artifactId>
        <version>3.0.8.Final-redhat-00004</version>
        <relativePath>../debezium-parent/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>debezium-ddl-parser</artifactId>
    <name>Debezium ANTLR DDL parsers</name>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-core</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <properties>
        <antlr.source.directory>${project.basedir}/src/main/antlr4</antlr.source.directory>
        <docker.skip>false</docker.skip>
        <antlr.tests.enabled>true</antlr.tests.enabled>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>${version.antlr}</version>
                <configuration>
                    <sourceDirectory>${antlr.source.directory}</sourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>qa</id>
            <activation>
                <property>
                    <name>!quick</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <!-- https://github.com/antlr/antlr4test-maven-plugin -->
                        <groupId>com.khubla.antlr</groupId>
                        <artifactId>antlr4test-maven-plugin</artifactId>
                        <version>${version.antlr4test.plugin}</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.antlr</groupId>
                                <artifactId>antlr4-runtime</artifactId>
                                <version>${version.antlr}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>MySql</id>
                                <configuration>
                                    <verbose>false</verbose>
                                    <showTree>false</showTree>
                                    <entryPoint>root</entryPoint>
                                    <grammarName>MySql</grammarName>
                                    <packageName>io.debezium.ddl.parser.mysql.generated</packageName>
                                    <caseInsensitiveType>UPPER</caseInsensitiveType>
                                    <exampleFiles>src/test/resources/mysql/examples</exampleFiles>
                                    <enabled>${antlr.tests.enabled}</enabled>
                                </configuration>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>MariaDB</id>
                                <configuration>
                                    <verbose>false</verbose>
                                    <showTree>false</showTree>
                                    <entryPoint>root</entryPoint>
                                    <grammarName>MariaDB</grammarName>
                                    <packageName>io.debezium.ddl.parser.mariadb.generated</packageName>
                                    <caseInsensitiveType>UPPER</caseInsensitiveType>
                                    <exampleFiles>src/test/resources/mariadb/examples</exampleFiles>
                                    <enabled>${antlr.tests.enabled}</enabled>
                                </configuration>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>Oracle</id>
                                <configuration>
                                    <verbose>false</verbose>
                                    <showTree>false</showTree>
                                    <entryPoint>sql_script</entryPoint>
                                    <grammarName>PlSql</grammarName>
                                    <packageName>io.debezium.ddl.parser.oracle.generated</packageName>
                                    <caseInsensitiveType>UPPER</caseInsensitiveType>
                                    <exampleFiles>src/test/resources/oracle/examples</exampleFiles>
                                    <enabled>${antlr.tests.enabled}</enabled>
                                </configuration>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>skip-tests</id>
            <activation>
                <property>
                    <name>skipTests</name>
                </property>
            </activation>
            <properties>
                <antlr.tests.enabled>false</antlr.tests.enabled>
            </properties>
        </profile>
    </profiles>
</project>
