<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2012-2015 Institut National des Sciences Appliquées de Lyon (INSA-Lyon)
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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>

  <groupId>org.golo-lang</groupId>
  <artifactId>golo</artifactId>
  <version>2.1.0</version>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <packaging>jar</packaging>

  <name>Golo Programming Language</name>
  <description>Golo: a lightweight dynamic language for the JVM.</description>
  <url>http://golo-lang.org/</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:golo-lang/golo-lang.git</connection>
    <url>scm:git:git@github.com:golo-lang/golo-lang.git</url>
    <developerConnection>scm:git:git@github.com:golo-lang/golo-lang.git</developerConnection>
  </scm>

  <developers>
    <developer>
      <id>jponge</id>
      <name>Julien Ponge</name>
      <email>julien.ponge@insa-lyon.fr</email>
      <url>http://julien.ponge.org/</url>
      <organization>INSA-Lyon</organization>
    </developer>
  </developers>

  <contributors>
    <contributor>
      <name>David Festal</name>
      <email>david.festal@serli.com</email>
      <organization>Serli</organization>
    </contributor>
    <contributor>
      <name>Dan Allen</name>
      <email>dan.j.allen@gmail.com</email>
    </contributor>
    <contributor>
      <name>Daniel Petisme</name>
      <email>daniel.petisme@gmail.com</email>
    </contributor>
    <contributor>
      <name>Philippe Charrière</name>
      <email>ph.charriere@gmail.com</email>
    </contributor>
    <contributor>
      <name>Franck Verrot</name>
      <email>franck@verrot.fr</email>
    </contributor>
    <contributor>
      <name>Thierry Chantier</name>
      <email>titimoby@gmail.com</email>
    </contributor>
    <contributor>
      <name>Guillaume Grossetie</name>
      <email>ggrossetie@gmail.com</email>
    </contributor>
    <contributor>
      <name>Jeff Maury</name>
      <email>jeffmaury@jeffmaury.com</email>
    </contributor>
    <contributor>
      <name>Kel Cecil</name>
      <email>kelcecil@praisechaos.com</email>
    </contributor>
    <contributor>
      <name>Yannick Loiseau</name>
      <email>yannick.loiseau@univ-bpclermont.fr</email>
    </contributor>
    <contributor>
      <name>Sylvain Desgrais</name>
      <email>sylvain.desgrais@gmail.com</email>
    </contributor>
    <contributor>
      <name>Alexis Thomas</name>
      <email>fr.alexisthomas@gmail.com</email>
    </contributor>
    <contributor>
      <name>Romain Lespinasse</name>
      <email>romain.lespinasse@gmail.com</email>
    </contributor>
    <contributor>
      <name>Cedric Champeau</name>
      <email>cedric.champeau@gmail.com</email>
    </contributor>
    <contributor>
      <name>Kitsune Tsuyusato</name>
      <email>make.just.on@gmail.com</email>
    </contributor>
    <contributor>
      <name>Guillaume Soldera</name>
      <email>guillaume.soldera@gmail.com</email>
      <organization>Serli</organization>
    </contributor>
  </contributors>

  <organization>
    <name>Institut National des Sciences Appliquées de Lyon (INSA-Lyon)</name>
    <url>http://www.insa-lyon.fr/</url>
  </organization>

  <prerequisites>
    <maven>3.0</maven>
  </prerequisites>

  <properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <surefire.useFile>false</surefire.useFile>
    <maven.build.timestamp.format>yy-MM-dd-HH:mm</maven.build.timestamp.format>
    <build.timestamp>${maven.build.timestamp}</build.timestamp>
    <relocation.base>thirdparty</relocation.base>

    <asm.version>4.2</asm.version>
    <json-simple.version>1.1.1</json-simple.version>
    <jcommander.version>1.47</jcommander.version>
    <txtmark.version>0.11</txtmark.version>
    <hamcrest-all.version>1.3</hamcrest-all.version>
    <testng.version>6.8.21</testng.version>

    <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
    <maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
    <javacc-maven-plugin.version>2.6</javacc-maven-plugin.version>
    <maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
    <jacoco-maven-plugin.version>0.7.2.201409121644</jacoco-maven-plugin.version>
    <appassembler-maven-plugin.version>1.8.1</appassembler-maven-plugin.version>
    <animal-sniffer-maven-plugin.version>1.11</animal-sniffer-maven-plugin.version>
    <maven-jar-plugin.version>2.5</maven-jar-plugin.version>
    <maven-bundle-plugin.version>2.5.0</maven-bundle-plugin.version>
    <maven-javadoc-plugin.version>2.9.1</maven-javadoc-plugin.version>
    <surefire-testng.version>2.17</surefire-testng.version>
    <modernizer-maven-plugin.version>1.2.2</modernizer-maven-plugin.version>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <version>${asm.version}</version>
    </dependency>

    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>${json-simple.version}</version>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
      <version>${jcommander.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>com.github.rjeschke</groupId>
      <artifactId>txtmark</artifactId>
      <version>${txtmark.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-util</artifactId>
      <version>${asm.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-analysis</artifactId>
      <version>${asm.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>${hamcrest-all.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.skyscreamer</groupId>
      <artifactId>jsonassert</artifactId>
      <version>1.2.3</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>${testng.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>

  <build>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>${surefire-testng.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <runOrder>random</runOrder>
          <parallel>classes</parallel>
          <perCoreThreadCount>2</perCoreThreadCount>
          <forkedProcessTimeoutInSeconds>180</forkedProcessTimeoutInSeconds>
          <systemPropertyVariables>
            <golo.test.trace>no</golo.test.trace>
            <java.awt.headless>true</java.awt.headless>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>javacc-maven-plugin</artifactId>
        <version>${javacc-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>jjtree-javacc</id>
            <goals>
              <goal>jjtree-javacc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven-bundle-plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-RequiredExecutionEnvironment>JavaSE-1.7</Bundle-RequiredExecutionEnvironment>
          </instructions>
        </configuration>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>${appassembler-maven-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <repositoryName>lib</repositoryName>
          <repositoryLayout>flat</repositoryLayout>
          <licenseHeaderFile>${project.basedir}/LICENSE-header</licenseHeaderFile>
          <programs>
            <program>
              <id>golo</id>
              <mainClass>fr.insalyon.citi.golo.cli.Main</mainClass>
              <jvmSettings>
                <initialMemorySize>256m</initialMemorySize>
                <maxMemorySize>1024M</maxMemorySize>
                <maxStackSize>1024M</maxStackSize>
                <extraArguments>
                  <extraArgument>-server</extraArgument>
                  <extraArgument>-XX:-TieredCompilation</extraArgument>
                  <extraArgument>-XX:+AggressiveOpts</extraArgument>
                </extraArguments>
              </jvmSettings>
            </program>
            <program>
              <id>vanilla-golo</id>
              <mainClass>fr.insalyon.citi.golo.cli.Main</mainClass>
            </program>
          </programs>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${maven-assembly-plugin.version}</version>
        <configuration>
          <tarLongFileMode>gnu</tarLongFileMode>
          <attach>true</attach>
          <descriptors>
            <descriptor>src/main/assembly/distribution.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>assembly-with-package</id>
            <phase>package</phase>
            <goals>
              <goal>attached</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>${animal-sniffer-maven-plugin.version}</version>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java17</artifactId>
            <version>1.0</version>
          </signature>
          <ignores>
            <ignore>java.lang.invoke.MethodHandle</ignore>
          </ignores>
        </configuration>
        <executions>
          <execution>
            <id>check-jdk-signatures</id>
            <phase>test</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <configuration>
          <additionalparam>-Xdoclint:none</additionalparam>
          <failOnError>false</failOnError>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.gaul</groupId>
        <artifactId>modernizer-maven-plugin</artifactId>
        <version>${modernizer-maven-plugin.version}</version>
        <configuration>
          <javaVersion>1.7</javaVersion>
          <ignorePackages>
            <ignorePackage>fr.insalyon.citi.golo.compiler.parser</ignorePackage>
          </ignorePackages>
        </configuration>
        <executions>
          <execution>
            <id>modernizer</id>
            <phase>compile</phase>
            <goals>
              <goal>modernizer</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <profiles>

    <profile>
      <id>verbose-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <golo.test.trace>yes</golo.test.trace>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--
       This allows building Golo without building the .golo files.

       This is required in a clean-room environment, as the Maven plugin needs Golo... and Golo needs
       the plugin :-)
    -->
    <profile>
      <id>bootstrapped</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.golo-lang</groupId>
            <artifactId>golo-maven-plugin</artifactId>
            <version>${project.version}</version>
            <executions>
              <execution>
                <id>goloc</id>
                <phase>compile</phase>
                <goals>
                  <goal>goloc</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <environmentVariables>
                <golo.bootstrapped>yes</golo.bootstrapped>
              </environmentVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>test-coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco-maven-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <environmentVariables>
                <golo.bootstrapped>yes</golo.bootstrapped>
              </environmentVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
