<?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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>vertx-rx</artifactId>
    <groupId>io.vertx</groupId>
    <version>3.7.1</version>
  </parent>

  <artifactId>vertx-rx-java2-gen</artifactId>
  <version>3.7.1</version>

  <name>Vert.x RxJava2 Code Generator</name>

  <properties>
    <asciidoc.dir>${project.basedir}/src/main/asciidoc</asciidoc.dir>
    <lang>java</lang>
    <!-- There is an issue with source plugin because we don't get the generated sources
         because of BSC plugin, also the source is messy because we keep a version of vert.x core
         so better use the assembly plugin instead -->
    <source.skip>true</source.skip>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.reactivex.rxjava2</groupId>
      <artifactId>rxjava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.reactivestreams</groupId>
      <artifactId>reactive-streams</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-rx-gen</artifactId>
      <version>3.7.1</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <classifier>tck-sources</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <classifier>sources</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-rx-gen</artifactId>
      <version>3.7.1</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>copy-codegen-extra</id>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <phase>generate-test-sources</phase>
            <configuration>
              <outputDirectory>${project.basedir}/src/test/java/</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.basedir}/../rx-java-codegen/src/test/java</directory>
                  <includes>
                    <include>io/vertx/codegen/extra/**</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Configure the execution of the compiler to execute the codegen processor -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>default-testCompile</id>
            <configuration>
              <annotationProcessors>
                <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
              </annotationProcessors>
              <compilerArgs>
                <arg>-Acodegen.output=${project.basedir}/src/test</arg>
                <arg>-Acodegen.generators=RxJava2</arg>
              </compilerArgs>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <!-- Unpack codegen source code to src/test/java -->
          <execution>
            <id>unpack-codegen</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeGroupIds>io.vertx</includeGroupIds>
              <includeArtifactIds>vertx-codegen</includeArtifactIds>
              <includeTypes>jar</includeTypes>
              <includeClassifiers>tck-sources</includeClassifiers>
              <outputDirectory>${basedir}/src/test/java</outputDirectory>
            </configuration>
          </execution>
          <!-- Unpack codegen source code to src/test/java -->
          <execution>
            <id>unpack-core</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeGroupIds>io.vertx</includeGroupIds>
              <includeArtifactIds>vertx-core</includeArtifactIds>
              <includeTypes>jar</includeTypes>
              <includeClassifiers>sources</includeClassifiers>
              <outputDirectory>${basedir}/src/test/java</outputDirectory>
              <includes>io/vertx/core/streams/*.java</includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
