<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2011-2014 The original author or authors
  ~
  ~  All rights reserved. This program and the accompanying materials
  ~  are made available under the terms of the Eclipse Public License v1.0
  ~  and Apache License v2.0 which accompanies this distribution.
  ~
  ~      The Eclipse Public License is available at
  ~      http://www.eclipse.org/legal/epl-v10.html
  ~
  ~      The Apache License v2.0 is available at
  ~      http://www.opensource.org/licenses/apache2.0.php
  ~
  ~  You may elect to redistribute this code under either of these licenses.
  --><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>io.vertx</groupId>
    <artifactId>vertx-ext-parent</artifactId>
    <version>34</version>
  </parent>

  <artifactId>vertx-unit</artifactId>
  <version>3.8.5</version>

  <name>Vert.x Unit</name>

  <properties>
    <stack.version>3.8.5</stack.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${stack.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
    </dependency>

    <!-- Not needed at runtime unless you use the JUnit extension -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>

    <plugins>
      <!-- Copy resources after compilation phase as we generate JS in src/main/resources -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>default-resources</id>
            <phase>process-classes</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <vertx.test.timeout>60</vertx.test.timeout>
            <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <version>3.2.0</version>

        <executions>
          <execution>
            <id>default-bnd-process</id>
            <goals>
              <goal>bnd-process</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <bnd><![CDATA[
          Import-Package: \
            groovy.lang.*;resolution:=optional,\
            org.codehaus.groovy.*;resolution:=optional,\
            io.vertx.groovy.*;resolution:=optional,\
            kotlin.*;resolution:=optional,\
            io.vertx.ext.auth.*;resolution:=optional,\
            io.vertx.lang.rxjava.*;resolution:=optional,\
            io.vertx.lang.groovy.*;resolution:=optional,\
            io.vertx.codegen.annotations;resolution:=optional,\
            io.vertx.rx.java;resolution:=optional,\
            io.vertx.rxjava.core.*;resolution:=optional,\
            io.vertx.rxjava.ext.auth.*;resolution:=optional,\
            rx.*;resolution:=optional,\
            *
          -exportcontents: !*impl, !examples, *
          ]]></bnd>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>java-9</id>
      <activation>
        <jdk>9</jdk>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <excludes>
                  <exclude>**/LangTest.java</exclude>
                </excludes>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <failIfNoTests>false</failIfNoTests>
              <systemPropertyVariables>
                <vertx.test.timeout>60</vertx.test.timeout>
                <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
              </systemPropertyVariables>
              <argLine>-server -Xms128m -Xmx1024m -XX:NewRatio=2 @{surefireArgLine}</argLine>
              <excludes>
                <exclude>**/ScratchPad.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
