<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>

    <name>hazelcast-code-generator</name>
    <artifactId>hazelcast-code-generator</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.hazelcast</groupId>
        <artifactId>hazelcast-client-protocol-root</artifactId>
        <version>1.5.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <!-- needed for checkstyle/findbugs -->
        <main.basedir>${project.parent.basedir}</main.basedir>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration combine.self="override">
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <runOrder>failedfirst</runOrder>

                    <!-- 1C means 1 process per cpu core -->
                    <!-- forkCount>1C</forkCount>
                    <reuseForks>true</reuseForks>

                    <threadCount>1</threadCount>
                    <perCoreThreadCount>true</perCoreThreadCount>
                    <parallel>methods</parallel -->

                    <!-- the argLine variable is needed for JaCoco-->
                    <argLine>
                        -Xms128m -Xmx1G -XX:MaxPermSize=128M
                        -Dhazelcast.phone.home.enabled=false
                        -Dhazelcast.mancenter.enabled=false
                        -Dhazelcast.logging.type=none
                        -Dhazelcast.test.use.network=false
                    </argLine>
                    <includes>
                        <include>**/**.java</include>
                    </includes>
                    <excludes>
                        <exclude>**/jsr/**.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!--
            This profile is needed to override configuration from the root pom.xml.
            Otherwise a build of hazelcast-code-generation module is failing as the Surefire Maven plugin
            cannot load com.hazelcast.test.annotation.ParallelTest classes
            -->
            <id>parallelTest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven.surefire.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>singlejvm</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration combine.self="override">
                                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                                    <argLine>
                                        -Xms128m -Xmx1G -XX:MaxPermSize=128M
                                        -Dhazelcast.phone.home.enabled=false
                                        -Dhazelcast.mancenter.enabled=false
                                        -Dhazelcast.logging.type=none
                                        -Dhazelcast.test.use.network=false
                                    </argLine>
                                    <includes>
                                        <include>**/**.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jdk-9</id>
            <activation>
                <jdk>1.9</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven.surefire.plugin.version}</version>
                        <configuration combine.self="override">
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                            <argLine>
                                -Xms128m -Xmx1G
                                -Dhazelcast.phone.home.enabled=false
                                -Dhazelcast.mancenter.enabled=false
                                -Dhazelcast.test.use.network=false
                            </argLine>
                            <includes>
                                <include>**/**.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.23</version>
        </dependency>
    </dependencies>
</project>
