<?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>net.openhft</groupId>
        <artifactId>java-parent-pom</artifactId>
        <version>1.26.0</version>
        <relativePath />
    </parent>

    <artifactId>chronicle-map</artifactId>

    <version>3.26ea4</version>
    <name>OpenHFT/Chronicle-Map</name>
    <description>Chronicle-Map</description>
    <packaging>bundle</packaging>
    <properties>
        <zero.cost.assertions>disabled</zero.cost.assertions>
        <sonar.organization>openhft</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>net.openhft</groupId>
                <artifactId>third-party-bom</artifactId>
                <version>3.26.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>net.openhft</groupId>
                <artifactId>chronicle-bom</artifactId>
                <version>2.26ea37</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>assertions-${zero.cost.assertions}</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <!-- note using org.jetbrains jar breaks the build -->
            <groupId>com.intellij</groupId>
            <artifactId>annotations</artifactId>
            <version>12.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>affinity</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-core</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-bytes</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>posix</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-values</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.java</groupId>
                    <artifactId>tools</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-threads</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-wire</artifactId>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-algorithms</artifactId>
        </dependency>

        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
        </dependency>

        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
        </dependency>

        <!-- optional dependencies -->

        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-aether</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-test-framework</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>jlbh</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava-testlib</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>zero-allocation-hashing</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.samskivert</groupId>
            <artifactId>samskivert</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.skyscreamer</groupId>
            <artifactId>jsonassert</artifactId>
            <scope>test</scope>
        </dependency>
<!--
        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>stage-compiler</artifactId>
            <version>1.11</version>
            <scope>provided</scope>
        </dependency>-->
    </dependencies>

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

        <plugins>
            <plugin>
                <groupId>net.openhft</groupId>
                <artifactId>binary-compatibility-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>enforcer</goal>
                        </goals>
                        <configuration>
                            <referenceVersion>3.26ea0</referenceVersion>
                            <artifactsURI>https://teamcity.chronicle.software/repository/download</artifactsURI>
                            <binaryCompatibilityPercentageRequired>100.0</binaryCompatibilityPercentageRequired>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <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}/3.1.x</content>
                    <skipDeletedFiles>true</skipDeletedFiles>
                    <pubScmUrl>scm:git:git@github.com:OpenHFT/Chronicle-Map</pubScmUrl>
                    <scmBranch>gh-pages</scmBranch>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <tags>
                        <tag>
                            <name>apiNote</name>
                            <placement>tcm</placement>
                            <head>API Note:</head>
                        </tag>
                        <tag>
                            <name>implSpec</name>
                            <placement>tcm</placement>
                            <head>Implementation Requirements:</head>
                        </tag>
                        <tag>
                            <name>implNote</name>
                            <placement>tcm</placement>
                            <head>Implementation Note:</head>
                        </tag>
                    </tags>
                    <excludePackageNames>
                        net.openhft.chronicle.hash.serialization.impl:net.openhft.chronicle.hash.impl:net.openhft.chronicle.map.impl:**.replication
                    </excludePackageNames>
                    <sourceFileExcludes>
                        <exclude>net/openhft/chronicle/hash/ChronicleHashBuilderPrivateAPI.java</exclude>
                        <exclude>net/openhft/chronicle/hash/VanillaGlobalMutableState.java</exclude>
                        <exclude>net/openhft/chronicle/hash/ReplicatedHashSegmentContext.java</exclude>
                        <exclude>net/openhft/chronicle/hash/VanillaGlobalMutableState*Native.java</exclude>
                        <exclude>net/openhft/chronicle/map/MapDiagnostics.java</exclude>
                        <exclude>net/openhft/chronicle/map/VanillaChronicleMap.java</exclude>
                        <exclude>net/openhft/chronicle/map/Replica.java</exclude>
                        <exclude>net/openhft/chronicle/map/ReplicatedChronicleMap.java</exclude>
                        <exclude>net/openhft/chronicle/map/ReplicatedGlobalMutableState*Native.java</exclude>
                        <exclude>net/openhft/chronicle/map/ChronicleHashCorruptionImpl.java</exclude>
                        <exclude>net/openhft/chronicle/set/DummyValueData.java</exclude>
                        <exclude>**/Compiled*.java</exclude>
                    </sourceFileExcludes>
                    <failOnError>false</failOnError>
                    <additionalOptions>-Xdoclint:none</additionalOptions>
                </configuration>
            </plugin>

            <!-- used to allow getClass().getPackage().getImplementationVersion() -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<!--                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>-->
                        </manifest>
                        <manifestEntries>
                            <X-Compile-Source-JDK>${maven.compiler.release}</X-Compile-Source-JDK>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <!--  See https://openjdk.java.net/jeps/261#Breaking-encapsulation-->
                            <!--Unfortunately, only works for the main jar which this is not likely to be-->
                            <Add-Opens>java.base/java.lang.reflect=ALL-UNNAMED</Add-Opens>
                            <Add-Exports>java.base/jdk.internal.ref=ALL-UNNAMED java.base/sun.nio.ch=ALL-UNNAMED</Add-Exports>
                            <Automatic-Module-Name>chronicle.map</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>

            </plugin>
            <!--
                generate maven dependencies versions file that can be used later
                to install the right bundle in test phase.

                The file is:

                    target/classes/META-INF/maven/dependencies.properties
            -->
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>depends-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-depends-file</id>
                        <goals>
                            <goal>generate-depends-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <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>
                        <Import-Package>
                            org.jetbrains.annotations;resolution:=optional,
                            *
                        </Import-Package>
                        <Export-Package>
                            net.openhft.chronicle.map.*,
                            net.openhft.chronicle.set.*,
                            net.openhft.chronicle.hash.*
                        </Export-Package>
                        <Add-Opens>java.base/java.lang.reflect=ALL-UNNAMED</Add-Opens>
                        <Add-Exports>java.base/jdk.internal.ref=ALL-UNNAMED java.base/sun.nio.ch=ALL-UNNAMED</Add-Exports>
                        <Automatic-Module-Name>chronicle.map</Automatic-Module-Name>
                        <Implementation-Title>${project.name}</Implementation-Title>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
                        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                        <Implementation-URL>${project.url}</Implementation-URL>
                        <Specification-Title>${project.name}</Specification-Title>
                        <Specification-Version>${project.version}</Specification-Version>
                        <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                    </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>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>MapFileAnalyzer</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>net.openhft.chronicle.map.MapFileAnalyzer</mainClass>
                            <classpathScope>compile</classpathScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!--mvn versions:display-dependency-updates-->
                <!--mvn versions:display-plugin-updates-->
                <!--https://www.mojohaus.org/versions-maven-plugin/-->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.14.2</version>
                <configuration>
                    <generateBackupPoms>false</generateBackupPoms>
                </configuration>
            </plugin>

        </plugins>
    </build>
    <profiles>
        <profile>
            <id>assertions</id>
            <properties>
                <zero.cost.assertions>enabled</zero.cost.assertions>
            </properties>
        </profile>
        <profile>
            <id>pre-java9</id>
            <dependencies>
                <dependency>
                    <groupId>com.sun</groupId>
                    <artifactId>tools</artifactId>
                    <version>${java.version}</version>
                    <scope>system</scope>
                    <systemPath>${java.home}/../lib/tools.jar</systemPath>
                </dependency>
            </dependencies>
            <activation>
                <file>
                    <exists>${java.home}/../lib/tools.jar</exists>
                </file>
            </activation>
        </profile>
        <profile>
            <id>sonar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <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>
        <profile>
            <!-- Note that CompiledXXXX.java files have been pre-compiled and added to src/main/java/net/openhft/chronicle/map/impl/ -->
            <id>enable_code_generation</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <compilerArgument>-Xlint:deprecation</compilerArgument>
                            <source>1.8</source>
                            <target>1.8</target>
                            <encoding>UTF-8</encoding>
                            <useIncrementalCompilation>false</useIncrementalCompilation>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <url>scm:git:git@github.com:OpenHFT/Chronicle-Map.git</url>
        <connection>scm:git:git@github.com:OpenHFT/Chronicle-Map.git</connection>
        <developerConnection>scm:git:git@github.com:OpenHFT/Chronicle-Map.git</developerConnection>
        <tag>chronicle-map-3.26ea4</tag>
    </scm>

</project>
