<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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.gwt.circuit</groupId>
        <artifactId>circuit-samples-parent</artifactId>
        <version>0.0.7</version>
    </parent>

    <artifactId>circuit-todo-sample</artifactId>
    <name>circuit :: Samples :: Todo</name>
    <description>
        GWT based circuit sample of a todo manager. Uses the DAG dispatcher and the meta annotations.
    </description>
    <packaging>war</packaging>

    <properties>
        <webAppDirectory>${project.build.directory}/${project.build.finalName}</webAppDirectory>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jboss.gwt.circuit</groupId>
            <artifactId>circuit-meta</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.gwt.circuit</groupId>
            <artifactId>circuit-processor</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.errai</groupId>
            <artifactId>errai-cdi-client</artifactId>
            <!-- The bundled dependency to Guava 13.0.1 does not compile with GWT 2.6.1 -->
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava-gwt</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava-gwt</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

    </dependencies>

    <build>
        <outputDirectory>${webAppDirectory}/WEB-INF/classes</outputDirectory>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <!-- Enable refresh for GWT development mode -->
                                <source>${basedir}/../../core/src/main/java</source>
                                <source>${basedir}/../../core/src/main/resources</source>
                                <source>${basedir}/../../meta/src/main/java</source>
                                <source>${basedir}/../../meta/src/main/resources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-generated-sources</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/generated-sources/annotations</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- The next plugins work together to enable APT support -->
            <plugin>
                <groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <defaultOutputDirectory>${project.build.directory}/generated-sources/annotations</defaultOutputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgument>-proc:none</compilerArgument>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceLevel>1.7</sourceLevel>
                    <localWorkers>4</localWorkers>
                    <runTarget>index.html</runTarget>
                    <hostedWebapp>${webAppDirectory}</hostedWebapp>
                    <compileSourcesArtifacts>
                        <artifact>org.jgrapht:jgrapht-core</artifact>
                        <artifact>org.jboss.gwt.circuit:circuit-core</artifact>
                        <artifact>org.jboss.gwt.circuit:circuit-meta</artifact>
                    </compileSourcesArtifacts>
                    <extraJvmArgs>-Xmx1g -Xms756m -XX:CompileThreshold=1000 -Dlog4j.ignoreTCL=true</extraJvmArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>exploded</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <webappDirectory>${webAppDirectory}</webappDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
