<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.googlecode.playn</groupId>
  <artifactId>playn-project</artifactId>
  <packaging>pom</packaging>
  <version>1.0.1</version>
  <name>PlayN Project</name>
  <url>http://code.google.com/p/playn</url>
  <description>Cross platform game library for N≥4 platforms.</description>

  <issueManagement>
    <system>Google Code</system>
    <url>http://code.google.com/p/playn/issues/list</url>
  </issueManagement>

  <scm>
    <connection>scm:git:https://code.google.com/p/playn/</connection>
    <developerConnection>scm:git:https://code.google.com/p/playn/</developerConnection>
    <url>http://code.google.com/p/playn/</url>
  </scm>

  <modules>
    <module>archetype</module>
    <module>core</module>
    <module>gwtbox2d</module>
    <module>webgl</module>
    <module>java</module>
    <module>html</module>
    <module>flash</module>
    <module>android</module>
    <module>server</module>
    <module>payments</module>
    <module>test</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <android.version>2.3.3</android.version>
    <android.maven.version>3.0.0-alpha-13</android.maven.version>
    <gwt.version>2.4.0</gwt.version>
    <gwt.loglevel>INFO</gwt.loglevel>
    <gwt.outputstyle>PRETTY</gwt.outputstyle>
    <gwt.modulesuffix />
    <gwt.inplace>false</gwt.inplace>
    <gwt.soyc>false</gwt.soyc>
    <gwt.xdisable>true</gwt.xdisable>
    <gwt.draft>false</gwt.draft>
    <gwt.workers />
    <maven.test.skip>false</maven.test.skip>
  </properties>

  <repositories>
    <!-- TEMP: obtain some artifacts from legacy forplay maven repository -->
    <repository>
      <id>forplay-legacy</id>
      <url>http://forplay.googlecode.com/svn/mavenrepo</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>codehaus.snapshots</id>
      <url>http://snapshots.repository.codehaus.org/</url>
    </pluginRepository>
  </pluginRepositories>

  <!-- Common dependencies for all modules -->
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <!-- Common plugin configuration for all children -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <version>2.4.0</version>
          <configuration>
            <logLevel>${gwt.loglevel}</logLevel>
            <style>${gwt.outputstyle}</style>
            <runTarget>${gwt.module}${gwt.modulesuffix}/index.html</runTarget>
            <hostedWebapp>${project.build.directory}/www</hostedWebapp>
            <draftCompile>${gwt.draft}</draftCompile>
            <disableCastChecking>${gwt.xdisable}</disableCastChecking>
            <disableClassMetadata>${gwt.xdisable}</disableClassMetadata>
            <disableRunAsync>true</disableRunAsync>
            <soyc>${gwt.soyc}</soyc>
            <localWorkers>${gwt.workers}</localWorkers>
            <extraJvmArgs>-Xmx256m</extraJvmArgs>
            <modules>
              <module>${gwt.module}</module>
            </modules>
            <inplace>${gwt.inplace}</inplace>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.google.gwt</groupId>
              <artifactId>gwt-user</artifactId>
              <version>${gwt.version}</version>
            </dependency>
            <dependency>
              <groupId>com.google.gwt</groupId>
              <artifactId>gwt-dev</artifactId>
              <version>${gwt.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <phase>prepare-package</phase>
              <goals>
                <goal>compile</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.4.1</version>
          <configuration>
            <filesets>
              <fileset><directory>src/main/webapp/${gwt.module}</directory></fileset>
              <fileset><directory>src/main/webapp/${gwt.module}Dev</directory></fileset>
              <fileset><directory>src/main/webapp/${gwt.name}</directory></fileset>
              <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
              <fileset><directory>tomcat</directory></fileset>
              <fileset><directory>www-test</directory></fileset>
              <fileset><directory>.gwt-tmp</directory></fileset>
            </filesets>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.1.2</version>
        </plugin>

	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>

        <!-- this shuts m2eclipse up about the maven-antrun plugin -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <versionRange>[1.3,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[2.0,)</versionRange>
                    <goals>
                      <goal>unpack</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>
                      com.jayway.maven.plugins.android.generation2
                    </groupId>
                    <artifactId>
                      android-maven-plugin
                    </artifactId>
                    <versionRange>
                      [3.0.0-alpha-13,)
                    </versionRange>
                    <goals>
                      <goal>generate-sources</goal>
                      <goal>unpack</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <versionRange>[1.0,)</versionRange>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>prod</id>
      <properties>
        <gwt.version>2.3.0</gwt.version>
        <gwt.loglevel>ERROR</gwt.loglevel>
        <gwt.outputstyle>OBF</gwt.outputstyle>
        <gwt.xdisable>true</gwt.xdisable>
        <gwt.soyc>true</gwt.soyc>
      </properties>
    </profile>

    <profile>
      <id>tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
       </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.6</version>
          <scope>system</scope>
          <optional>true</optional>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>

    <!-- allows testing of HTML backend via: mvn test -Ptest-html -->
    <profile>
      <id>test-html</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.0.0.v20110901</version>
            <configuration>
              <webApp>
                ${project.basedir}/html/target/${project.artifactId}-html-${project.version}
              </webApp>
            </configuration>
            <executions>
              <execution>
                <id>test-html</id>
                <phase>test</phase>
                <goals>
                  <goal>run-exploded</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- allows testing of Flash backend via: mvn test -Ptest-flash -->
    <profile>
      <id>test-flash</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.0.0.v20110901</version>
            <configuration>
              <webApp>
                ${project.basedir}/flash/target/${project.artifactId}-flash-${project.version}
              </webApp>
            </configuration>
            <executions>
              <execution>
                <id>test-flash</id>
                <phase>test</phase>
                <goals>
                  <goal>run-exploded</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>