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

    Copyright (c) 2016-2022 chronicle.software

        https://chronicle.software

    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>

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

    <artifactId>chronicle-bytes</artifactId>
    <version>2.23.30</version>
    <name>OpenHFT/Chronicle-Bytes</name>
    <description>Chronicle-Bytes</description>
    <packaging>bundle</packaging>

    <properties>
        <zero.cost.assertions>disabled</zero.cost.assertions>
        <compiler.argument>-Xlint:deprecation</compiler.argument>
        <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.22.3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>net.openhft</groupId>
                <artifactId>chronicle-bom</artifactId>
                <version>2.23.122</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>
    </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>

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

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <source>8</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <forkCount>4</forkCount>
                    <reuseForks>true</reuseForks>
                    <runOrder>hourly</runOrder>
                </configuration>
            </plugin>

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

                <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>
                <version>3.1.0</version>
                <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>

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

            <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>
                    <!--                    <verbose>true</verbose>-->
                </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>
                <version>1.4.0</version>
                <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>
                <version>5.1.2</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.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>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <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>

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

                <configuration>
                    <header>license_header.txt</header>
                    <properties>
                        <currentYear>2022</currentYear>
                    </properties>
                    <headerDefinitions>
                        <headerDefinition>license_header_def.xml</headerDefinition>
                    </headerDefinitions>
                    <excludes>
                        <exclude>**/README</exclude>
                        <exclude>**/README.md</exclude>
                        <exclude>**/package-info.java</exclude>
                        <exclude>**/*.versionsBackup</exclude>
                        <exclude>CONTRIBUTOR_LICENSE_AGREEMENT</exclude>
                        <exclude>LICENSE</exclude>
                        <exclude>DISCLAIMER</exclude>
                        <exclude>THIRD_PARTY_LICENSES</exclude>
                        <exclude>src/test/resources/**</exclude>
                        <exclude>src/main/resources/**</exclude>
                    </excludes>
                </configuration>

                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </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.23.30</tag>
    </scm>

    <profiles>
        <profile>
            <id>assertions</id>
            <properties>
                <zero.cost.assertions>enabled</zero.cost.assertions>
            </properties>
        </profile>
        <profile>
            <id>sonar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <!--<exclude>META-INF/**</exclude>-->
                                <exclude>*.jar</exclude>
                                <!--                                <exclude>net/openhft/chronicle/bytes/AbstractBytes.class</exclude>
                                                                <exclude>net/openhft/chronicle/bytes/AppendableUtil.class</exclude>
                                                                <exclude>net/openhft/chronicle/bytes/BinaryBytesMethodWriterInvocationHandler.class</exclude>
                                                                <exclude>net/openhft/chronicle/bytes/BinaryWireCode.class</exclude>
                                                                <exclude>net/openhft/chronicle/bytes/*.class</exclude>-->
                            </excludes>
                        </configuration>
                        <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>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-benchmarks</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>3.2.2</version>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <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>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
