<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-artemis-native</artifactId>
    <packaging>bundle</packaging>
    <version>1.0.2</version>

    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>18</version>
        <relativePath>org.apache:apache</relativePath>
    </parent>

    <name>ActiveMQ Artemis Native</name>
    <url />

    <prerequisites>
        <maven>3.1.0</maven>
    </prerequisites>

    <properties>
        <jboss.logging.version>3.3.1.Final</jboss.logging.version>
        <jb.logmanager.version>2.0.3.Final</jb.logmanager.version>

        <maven.assembly.plugin.version>2.4</maven.assembly.plugin.version>
        <version.org.jacoco>0.7.9</version.org.jacoco>
        <version.org.jacoco.plugin>0.7.9</version.org.jacoco.plugin>
        <version.maven.jar.plugin>2.4</version.maven.jar.plugin>

        <test.stress.time>5000</test.stress.time>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <activemq-surefire-argline>
            -Dtest.stress.time=${test.stress.time} -Djava.library.path="${activemq.basedir}/target/lib/linux-${os.arch}"
        </activemq-surefire-argline>
        <activemq.basedir>${project.basedir}</activemq.basedir>
        <skipLicenseCheck>true</skipLicenseCheck>
        <skipStyleCheck>true</skipStyleCheck>

        <javac-compiler-id>javac-with-errorprone</javac-compiler-id>

        <!-- Ignore failed tests by default because there are "known" failures in the full test-suite.
             This will be set to false for the "fast-tests" profile as none of those tests should fail. -->
        <testFailureIgnore>true</testFailureIgnore>
    </properties>

    <scm>
        <connection>scm:git:https://gitbox.apache.org/repos/asf/activemq-artemis-native.git</connection>
        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/activemq-artemis-native.git</developerConnection>
        <url>https://fisheye6.atlassian.com/browse/~br=master/activemq-artemis-git</url>
      <tag>1.0.2</tag>
  </scm>

    <distributionManagement>
        <site>
            <!-- this needs to match a server in your settings.xml with upload settings -->
            <id>activemq-website</id>
            <!-- set the staging.siteURL in your ~/.m2/settings.xml in a release or other profile -->
            <url>${staging.siteURL}/maven/${project.version}</url>
            <!--<url>${site-repo-url}</url>-->
        </site>
        <snapshotRepository>
            <id>apache.snapshots.https</id>
            <name>Apache Development Snapshot Repository</name>
            <url>https://repository.apache.org/content/repositories/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>

    <issueManagement>
        <system>JIRA</system>
        <url>https://issues.apache.org/jira/browse/ARTEMIS</url>
    </issueManagement>

    <dependencies>
        <!-- ## Test Dependencies ## Note: Junit is required in certain module tests.  We should control versions from here. -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
            <!-- License: CPL 1.0 -->
            <!-- There are newer versions of the JUnit but they break our tests -->
        </dependency>
       <dependency>
          <groupId>org.jacoco</groupId>
          <artifactId>org.jacoco.ant</artifactId>
          <version>${version.org.jacoco}</version>
          <scope>test</scope>
       </dependency>
       <dependency>
          <groupId>org.jacoco</groupId>
          <artifactId>org.jacoco.core</artifactId>
          <version>${version.org.jacoco}</version>
           <scope>test</scope>
       </dependency>
        <!-- ### Build Time Dependencies ### -->
        <!-- This is a build dependency of this project, but is not needed at compile or runtime by other
        projects that depend on this project. This should be in the compiler plugin but can't because of a bug,
        see https://issues.apache.org/jira/browse/MCOMPILER-203-->
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-processor</artifactId>
            <version>2.1.0.Final</version>
            <optional>true</optional>
            <!-- License: LGPL-->
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
            <version>2.1.0.Final</version>
            <scope>provided</scope>
            <optional>true</optional>
            <!-- License: Apache 2.0-->
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>${jboss.logging.version}</version>
            <!-- License: Apache 2.0 -->
        </dependency>
        <dependency>
            <groupId>org.jboss.logmanager</groupId>
            <artifactId>jboss-logmanager</artifactId>
            <version>${jb.logmanager.version}</version>
            <!-- License: Apache 2.0 -->
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>distro</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>bare-metal</id>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <groupId>org.codehaus.mojo</groupId>
                        <executions>
                            <execution>
                                <id>build</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>bash</executable>
                                    <commandlineArgs>./scripts/compile-native.sh</commandlineArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>docker</id>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <groupId>org.codehaus.mojo</groupId>
                        <executions>
                            <execution>
                                <id>build</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>bash</executable>
                                    <commandlineArgs>./scripts/compile-using-docker.sh</commandlineArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <skipStyleCheck>false</skipStyleCheck>
                <skipLicenseCheck>false</skipLicenseCheck>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>enforce-java</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <!-- we need java8 when building the release -->
                                        <requireJavaVersion>
                                            <version>1.8.0</version>
                                        </requireJavaVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.18.1</version>
                    <configuration>
                        <forkMode>once</forkMode>
                        <testFailureIgnore>${testFailureIgnore}</testFailureIgnore>
                        <runOrder>alphabetical</runOrder>
                        <redirectTestOutputToFile>false</redirectTestOutputToFile>
                        <argLine>${activemq-surefire-argline}</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <createChecksum>true</createChecksum>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <resources>
            <resource>
                <directory>${basedir}/target/output/</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <version>2.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.12</version>
                <configuration>
                    <reportFile>${activemq.basedir}/ratReport.txt</reportFile>
                    <skip>${skipLicenseCheck}</skip>
                    <excludes>
                        <exclude>.travis.yml</exclude>
                        <exclude>**/footer.html</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.md</exclude>
                        <exclude>etc/ide-settings/**</exclude>
                        <exclude>docs/**/*.json</exclude>
                        <exclude>docs/**/_book/</exclude>
                        <exclude>**/target/</exclude>
                        <exclude>**/META-INF/services/*</exclude>
                        <exclude>**/META-INF/MANIFEST.MF</exclude>
                        <exclude>**/*.iml</exclude>
                        <exclude>**/*.jceks</exclude>
                        <exclude>**/*.jks</exclude>
                        <exclude>**/xml.xsd</exclude>
                        <exclude>**/org/apache/activemq/artemis/utils/json/**</exclude>
                        <exclude>**/org/apache/activemq/artemis/utils/Base64.java</exclude>
                        <exclude>**/.settings/**</exclude>
                        <exclude>**/.project</exclude>
                        <exclude>**/.classpath</exclude>
                        <exclude>**/.editorconfig</exclude>
                        <exclude>**/.checkstyle</exclude>
                        <exclude>**/.factorypath</exclude>
                        <exclude>**/org.apache.activemq.artemis.cfg</exclude>
                        <exclude>**/nb-configuration.xml</exclude>
                        <!-- activemq5 unit tests exclude -->
                        <exclude>**/*.data</exclude>
                        <exclude>**/*.bin</exclude>
                        <exclude>**/src/test/resources/keystore</exclude>
                        <exclude>**/*.log</exclude>
                        <exclude>**/*.redo</exclude>

                        <!-- NPM files -->
                        <exclude>**/node/**</exclude>
                        <exclude>**/node_modules/**</exclude>
                        <exclude>**/package.json</exclude>
                        <exclude>**/npm-shrinkwrap.json</exclude>

                        <!-- Build time overlay folder -->
                        <exclude>**/overlays/**</exclude>

                        <!-- things from cmake on the native build -->
                        <exclude>**/CMakeFiles/</exclude>
                        <exclude>**/Makefile</exclude>
                        <exclude>**/cmake_install.cmake</exclude>
                        <exclude>artemis-libaio/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.h</exclude>
                        <exclude>**/dependency-reduced-pom.xml</exclude>

                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <!-- Adding Bundle-NativeCode to allow loading library from bundle. The asterisk at the end is important, so bundle resolves also without a matching library, e.g. on Windows. -->
                        <Bundle-NativeCode>lib/linux-i686/libartemis-native-32.so; osname=Linux; processor=x86, lib/linux-x86_64/libartemis-native-64.so; osname=Linux; processor=x86-64, *</Bundle-NativeCode>
                    </instructions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${version.maven.jar.plugin}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>artemis.jni</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources-i686</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/output/lib/linux-i686/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/lib/linux-i686</directory>
                                    <includes>
                                        <include>libartemis-native-32.so</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-x86_64</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/output/lib/linux-x86_64/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/lib/linux-amd64</directory>
                                    <includes>
                                        <include>libartemis-native-64.so</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-aarch64</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/output/lib/linux-aarch64/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/lib/linux-aarch64</directory>
                                    <includes>
                                        <include>libartemis-native-64.so</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-ppc64le</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/output/lib/linux-ppc64le/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/lib/linux-ppc64le</directory>
                                    <includes>
                                        <include>libartemis-native-64.so</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-s390x</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/output/lib/linux-s390x/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target/lib/linux-s390x</directory>
                                    <includes>
                                        <include>libartemis-native-64.so</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven.assembly.plugin.version}</version>
                <executions>
                    <execution>
                        <id>source</id>
                        <configuration>
                            <descriptor>src/main/assembly/source.xml</descriptor>
                            <tarLongFileMode>gnu</tarLongFileMode>
                        </configuration>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <check />
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <minmemory>128m</minmemory>
                    <maxmemory>1024m</maxmemory>
                    <quiet>false</quiet>
                    <!-- XXX FIXME 'aggregate' is deprecated -->
                    <aggregate>true</aggregate>
                    <excludePackageNames>com.restfully.*:org.jboss.resteasy.examples.*:org.jboss.resteasy.tests.*
                    </excludePackageNames>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.14.1</version>
            </plugin>

        </plugins>
    </reporting>

</project>
