<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.bytedeco</groupId>
  <artifactId>javacpp</artifactId>
  <version>1.5.9</version>

  <name>JavaCPP</name>
  <description>The missing bridge between Java and native C++</description>
  <url>http://bytedeco.org/javacpp/</url>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>GNU General Public License (GPL) version 2, or any later version</name>
      <url>http://www.gnu.org/licenses/</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>GPLv2 with Classpath exception</name>
      <url>http://www.gnu.org/software/classpath/license.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Samuel Audet</name>
      <email>samuel.audet@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/bytedeco/javacpp</url>
    <connection>scm:git:git://github.com/bytedeco/javacpp.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/bytedeco/javacpp.git</developerConnection>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Sonatype Nexus Staging</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.build.timestamp.format>yyyyMMddhhmm</maven.build.timestamp.format>
    <maven.version>3.0</maven.version>
    <bnd.version>5.3.0</bnd.version>
    <javacpp.platform.root></javacpp.platform.root>
    <javacpp.platform.suffix></javacpp.platform.suffix>
    <javacpp.platform.compiler></javacpp.platform.compiler>
    <javacpp.platform.extension></javacpp.platform.extension>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.36</version>
      <optional>true</optional>
    </dependency>
    <!--
      The OSGi R7 Annotations are build time only and not
      needed at runtime, therefore they can be provided scope
    -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.annotation</artifactId>
      <version>7.0.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.6.2</version>
        <configuration>
          <packagingTypes>
            <packagingType>jar</packagingType>
          </packagingTypes>
        </configuration>
        <executions>
          <execution>
            <id>default-descriptor</id>
            <phase>process-classes</phase>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <systemProperties>
            <property>
              <name>org.bytedeco.javacpp.maxbytes</name>
              <value>1gb</value>
            </property>
            <property>
              <name>org.bytedeco.javacpp.maxretries</name>
              <value>3</value>
            </property>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <id>nopointergc</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <systemProperties>
                <property>
                  <name>org.bytedeco.javacpp.nopointergc</name>
                  <value>true</value>
                </property>
              </systemProperties>
              <test>PointerTest#testDeallocator*</test>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <archive>
            <!-- Pull in the bnd generated manifest -->
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            <manifest>
              <mainClass>org.bytedeco.javacpp.tools.Builder</mainClass>
            </manifest>
            <manifestEntries>
              <Implementation-Title>${project.name}</Implementation-Title>
              <Implementation-Vendor>Bytedeco</Implementation-Vendor>
              <Implementation-Version>${project.version}</Implementation-Version>
              <Specification-Title>${project.name}</Specification-Title>
              <Specification-Vendor>Bytedeco</Specification-Vendor>
              <Specification-Version>${project.version}</Specification-Version>
              <Multi-Release>true</Multi-Release>
            </manifestEntries>
          </archive>
          <excludes>
            <exclude>lib/</exclude> <!-- for Android -->
            <exclude>${javacpp.platform.library.path}/</exclude>
            <exclude>${javacpp.platform}${javacpp.platform.extension}/</exclude>
            <exclude>org/bytedeco/javacpp/${javacpp.platform}${javacpp.platform.extension}/</exclude>
            <exclude>META-INF/native-image/</exclude>
            <exclude>META-INF/MANIFEST.MF-*</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.moditect</groupId>
        <artifactId>moditect-maven-plugin</artifactId>
        <version>1.0.0.RC2</version>
        <configuration>
          <jvmVersion>9</jvmVersion>
          <overwriteExistingFiles>true</overwriteExistingFiles>
          <outputDirectory>${project.build.directory}</outputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>add-module-infos</id>
            <phase>package</phase>
            <goals>
              <goal>add-module-info</goal>
            </goals>
            <configuration>
              <modules>
                <module>
                  <file>${project.build.directory}/${project.artifactId}.jar</file>
                  <moduleInfoFile>${project.basedir}/src/main/java9/module-info.java</moduleInfoFile>
                </module>
              </modules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>3.0.0-M1</version>
        <configuration>
          <createChecksum>true</createChecksum>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <attach>false</attach>
          <descriptors>
            <descriptor>src/main/assembly/bin.xml</descriptor>
            <descriptor>src/main/assembly/src.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.2.1</version>
        <executions>
          <execution>
            <id>attach-source</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <links>
                <link>http://maven.apache.org/ref/${maven.version}/maven-plugin-api/apidocs</link>
                <link>http://maven.apache.org/plugin-tools/maven-plugin-annotations/apidocs</link>
                <link>http://maven.apache.org/ref/${maven.version}/maven-core/apidocs</link>
                <link>http://www.slf4j.org/apidocs</link>
                <link>http://junit.org/junit4/javadoc/4.13.2</link>
              </links>
              <show>private</show>
              <tagletArtifacts>
                <tagletArtifact>
                  <groupId>org.apache.maven.plugin-tools</groupId>
                  <artifactId>maven-plugin-tools-javadoc</artifactId>
                  <version>3.5.2</version>
                </tagletArtifact>
              </tagletArtifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.8</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>sonatype-nexus-staging</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
        </configuration>
      </plugin>
      <!--
        Process the OSGi annotations and generate a suitable
        MANIFEST.MF file for this bundle. This will be merged
        with the entries from the maven-jar-plugin
      -->
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <version>${bnd.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>bnd-process</goal>
            </goals>
            <configuration>
              <bnd><![CDATA[
# Avoid pulling in any imports for Maven packages.
# Their usage is isolated to two types which are
# excluded from export. If this changes in future
# then this Import restriction will no longer be safe
#
# Also mark sun.misc as an optional import. If it is
# unavailable then the indexers will fall back to
# other implementations.

Bundle-SymbolicName: org.bytedeco.javacpp
Import-Package: \
 !org.apache.maven.*,\
 sun.misc;resolution:=optional,\
 *
          ]]></bnd>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-baseline-maven-plugin</artifactId>
        <version>${bnd.version}</version>
        <configuration>
          <!-- Skip by default until support for the exclude attribute of org.osgi.annotation.bundle.Export gets added -->
          <skip>true</skip>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>baseline</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <doclint>none</doclint>
              <failOnError>false</failOnError>
              <source>8</source>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <passphrase>${env.GPG_PASSPHRASE}</passphrase>
              <useAgent>false</useAgent>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Builds native library (and runs integration test for OSGi) only when javacpp.platform is set explicitly -->
    <profile>
      <id>javacpp-platform</id>
      <activation>
        <property>
          <name>javacpp.platform</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <phase>process-classes</phase>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>org.bytedeco.javacpp.tools.Builder</mainClass>
              <arguments>
                <argument>-classpath</argument>
                <argument>${project.build.outputDirectory}</argument>
                <argument>-copylibs</argument>
                <argument>-configdir</argument>
                <argument>${project.build.outputDirectory}/META-INF/native-image/${javacpp.platform}${javacpp.platform.extension}/</argument>
                <argument>-properties</argument>
                <argument>${javacpp.platform}${javacpp.platform.suffix}</argument>
                <argument>-Dplatform.root=${javacpp.platform.root}</argument>
                <argument>-Dplatform.compiler=${javacpp.platform.compiler}</argument>
                <argument>org.bytedeco.javacpp.Pointer</argument>
                <argument>org.bytedeco.javacpp.presets.javacpp</argument>
                <argument>-mod</argument>
                <argument>${project.build.directory}/generated-sources/java9/module-info.java</argument>
              </arguments>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>javacpp-${javacpp.platform}</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <archive>
                    <!-- Pull in the bnd generated manifest -->
                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF-${javacpp.platform}</manifestFile>
                  </archive>
                  <skipIfEmpty>true</skipIfEmpty>
                  <classifier>${javacpp.platform}</classifier>
                  <includes>
                    <include>lib/</include> <!-- for Android -->
                    <include>${javacpp.platform.library.path}/</include>
                    <include>${javacpp.platform}${javacpp.platform.extension}/</include>
                    <include>org/bytedeco/javacpp/${javacpp.platform}${javacpp.platform.extension}/</include>
                    <include>META-INF/native-image/${javacpp.platform}${javacpp.platform.extension}/</include>
                  </includes>
                  <excludes>
                    <exclude>org/bytedeco/javacpp/windows-*/*.exp</exclude>
                    <exclude>org/bytedeco/javacpp/windows-*/*.lib</exclude>
                    <exclude>org/bytedeco/javacpp/windows-*/*.obj</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-module-info-${javacpp.platform}</id>
                <phase>package</phase>
                <goals>
                  <goal>add-module-info</goal>
                </goals>
                <configuration>
                  <modules>
                    <module>
                      <file>${project.build.directory}/${project.artifactId}-${javacpp.platform}.jar</file>
                      <moduleInfoFile>${project.build.directory}/generated-sources/java9/module-info.java</moduleInfoFile>
                    </module>
                  </modules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>bnd-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>bnd-process-${javacpp.platform}</id>
                <goals>
                  <goal>bnd-process</goal>
                </goals>
                <configuration>
                  <manifestPath>${project.build.outputDirectory}/META-INF/MANIFEST.MF-${javacpp.platform}</manifestPath>
                  <bnd><![CDATA[
# Avoid pulling in any imports for Maven packages.
# Their usage is isolated to two types which are
# excluded from export. If this changes in future
# then this Import restriction will no longer be safe
#
# Also mark sun.misc as an optional import. If it is
# unavailable then the indexers will fall back to
# other implementations.

Bundle-SymbolicName: org.bytedeco.javacpp.${javacpp.platform}
Fragment-Host: org.bytedeco.javacpp
Import-Package: \
 !org.apache.maven.*,\
 sun.misc;resolution:=optional,\
 *
              ]]></bnd>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>3.2.2</version>
              <configuration>
                <cloneProjectsTo>${project.build.directory}/integration-test/projects</cloneProjectsTo>
                <cloneClean>true</cloneClean>
                <projectsDirectory>src/it/</projectsDirectory>
                <streamLogs>true</streamLogs>
                <!-- With a clean <localRepositoryPath/>, it needs to redownload everything on each run!
                <localRepositoryPath>${project.build.directory}/integration-test/repo</localRepositoryPath> -->
                <properties>
                  <!-- <org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener>warn</org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener> -->
                  <maven.compiler.source>1.7</maven.compiler.source>
                  <maven.compiler.target>1.7</maven.compiler.target>
                </properties>
                <goals>
                  <goal>verify</goal>
                </goals>
              </configuration>
              <executions>
                <execution>
                  <id>integration-test</id>
                  <goals>
                    <goal>install</goal>
                    <goal>run</goal>
                  </goals>
                </execution>
              </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- *********************************** -->
    <!-- * Eclipse: m2e lifecycle bindings * -->
    <!-- *********************************** -->
    <profile>
      <id>m2e</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings
                only. It has no influence on the Maven build itself. -->
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <!-- *********************************************** -->
                    <!-- The Maven Dev Connector for Eclipse m2e is no   -->
                    <!-- longer maintained. We copy the relevant part    -->
                    <!-- of the lifecycle mapping for the                -->
                    <!-- maven-plugin-plugin here.                       -->
                    <!--                                                 -->
                    <!-- See https://github.com/ifedorenko/com.ifedorenko.m2e.mavendev/blob/master/com.ifedorenko.m2e.mavendev/lifecycle-mapping-metadata.xml -->
                    <!-- *********************************************** -->
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-plugin-plugin</artifactId>
                        <versionRange>[3.5.2,)</versionRange>
                        <goals>
                          <goal>descriptor</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <execute>
                          <runOnIncremental>false</runOnIncremental>
                        </execute>
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-plugin-plugin</artifactId>
                        <versionRange>[3.5.2,)</versionRange>
                        <goals>
                          <goal>helpmojo</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

</project>
