<?xml version="1.0" encoding="UTF-8"?>
<!--

    See the NOTICE file distributed with this work for additional
    information regarding copyright ownership.

    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>edu.toronto.cs.savant</groupId>
    <artifactId>savant-distribution</artifactId>
    <version>2.0.4</version>
  </parent>

  <artifactId>savant-installer</artifactId>
  <packaging>pom</packaging>
  <name>Savant - Cross-platform Installer Distribution</name>
  <description>Distribution containing the Savant Genome Browser and its dependencies as a cross-platform installer.</description>

  <properties>
    <izpack.version>5.0.0-rc1</izpack.version>
    <izpack.staging>${project.build.directory}/staging</izpack.staging>
    <app.version>${project.version}</app.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>savant-zip</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
    </dependency>
    <dependency>
      <groupId>org.codehaus.izpack</groupId>
      <artifactId>izpack-compiler</artifactId>
      <version>${izpack.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <copy todir="${izpack.staging}">
                  <fileset dir="${basedir}/src/main/izpack" />
                </copy>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${izpack.staging}</outputDirectory>
              <excludeGroupIds>org.codehaus.izpack</excludeGroupIds>
              <excludeTransitive>true</excludeTransitive>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.izpack</groupId>
        <artifactId>izpack-maven-plugin</artifactId>
        <version>${izpack.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>izpack</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Use the Maven build-helper plugin to attach the generated installer to this project's main artifact -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
                  <type>jar</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
