<?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">
    <groupId>com.gliwka.hyperscan</groupId>
    <artifactId>native</artifactId>
    <version>5.4.11-2.0.0</version>
    <name>hyperscan-java-native</name>
    <description>Native libraries for hyperscan java bindings</description>
    <url>https://github.com/gliwka/hyperscan-java-native</url>
    <licenses>
        <license>
            <name>3-Clause BSD License</name>
            <url>https://opensource.org/licenses/BSD-3-Clause</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Matthias Gliwka</name>
            <email>matthias@gliwka.eu</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/gliwka/hyperscan-java-native.git</connection>
        <developerConnection>scm:git:ssh://github.com/gliwka/hyperscan-java-native.git</developerConnection>
        <url>https://github.com/gliwka/hyperscan-java-native</url>
    </scm>
    <modelVersion>4.0.0</modelVersion>
    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <javacpp.version>1.5.9</javacpp.version>
    </properties>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
    <profiles>
        <profile>
            <id>staging</id>
            <activation>
                <property>
                    <name>env.STAGING</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <serverId>ossrh</serverId>
                            <stagingProfileId>487fa319ba2685</stagingProfileId>
                            <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
                            <stagingRepositoryId>${env.STAGING_REPO}</stagingRepositoryId>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.7.1</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <argLine>-Djava.library.path=${project.build.directory}/native/com/gliwka/hyperscan/jni/${env.DETECTED_PLATFORM}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                    </execution>
                    <execution>
                        <id>javacpp-parser</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>com/gliwka/hyperscan/jni/JavaCppPreset.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.bytedeco</groupId>
                <artifactId>javacpp</artifactId>
                <version>${javacpp.version}</version>
                <configuration>
                    <classPath>${project.build.outputDirectory}</classPath>
                    <includePath>${project.build.directory}/../cppbuild/include/</includePath>
                    <linkPath>${project.build.directory}/../cppbuild/lib/</linkPath>
                </configuration>
                <executions>
                    <execution>
                        <id>javacpp-parser</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                            <classOrPackageName>com.gliwka.hyperscan.jni.JavaCppPreset</classOrPackageName>
                            <copyLibs>true</copyLibs>
                            <copyResources>true</copyResources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>javacpp-compiler</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                          <outputDirectory>${project.build.directory}/native/com/gliwka/hyperscan/jni/${env.DETECTED_PLATFORM}/</outputDirectory>
                            <classOrPackageName>com.gliwka.hyperscan.jni.**</classOrPackageName>
                            <copyLibs>true</copyLibs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-patch-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <patches>
                        <patch>allocator.patch</patch>
                    </patches>
                    <targetDirectory>${project.build.directory}/generated-sources</targetDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>patch</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>native-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                          <classifier>${env.DETECTED_PLATFORM}</classifier>
                            <skipIfEmpty>true</skipIfEmpty>
                            <archive>
                                <manifestEntries>
                                    <Multi-Release>true</Multi-Release>
                                </manifestEntries>
                            </archive>
                            <classesDirectory>${project.build.directory}/native</classesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <show>public</show>
                    <nohelp>true</nohelp>
                    <header>hyperscan-java-native, ${project.version}</header>
                    <footer>hyperscan-java-native, ${project.version}</footer>
                    <doctitle>hyperscan-java-native, ${project.version}</doctitle>
                    <doclint>none</doclint>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.simplify4u.plugins</groupId>
                <artifactId>sign-maven-plugin</artifactId>
                <version>1.0.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacpp</artifactId>
            <version>${javacpp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacpp-platform</artifactId>
            <version>${javacpp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.10.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.24.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
