<?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">
  <parent>
    <artifactId>vertx-lang-kotlin-parent</artifactId>
    <groupId>io.vertx</groupId>
    <version>3.6.2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>vertx-lang-kotlin-gen</artifactId>

  <dependencies>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codetrans</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-kotlin-coroutines</artifactId>
      <version>3.6.2</version>
      <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-codegen</artifactId>
      <classifier>tck</classifier>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>compile</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <sourceDirs>
                <sourceDir>src/main/java</sourceDir>
                <sourceDir>target/generated-sources/kotlin</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
          <execution>
            <id>test-kapt</id>
            <goals>
              <goal>test-kapt</goal>
            </goals>
            <configuration>
              <annotationProcessors>
                <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
              </annotationProcessors>
              <annotationProcessorArgs>
                <processorArg>codegen.generators=Kotlin,KotlinCoroutines</processorArg>
              </annotationProcessorArgs>
              <sourceDirs>
                <sourceDir>src/test/kotlin</sourceDir>
                <sourceDir>${project.build.directory}/sources/vertx-codegen</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
          <execution>
            <id>>test-compile</id>
            <goals>
              <goal>test-compile</goal>
            </goals>
            <phase>test-compile</phase>
            <configuration>
              <experimentalCoroutines>enable</experimentalCoroutines>
              <sourceDirs>
                <sourceDir>src/test/kotlin</sourceDir>
                <!-- We need this because test-kapt does not store the generated Kotlin source at the right location -->
                <sourceDir>${project.build.directory}/generated-sources/kaptKotlin</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <!-- Unpack codegen source code to sources/test/java -->
          <execution>
            <id>unpack-tck</id>
            <phase>generate-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>${project.build.directory}/sources/vertx-codegen</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <profiles>
  </profiles>

</project>
