<?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">
    <parent>
        <artifactId>embedded-crowd-platform-components</artifactId>
        <groupId>com.atlassian.crowd</groupId>
        <version>8.0.0-platform-01</version>
        <relativePath>../embedded-crowd-platform-components/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>crowd-query-language</artifactId>

    <name>Atlassian Crowd Query Language</name>
    <description>
        Provides a parser to convert Crowd Query Language (CQL) into SearchRestrictions for use with Crowd's Search API
    </description>

    <dependencies>
        <!-- Crowd Module dependencies -->
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-integration-api</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>${antlr4-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>src/grammar</sourceDirectory>
                            <visitor>true</visitor>
                            <listener>false</listener>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>add-antlr-generated-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/antlr4</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <excludes>**/CqlParser.java,**/CqlLexer.java,**/CqlBaseVisitor.java,**/CqlVisitor.java</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!--
                        javadoc:jar runs the generate-sources phase in a forked, cloned project, so the ANTLR
                        output directory that build-helper adds as a source root there is not visible to this
                        execution. Both source roots are therefore listed explicitly, otherwise Javadoc cannot
                        resolve the generated parser classes when the goal is invoked from the command line,
                        as the release build does.
                    -->
                    <sourcepath>${project.basedir}/src/main/java${path.separator}${project.build.directory}/generated-sources/antlr4</sourcepath>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
