<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Grakn - A Distributed Semantic Database
  ~ Copyright (C) 2016  Grakn Labs Limited
  ~
  ~ Grakn is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ Grakn 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 General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with Grakn. If not, see <http://www.gnu.org/licenses/gpl.txt>.
  -->

<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">
    <parent>
        <artifactId>grakn-test-profiles</artifactId>
        <relativePath>../grakn-test-profiles</relativePath>
        <groupId>ai.grakn</groupId>
        <version>0.14.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>grakn-dist</artifactId>

    <dependencies>
        <!--Logging dependencies: Compile scope needed to override parent test scope-->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>compile</scope>
        </dependency>
        <!--Jaino used for conditionals in log files-->
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
            <version>${janino.version}</version>
            <scope>compile</scope>
        </dependency>

        <!--Core dependencies-->
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>grakn-engine</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>grakn-graql-shell</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!--Migrations-->
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-sql</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-xml</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-csv</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-json</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-owl</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>migration-export</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Factories -->
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>titan-factory</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>javax.servlet</artifactId>
                </exclusion>
                <!--Excluded because we provide logback logger-->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-nop</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Cassandra uses airline for command line parsing -->
        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>airline</artifactId>
            <version>${airline.version}</version>

            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>copy-bin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <tarLongFileMode>gnu</tarLongFileMode>
                    <descriptors>
                        <descriptor>${project.basedir}/src/dist.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution><!-- Get redis and package into the distribution -->
                        <id>download-redis</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://github.com/burukuru/redis-prebuilt/archive/redis-3.2.9.tar.gz</url>
                            <unpack>true</unpack>
                            <outputDirectory>${main.basedir}/grakn-dist/target</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-shunit2</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://github.com/burukuru/shunit2/archive/master.zip</url>
                            <unpack>true</unpack>
                            <outputDirectory>${main.basedir}/grakn-dist/target/lib</outputDirectory>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <id>bash-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${skipTests}</skip>
                            <workingDirectory>${main.basedir}/grakn-dist/src/test/bash</workingDirectory>
                            <executable>${main.basedir}/grakn-dist/src/test/bash/bash-startup-test.sh</executable>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
