<?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-parent</artifactId>
    <version>3.0.0-dev_preview1</version>
  </parent>

  <artifactId>vertx-ext-parent</artifactId>
  <version>3.0.0-dev_preview1</version>
  <packaging>pom</packaging>

  <name>Vert.x Ext Parent pom</name>

  <scm>
    <connection>scm:git:git@github.com:vert-x3/vertx-ext-parent.git</connection>
    <developerConnection>scm:git:git@github.com:vert-x3/vertx-ext-parent.git</developerConnection>
    <url>git@github.com:vert-x3/vertx-ext-parent.git</url>
  </scm>

  <properties>
    <vertx.version>3.0.0-dev_preview1</vertx.version>
    <asciidoc.dir>${project.basedir}/src/main/asciidoc</asciidoc.dir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <version>${vertx.version}</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codetrans</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-groovy</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.3.6</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-js</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <executions>
            <execution>
              <id>default-clean</id>
              <configuration>
                <filesets>
                  <fileset>
                    <directory>src/main/asciidoc</directory>
                  </fileset>
                  <fileset>
                    <directory>${asciidoc.dir}</directory>
                  </fileset>
                </filesets>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <executions>
            <execution>
              <id>default-compile</id>
              <configuration>
                <annotationProcessors>
                  <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                  <annotationProcessor>io.vertx.docgen.JavaDocGenProcessor</annotationProcessor>
                  <annotationProcessor>io.vertx.docgen.DocGenProcessor</annotationProcessor>
                </annotationProcessors>
                <generatedSourcesDirectory>${project.basedir}/src/main/generated</generatedSourcesDirectory>
                <compilerArgs>
                  <arg>-AoutputDirectory=${project.basedir}/src/main</arg>
                  <arg>-Adocgen.output=${asciidoc.dir}/${name}</arg>
                </compilerArgs>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.9.1</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.gmavenplus</groupId>
          <artifactId>gmavenplus-plugin</artifactId>
          <version>1.2</version>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>1.5.0</version>
        </plugin>
        <plugin>
          <groupId>com.bluetrainsoftware.maven</groupId>
          <artifactId>groovydoc-maven-plugin</artifactId>
          <version>1.3</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>

      <!-- Compile Groovy -->
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Have .groovy files in sources-jar -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-groovy-source</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/main/groovy</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Site plugin configuration -->

      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <executions>
          <!-- We need several executions of the plugin until 1.5.1 is released and use the
               preserveDirectories config option -->
          <execution>
            <id>asciidoctor-java</id>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <sourceDirectory>${asciidoc.dir}/java</sourceDirectory>
              <sourceDocumentName>index.adoc</sourceDocumentName>
              <outputDirectory>${project.build.directory}/docs/java</outputDirectory>
              <sourceHighlighter>coderay</sourceHighlighter>
              <attributes>
                <lang>java</lang>
              </attributes>
              <backend>html</backend>
              <doctype>book</doctype>
            </configuration>
            <phase>site</phase>
          </execution>
          <execution>
            <id>asciidoctor-groovy</id>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <sourceDirectory>${asciidoc.dir}/groovy</sourceDirectory>
              <sourceDocumentName>index.adoc</sourceDocumentName>
              <outputDirectory>${project.build.directory}/docs/groovy</outputDirectory>
              <sourceHighlighter>coderay</sourceHighlighter>
              <attributes>
                <lang>groovy</lang>
              </attributes>
              <backend>html</backend>
              <doctype>book</doctype>
            </configuration>
            <phase>site</phase>
          </execution>
          <execution>
            <id>asciidoctor-js</id>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <sourceDirectory>${asciidoc.dir}/js</sourceDirectory>
              <sourceDocumentName>index.adoc</sourceDocumentName>
              <outputDirectory>${project.build.directory}/docs/js</outputDirectory>
              <sourceHighlighter>coderay</sourceHighlighter>
              <attributes>
                <lang>js</lang>
              </attributes>
              <backend>html</backend>
              <doctype>book</doctype>
            </configuration>
            <phase>site</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <phase>site</phase>
            <configuration>
              <reportOutputDirectory>${project.build.directory}/docs/java</reportOutputDirectory>
            </configuration>
            <goals>
              <goal>javadoc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.phasebash.jsdoc</groupId>
        <artifactId>jsdoc3-maven-plugin</artifactId>
        <version>1.1.0</version>
        <executions>
          <execution>
            <phase>site</phase>
            <goals>
              <goal>jsdoc3</goal>
            </goals>
            <configuration>
              <recursive>true</recursive>
              <directoryRoots>
                <directoryRoot>${basedir}/src/main/resources</directoryRoot>
              </directoryRoots>
              <outputDirectory>${project.build.directory}/docs/js/jsdoc</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.bluetrainsoftware.maven</groupId>
        <artifactId>groovydoc-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>site</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <destinationDirectory>${project.build.directory}/docs/groovy/groovydoc</destinationDirectory>
              <scope>public</scope>
              <skipJavadoc>true</skipJavadoc>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.7</version>
        <reportSets>
          <reportSet>
            <reports>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

</project>
