<?xml version="1.0" encoding="UTF-8"?>
<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>io.github.pcmind</groupId>
        <artifactId>leveldb-project</artifactId>
        <version>0.12</version>
    </parent>

    <artifactId>leveldb</artifactId>
    <name>${project.artifactId}</name>
    <description>Port of LevelDB to Java</description>

    <properties>
        <air.main.basedir>${project.parent.basedir}</air.main.basedir>
        <shadeBase>org.iq80.leveldb.shaded</shadeBase>
        <air.test.jvmsize>2048m</air.test.jvmsize>
        <air.test.thread-count>1</air.test.thread-count>
    </properties>

    <dependencies>

        <dependency>
            <groupId>io.github.pcmind</groupId>
            <artifactId>leveldb-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.xerial.snappy</groupId>
            <artifactId>snappy-java</artifactId>
            <version>1.1.2.6 </version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.iq80.snappy</groupId>
            <artifactId>snappy</artifactId>
            <version>0.4</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- for testing -->
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- to verify file format compatibility with the native leveldb impl -->
        <dependency>
            <groupId>org.fusesource.leveldbjni</groupId>
            <artifactId>leveldbjni</artifactId>
            <version>1.1</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>org.iq80.leveldb</artifactId>
                    <groupId>leveldb-api</groupId>
                </exclusion>
            </exclusions>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <shadedArtifactAttached>true</shadedArtifactAttached>
                    <shadedClassifierName>uber</shadedClassifierName>
                    <relocations>
                        <relocation>
                            <pattern>com.google.common</pattern>
                            <shadedPattern>${shadeBase}.guava</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>com.google.thirdparty</pattern>
                            <shadedPattern>${shadeBase}.guava</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <properties>
                            <property>
                                <name>listener</name>
                                <value>org.testng.reporters.VerboseReporter</value>
                            </property>
                        </properties>
                        <systemPropertyVariables>
                            <sun.jnu.encoding>${project.build.sourceEncoding}</sun.jnu.encoding>
                            <user.timezone>${air.test.timezone}</user.timezone>
                            <java.awt.headless>true</java.awt.headless>
                            <java.util.logging.SimpleFormatter.format>%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %5$s%6$s%n</java.util.logging.SimpleFormatter.format>
                        </systemPropertyVariables>
                        <runOrder>random</runOrder>
                        <reuseForks>true</reuseForks>
                        <parallel>${air.test.parallel}</parallel>
                        <threadCount>${air.test.thread-count}</threadCount>
                        <argLine>
                            ${argLine}
                            -Dfile.encoding=${project.build.sourceEncoding}
                            -Xmx${air.test.jvmsize}
                            -Xms${air.test.jvmsize}
                            -XX:OnOutOfMemoryError="kill -9 %p"
                            -XX:+HeapDumpOnOutOfMemoryError
                        </argLine>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
