<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2016-2025 chronicle.software; SPDX-License-Identifier: Apache-2.0

-->
<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.27ea1</version>
        <relativePath />
    </parent>

    <artifactId>chronicle-bytes</artifactId>
    <version>2.27ea9</version>
    <name>OpenHFT/Chronicle Bytes</name>
    <description>Chronicle-Bytes</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>
        <!-- Define the target coverage thresholds as properties -->
        <jacoco.line.coverage>0.8</jacoco.line.coverage>
        <jacoco.branch.coverage>0.7</jacoco.branch.coverage>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>net.openhft</groupId>
                <artifactId>third-party-bom</artifactId>
                <version>3.27ea2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>net.openhft</groupId>
                <artifactId>chronicle-bom</artifactId>
                <version>2.27ea87</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>
            <groupId>net.openhft</groupId>
            <artifactId>posix</artifactId>
        </dependency>

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

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

        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
        </dependency>

        <!-- test dependencies -->

        <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>net.openhft</groupId>
            <artifactId>affinity</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>jlbh</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>chronicle-test-framework</artifactId>
            <scope>test</scope>
        </dependency>

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

    <repositories>
        <repository>
            <id>chronicle-enterprise-snapshots</id>
            <name>Snapshot Repository</name>
            <url>
                https://nexus.chronicle.software/content/repositories/snapshots
            </url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>chronicle-enterprise-release</id>
            <url>
                https://nexus.chronicle.software/content/repositories/releases
            </url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

    <build>
        <plugins>
            <!-- SortPom moved to an opt-in profile to avoid automatic sorting during normal builds -->
            <plugin>
                <groupId>net.openhft</groupId>
                <artifactId>binary-compatibility-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>enforcer</goal>
                        </goals>
                        <configuration>
                            <referenceVersion>2.27ea0</referenceVersion>
                            <artifactsURI>https://teamcity.chronicle.software/repository/download</artifactsURI>
                            <binaryCompatibilityPercentageRequired>100</binaryCompatibilityPercentageRequired>
                            <extraOptions>
                                <!--This skips "internal" but checks "impl"-->
                                <extraOption>
                                    <name>-keep-internal</name>
                                </extraOption>
                                <extraOption>
                                    <name>skip-internal-packages</name>
                                    <value>.*internal.*</value>
                                </extraOption>
                            </extraOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>

                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <useReleaseProfile>false</useReleaseProfile>
                </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}</content>
                    <skipDeletedFiles>true</skipDeletedFiles>
                    <pubScmUrl>scm:git:git@github.com:OpenHFT/Chronicle-Bytes</pubScmUrl>
                    <scmBranch>gh-pages</scmBranch>
                </configuration>
            </plugin>

            <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>
                            <Automatic-Module-Name>chronicle.bytes</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.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Include JaCoCo argLine when present and required JPMS flags from parent -->
                    <argLine>${argLine} ${jvm.requiredArgs}</argLine>
                    <forkCount>4</forkCount>
                    <reuseForks>true</reuseForks>
                    <runOrder>hourly</runOrder>
                </configuration>
            </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>
                        <Export-Package>
                            net.openhft.chronicle.bytes.*;-noimport:=true
                        </Export-Package>
                        <Import-Package>
                            org.xerial.snappy;resolution:=optional,
                            *
                        </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>

            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>4.1</version>

                <configuration>
                    <!-- One-line header; no newlines -->
                    <inlineHeader>Copyright 2016-2025 chronicle.software; SPDX-License-Identifier: Apache-2.0</inlineHeader>
                    <excludes>
                        <exclude>LICENSE</exclude>
                        <exclude>**/*.adoc</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>docs/antora/**</exclude>
                        <exclude>src/main/config/**</exclude>
                        <exclude>src/main/docs/**</exclude>
                        <exclude>src/main/resources/**</exclude>
                        <exclude>src/test/resources/**</exclude>
                        <exclude>target/**</exclude>
                        <exclude>**/*.versionsBackup</exclude>
                    </excludes>
                </configuration>

                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- benchmark MMap latency with Byte -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>

                <executions>
                    <!-- PingPong test - run this first -->
                    <execution>
                        <id>MMapPing</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <mainClass>net.openhft.chronicle.bytes.perf.MMapPingPongMain</mainClass>
                            <classpathScope>test</classpathScope>
                        </configuration>
                    </execution>
                    <!-- PingPong test - run this second -->
                    <execution>
                        <id>MMapPong</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <mainClass>net.openhft.chronicle.bytes.perf.MMapPingPongMain</mainClass>
                            <classpathScope>test</classpathScope>
                            <systemProperties>
                                <property>
                                    <key>pong</key>
                                    <value>true</value>
                                </property>
                            </systemProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <scm>
        <url>scm:git:git@github.com:OpenHFT/Chronicle-Bytes.git</url>
        <connection>scm:git:git@github.com:OpenHFT/Chronicle-Bytes.git</connection>
        <developerConnection>scm:git:git@github.com:OpenHFT/Chronicle-Bytes.git
        </developerConnection>
        <tag>chronicle-bytes-2.27ea9</tag>
    </scm>

    <profiles>
        <profile>
            <id>assertions</id>
            <properties>
                <zero.cost.assertions>enabled</zero.cost.assertions>
            </properties>
        </profile>
        <profile>
            <id>sonar</id>
            <!-- If you keep thresholds as properties, define them here
                 (or in the parent) so they resolve during this profile) -->
            <properties>
                <jacoco.line.coverage>0.7</jacoco.line.coverage>
                <jacoco.branch.coverage>0.6</jacoco.branch.coverage>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefireArgLine} ${jvm.requiredArgs} -Djvm.coverage=true</argLine>
                            <forkCount>1</forkCount>
                            <reuseForks>false</reuseForks>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.14</version>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <propertyName>surefireArgLine</propertyName>
                                    <excludes>
                                        <!-- Low-level reflection/unsafe helpers where behaviour is JVM/architecture gated -->
                                        <exclude>net/openhft/chronicle/bytes/internal/ByteBuffers*</exclude>
                                        <exclude>net/openhft/chronicle/bytes/internal/UnsafeText*</exclude>
                                    </excludes>
                                </configuration>
                            </execution>

                            <execution>
                                <id>report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>

                            <execution>
                                <id>check</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <phase>verify</phase>
                                <configuration>
                                    <rules>
                                        <rule>
                                            <element>BUNDLE</element>
                                            <limits>
                                                <limit>
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${jacoco.line.coverage}</minimum>
                                                </limit>
                                                <limit>
                                                    <counter>BRANCH</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${jacoco.branch.coverage}</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-benchmarks</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <configuration>
                            <pom>microbenchmarks/pom.xml</pom>
                            <goals>clean,integration-test</goals>
                            <profiles>
                                <profile>run-benchmarks</profile>
                            </profiles>
                            <properties>
                                <bytes.version>${project.version}</bytes.version>
                                <skip.binary>true</skip.binary>
                            </properties>
                            <streamLogs>true</streamLogs>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>test</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>

                        <configuration>
                            <classpathScope>test</classpathScope>
                        </configuration>
                        <executions>
                            <execution>
                                <id>NativeBytesArrayReadWriteJLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.NativeBytesReadWriteJLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>OnHeapBytesArrayReadWriteJLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.OnHeapBytesReadWriteJLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>ChunkedMappedBytesArrayReadWriteJLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.ChunkedMappedBytesReadWriteJLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>SingleMappedBytesArrayReadWriteJLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.SingleMappedBytesReadWriteJLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>ContentEqual2JLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.ContentEqual2JLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>ContentEqual20JLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.ContentEqual20JLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>ContentEqual128JLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.ContentEqual128JLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>ContentEqual8192JLBH</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${java.home}/bin/java</executable>
                                    <commandlineArgs>${jvm.requiredArgs} -Djvm.resource.tracing=false -classpath
                                        %classpath net.openhft.chronicle.bytes.perf.ContentEqual8192JLBH
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <!-- Disable unit tests -->
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
