<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>
    <artifactId>lenskit</artifactId>
    <groupId>org.grouplens.lenskit</groupId>
    <version>2.0.5</version>
    <relativePath>..</relativePath>
  </parent>
  <artifactId>lenskit-package</artifactId>
  <name>LensKit Packaging</name>
  <packaging>jar</packaging>
  <description>
    Project to prepare LensKit binary distributions.
  </description>

  <properties>
    <jar.directory>${project.build.directory}/jars</jar.directory>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.grouplens.lenskit</groupId>
      <artifactId>lenskit-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.grouplens.lenskit</groupId>
      <artifactId>lenskit-eval</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.grouplens.lenskit</groupId>
      <artifactId>lenskit-knn</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.grouplens.lenskit</groupId>
      <artifactId>lenskit-svd</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.grouplens.lenskit</groupId>
      <artifactId>lenskit-slopeone</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.fusesource.jansi</groupId>
      <artifactId>jansi</artifactId>
      <version>1.8</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <scope>runtime</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.2</version>

        <configuration>
          <assembleDirectory>${project.build.directory}/dist/lenskit</assembleDirectory>
          <repositoryLayout>flat</repositoryLayout>
          <repositoryName>lib</repositoryName>
          <programs>
            <program>
              <mainClass>org.grouplens.lenskit.eval.cli.EvalCLI</mainClass>
              <name>lenskit-eval</name>
            </program>
          </programs>
        </configuration>

        <executions>
          <execution>
            <id>assemble</id>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>dist-package</id>
                <phase>package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <chmod perm="a+x">
                      <fileset dir="${project.build.directory}/dist/lenskit">
                        <include name="bin/*" />
                      </fileset>
                    </chmod>
                    <tar destfile="${project.build.directory}/lenskit-${project.version}.tar.gz" compression="gzip">
                      <tarfileset dir="${project.build.directory}/dist/lenskit" prefix="lenskit-${project.version}/" />
                    </tar>
                    <zip destfile="${project.build.directory}/lenskit-${project.version}.zip">
                      <zipfileset dir="${project.build.directory}/dist/lenskit" prefix="lenskit-${project.version}/" />
                    </zip>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
