<?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">
    <parent>
        <groupId>com.github.database-rider</groupId>
        <artifactId>rider-parent</artifactId>
        <version>1.9.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>rider-core</artifactId>
    <properties>
        <!-- must be overriden when releasing a new version with release profile -->
        <docs.outputdir>docs/latest</docs.outputdir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <exclusions>
            	<exclusion>
            		<groupId>postgresql</groupId>
            		<artifactId>postgresql</artifactId>
            	</exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-lgpl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.5.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
        <!-- bdd tests -->
        <!--tag::cucumber-deps[]-->
        <dependency> <!--1-->
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.4</version>
            <scope>test</scope>
        </dependency>
        <dependency> <!--1-->
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.4</version>
            <scope>test</scope>
        </dependency>
        <!--end::cucumber-deps[]-->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.6</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.2.28</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.192</version>
            <scope>test</scope>
        </dependency>

        <!-- postgresql tests -->

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <version>1.11.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.5</version>
            <scope>test</scope>
        </dependency>

        <!-- msql server tests -->
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mssqlserver</artifactId>
            <version>1.11.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.1.0.jre8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>1.11.3</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <parallel>classes</parallel>
                    <useUnlimitedThreads>true</useUnlimitedThreads>
                    <reuseForks>false</reuseForks>
                    <includes>
                        <include>**/*It.java</include>
                        <include>**/*Test.java</include>
                        <include>**/*Bdd.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>docs</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.cukedoctor</groupId>
                        <artifactId>cukedoctor-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <configuration>
                            <outputFileName>documentation</outputFileName>
                            <!-- by default it resolves to 'latest' and is overriden by release profile -->
                            <outputDir>${docs.outputdir}</outputDir>
                            <!--pdf and html5 -->
                            <format>all</format>
                            <documentTitle>Database Rider Documentation</documentTitle>
                            <hideSummarySection>true</hideSummarySection>
                            <hideScenarioKeyword>true</hideScenarioKeyword>
                            <hideStepTime>true</hideStepTime>
                            <hideFeaturesSection>true</hideFeaturesSection>
                            <hideTags>true</hideTags>
                            <sourceHighlighter>coderay</sourceHighlighter>
                            <toc>center</toc>
                            <numbered>true</numbered>
                            <docVersion>${project.version}</docVersion>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-scm-publish-plugin</artifactId>
                        <version>1.1</version>
                        <configuration>
                            <checkoutDirectory>${project.build.outputDirectory}</checkoutDirectory>
                            <checkinComment>Publishing Database Rider ${project.parent.version} living documentation.
                            </checkinComment>
                            <content>target/docs</content>
                            <skipDeletedFiles>true</skipDeletedFiles>
                            <pubScmUrl>scm:git:https://${USER}:${PASS}@github.com/database-rider/database-rider.git
                            </pubScmUrl>
                            <scmBranch>gh-pages</scmBranch>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>perf</id>
            <dependencies>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-core</artifactId>
                    <version>1.11.3</version>
                </dependency>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-generator-annprocess</artifactId>
                    <version>1.11.3</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>1.7.21</version>
                </dependency>
            </dependencies>
            <build>
                <resources>
                    <resource>
                        <directory>src/perf/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                    <resource>
                        <directory>src/perf/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <compilerVersion>1.7</compilerVersion>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath />
                                <argument>com.github.database.rider.RiderDataSetBenchmark</argument>
                                <commandlineArgs>-Xms512m</commandlineArgs>
                                <commandlineArgs>-Xmx512m</commandlineArgs>
                                <commandlineArgs>-XX:+PrintGCTimeStamps</commandlineArgs>
                                <commandlineArgs>-XX:+PrintGCDetails</commandlineArgs>
                                <commandlineArgs>-XX:+HeapDumpOnOutOfMemoryError</commandlineArgs>
                            </arguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/perf/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <docs.outputdir>docs/${project.version}</docs.outputdir>
            </properties>
        </profile>
    </profiles>

</project>
