<?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>
    <groupId>io.vertx</groupId>
    <artifactId>vertx-ext-parent</artifactId>
    <version>34</version>
  </parent>

  <version>3.6.2</version>
  <artifactId>vertx-sockjs-service-proxy</artifactId>

  <properties>
    <codegen.rxjava.deprecated>true</codegen.rxjava.deprecated>
    <stack.version>3.6.2</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-codegen</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codetrans</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-service-proxy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-js</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
      <classifier>client</classifier>
      <version>${project.version}</version>
      <scope>test</scope>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <!-- 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>
                </compilerArgs>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>

    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.bsc.maven</groupId>
        <artifactId>maven-processor-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>process-classes</phase>
          </execution>
          <execution>
            <id>generate-test-sources</id>
            <goals>
              <goal>process-test</goal>
            </goals>
            <phase>process-test-classes</phase>
            <configuration>
              <systemProperties>
                <java.util.logging.SimpleFormatter.format>%4$s: %3$s - %5$s %6$s%n</java.util.logging.SimpleFormatter.format>
              </systemProperties>
              <processors>
                <processor>io.vertx.codegen.CodeGenProcessor</processor>
              </processors>
              <optionMap>
                <codegen.output>${project.basedir}/src/test</codegen.output>
                <!-- Data object converters are placed in src/main/generated -->
                <codegen.output.data_object_converters>generated</codegen.output.data_object_converters>
              </optionMap>
              <defaultOutputDirectory>${project.build.directory}/generated-test-sources/codegen</defaultOutputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.10</version>
        <executions>
          <execution>
            <id>copy-vertx-eventbus</id>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <phase>process-test-resources</phase>
            <configuration>
              <includeArtifactIds>vertx-web</includeArtifactIds>
              <includeClassifiers>client</includeClassifiers>
              <outputDirectory>${project.build.testOutputDirectory}/vertx-js</outputDirectory>
              <stripVersion>true</stripVersion>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>rename-vertx-eventbus</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>process-test-resources</phase>
            <configuration>
              <target>
                <move file="${project.build.testOutputDirectory}/vertx-js/vertx-web-client.js" tofile="${project.build.testOutputDirectory}/vertx-js/vertx-eventbus.js"/>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
