<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2016, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<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>org.jboss.logging</groupId>
        <artifactId>jboss-logging-tools-parent</artifactId>
        <version>2.1.0.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>jboss-logging-processor</artifactId>
    <packaging>jar</packaging>

    <name>JBoss Logging I18n Annotation Processor</name>

    <properties>
        <test.report.path>${project.build.testOutputDirectory}</test.report.path>
        <expression.properties.path>${basedir}/src/test/resources/expression.properties</expression.properties.path>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.jdeparser</groupId>
            <artifactId>jdeparser</artifactId>
        </dependency>

        <!--
            Test
        -->
        <dependency>
            <groupId>org.jboss.logmanager</groupId>
            <artifactId>jboss-logmanager</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.forge.roaster</groupId>
            <artifactId>roaster-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.forge.roaster</groupId>
            <artifactId>roaster-jdt</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!--
                Disable Annotation processor
                on project compile
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <compilerArgument>-proc:none</compilerArgument>
                        </configuration>
                    </execution>
                    <!-- Define that asciidoc reports should be generated -->
                    <execution>
                        <id>test-compile-adoc</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <compilerArgs>
                                <arg>-Aorg.jboss.logging.tools.report.type=adoc</arg>
                                <arg>-Aorg.jboss.logging.tools.report.path=${test.report.path}</arg>
                                <arg>-Aorg.jboss.logging.tools.report.title=Test Title</arg>
                                <arg>-Aorg.jboss.logging.tools.expressionProperties=${expression.properties.path}</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                    <!-- Define that XML reports should be generated -->
                    <execution>
                        <id>test-compile-xml</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <compilerArgs>
                                <arg>-Aorg.jboss.logging.tools.report.type=xml</arg>
                                <arg>-Aorg.jboss.logging.tools.report.path=${test.report.path}</arg>
                                <arg>-Aorg.jboss.logging.tools.report.title=Test Title</arg>
                                <arg>-Aorg.jboss.logging.tools.expressionProperties=${expression.properties.path}</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <environmentVariables>
                        <JBOSS_LOGGING_TEST_VAR>envValue</JBOSS_LOGGING_TEST_VAR>
                    </environmentVariables>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <test.src.path>${project.build.testSourceDirectory}</test.src.path>
                        <test.generated.src.path>${project.build.directory}/generated-test-sources/test-annotations</test.generated.src.path>
                        <test.report.path>${test.report.path}</test.report.path>
                        <test.property>sysValue</test.property>
                        <expressionPropertiesPath>${expression.properties.path}</expressionPropertiesPath>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
