<?xml version="1.0"?>
<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>com.scytl.mixing</groupId>
		<artifactId>mixing</artifactId>
        <version>0.3.2</version>
    </parent>

    <artifactId>mixing-engine</artifactId>
    <name>Online Voting - Mixing - Engine</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <!-- internal project dependencies-->        
        <dependency>
            <groupId>com.scytl.mixing</groupId>
            <artifactId>mixing-verifier</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.scytl.mixing</groupId>
            <artifactId>mixing-mixer</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.scytl.cryptolib</groupId>
            <artifactId>cryptolib-proofs</artifactId>
        </dependency>

        <!-- other dependencies -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.jcsv</groupId>
            <artifactId>jcsv</artifactId>
        </dependency>
        <dependency>
            <groupId>com.scytl.math</groupId>
            <artifactId>scytl-math</artifactId>
            <scope>provided</scope>
        </dependency> 
        
        <!-- testing dependencies -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>RELEASE</version>
        </dependency>

    </dependencies>
    
    <profiles>
      <profile>
        <id>skipTestRun</id>
        <activation>
          <property>
            <name>skipTests</name>
            <value>!true</value>
          </property>
        </activation>
        <dependencies>
          <dependency>
		      <groupId>com.scytl.mixing</groupId>
		      <artifactId>mixing-commons</artifactId>
		      <version>${project.version}</version>
		      <type>test-jar</type>
		      <scope>test</scope>
		  </dependency>
        </dependencies>
      </profile>
    </profiles>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/version.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/version.txt</exclude>
                </excludes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                    <descriptors>
                        <descriptor>src/main/resources/distribution.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>create-archive</id>
                        <!-- this is used for inheritance merges -->
                        <phase>verify</phase>
                        <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble-standalone-windows</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                        <configuration>
                            <extraJvmArguments>-Djava.library.path=%USER_NATIVE_LIBRARIES_DIRECTORY%</extraJvmArguments>
                            <programs>
                                <program>
                                    <platforms>
                                        <platform>windows</platform>
                                    </platforms>
                                    <name>mixnet</name>
                                    <mainClass>com.scytl.products.ov.mixnet.Application</mainClass>
                                </program>
                            </programs>
                            <repositoryLayout>flat</repositoryLayout>
                            <repositoryName>lib</repositoryName>
                            <configurationDirectory>properties</configurationDirectory>
                            <binFileExtensions>
                                <unix>.sh</unix>
                            </binFileExtensions>
                            <copyConfigurationDirectory>true</copyConfigurationDirectory>
                            <configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>assemble-standalone-unix</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                        <configuration>
                            <extraJvmArguments>-Djava.library.path=$USER_NATIVE_LIBRARIES_DIRECTORY</extraJvmArguments>
                            <programs>
                                <program>
                                    <platforms>
                                        <platform>unix</platform>
                                    </platforms>
                                    <name>mixnet</name>
                                    <mainClass>com.scytl.products.ov.mixnet.Application</mainClass>
                                </program>
                            </programs>
                            <repositoryLayout>flat</repositoryLayout>
                            <repositoryName>lib</repositoryName>
                            <configurationDirectory>properties</configurationDirectory>
                            <binFileExtensions>
                                <unix>.sh</unix>
                            </binFileExtensions>
                            <copyConfigurationDirectory>true</copyConfigurationDirectory>
                            <configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-distribution</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/${project.artifactId}-${project.version}-distribution.zip</file>
                                    <type>zip</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
