<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
  ~
  ~ 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">

   <parent>
        <groupId>net.openhft</groupId>
        <artifactId>java-parent-pom</artifactId>
        <version>1.27ea1</version>
        <relativePath />
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>zero-allocation-hashing</artifactId>
    <version>0.27ea1</version>
    <name>Zero-allocation Hashing</name>
    <description>Zero-allocation implementations of fast non-cryptographic hash functions
        for byte sequences or blocks of memory</description>
    <inceptionYear>2014</inceptionYear>
    <url>https://github.com/OpenHFT/Zero-Allocation-Hashing</url>
    <packaging>bundle</packaging>

    <properties>
        <!-- specify the target Java SE release, at least 7 -->
        <project.target.release>8</project.target.release>

        <project.jdk.min-version>${project.target.release}</project.jdk.min-version>
        <project.maven.min-version>3.5.0</project.maven.min-version>

        <maven.compiler.source>${project.target.release}</maven.compiler.source>
        <maven.compiler.target>${project.target.release}</maven.compiler.target>

        <!-- bundle plugin requires JDK8 from 4.0.0, JDK15 requires 5.1.1 for issue FELIX-6259 -->
        <maven.bundle.plugin.version>5.1.1</maven.bundle.plugin.version>

        <doclint>all,-missing</doclint>
        <sonar.organization>openhft</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    </properties>

    <dependencies>
        <!-- annotation dependencies -->

        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>annotations</artifactId>
            <version>12.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
            <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
            <!-- JUnit 4 supports Java 7, but JUnit 5 don't. -->
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[${project.maven.min-version},)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>[${project.jdk.min-version},)</version>
                                </requireJavaVersion>
                                <requireProperty>
                                    <property>project.target.release</property>
                                    <message>Target Java SE release must be at least 7!</message>
                                    <regex>^([7-9]|[1-9]\d+)$</regex>
                                </requireProperty>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>
                        <!-- used for disable warning for target release 9+ -->
                        <arg>-XDignore.symbol.file</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>match-target-release</id>
                        <goals>
                            <goal>regex-properties</goal>
                        </goals>
                        <configuration>
                            <regexPropertySettings>
                                <regexPropertySetting>
                                    <!--
                                        ${stub.source.dir} = match ${project.target.release} {
                                            case [7,9) => java
                                            case [9,) => java-stub
                                        }
                                    -->
                                    <name>stub.source.dir</name>
                                    <value>java-${project.target.release}-java-stub</value>
                                    <regex>^java-[78]-|-(9|[1-9]\d+)-java-stub</regex>
                                </regexPropertySetting>
                                <regexPropertySetting>
                                    <!--
                                        ${maven.compiler.fork} = match ${project.target.release} {
                                            case [7,9) => false
                                            case [9,) => true
                                        }
                                    -->
                                    <name>maven.compiler.fork</name>
                                    <value>true-${project.target.release}-false</value>
                                    <regex>^true-[78]-|-(9|[1-9]\d+)-false$</regex>
                                </regexPropertySetting>
                            </regexPropertySettings>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-stub-source</id>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/${stub.source.dir}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <enableAssertions>true</enableAssertions>
                    <reuseForks>false</reuseForks>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>sun/**</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludePackageNames>java.*,sun.*</excludePackageNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

    
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.0.0-M4</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
			<version>1.11.2</version> <!-- this version should be sync with the scmVersion of maven-release-plugin -->
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <artifactId>maven-scm-publish-plugin</artifactId>
                <configuration>
                    <checkoutDirectory>${project.build.directory}/scmpublish/javadoc
                    </checkoutDirectory>
                    <checkinComment>Publishing javadoc for ${project.artifactId}:${project.version}
                    </checkinComment>
                    <content>${project.reporting.outputDirectory}</content>
                    <skipDeletedFiles>true</skipDeletedFiles>
                    <pubScmUrl>scm:git:git@github.com:OpenHFT/zero-allocation-hashing</pubScmUrl>
                    <scmBranch>gh-pages</scmBranch>
                </configuration>
            </plugin>

             <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${maven.bundle.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}
                        </Bundle-SymbolicName>
                        <Bundle-Name>OpenHFT :: ${project.artifactId}</Bundle-Name>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Export-Package>
                            net.openhft.hashing.*;-noimport:=true,
                            !java.*,
                            !sun.*
                        </Export-Package>
                        <Private-Package>!java.*,!sun.*</Private-Package>
                        <Import-Package>*</Import-Package>
                    </instructions>
                </configuration>
                <executions>
                    <!--
                      This execution makes sure that the manifest is available
                      when the tests are executed
                    -->
                    <execution>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <scm>
        <url>scm:git:git@github.com:OpenHFT/zero-allocation-hashing.git</url>
        <connection>scm:git:git@github.com:OpenHFT/zero-allocation-hashing.git</connection>
        <developerConnection>scm:git:git@github.com:OpenHFT/zero-allocation-hashing.git
        </developerConnection>
        <tag>zero-allocation-hashing-0.27ea1</tag>
    </scm>

    <profiles>
        <profile>
            <id>jdk7-profile</id>
            <activation>
                <jdk>[1.7,1.8)</jdk>
            </activation>
            <properties>
                <project.jdk.min-version>1.${project.target.release}</project.jdk.min-version>
                <maven.bundle.plugin.version>3.5.1</maven.bundle.plugin.version>
                <doclint />
            </properties>
        </profile>
        <profile>
            <id>jdk8-profile</id>
            <activation>
                <jdk>[1.8,1.9)</jdk>
            </activation>
            <properties>
                <project.jdk.min-version>1.${project.target.release}</project.jdk.min-version>
            </properties>
        </profile>
        <profile>
            <id>jdk9+-profile</id>
            <activation>
                <jdk>[9,21)</jdk>
            </activation>
            <properties>
                <maven.compiler.release>${project.target.release}</maven.compiler.release>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test-without-compact-string</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <argLine>-XX:-CompactStrings</argLine>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk21-profile</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <properties>
                <maven.compiler.release>8</maven.compiler.release>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <failOnWarning>false</failOnWarning>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test-without-compact-string</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <argLine>@{argLine} -XX:-CompactStrings ${jvm.requiredArgs}</argLine>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sonar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>3.8.0.2131</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.6</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>
