<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2020, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.wildfly</groupId>
  <artifactId>generate-javadocs-pom</artifactId>
  <version>@pom.version@</version>

  <name>Generate Javadocs POM File</name>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <xp.version>@xp.version@</xp.version>
    <server.version>@server.version@</server.version>
    <core.version>@core.version@</core.version>

    <!-- base directories for dist and sources zip -->
    <serverDistBaseDir>${project.build.directory}/eap-xp-dist</serverDistBaseDir>
    <xpSourceBaseDir>${project.build.directory}/eap-xp-src</xpSourceBaseDir>
    <serverSourceBaseDir>${project.build.directory}/wildfly-ee-src</serverSourceBaseDir>
    <serverCoreSourceBaseDir>${project.build.directory}/wildfly-core-src</serverCoreSourceBaseDir>

    <generate-javadocs-pom.verbose>true</generate-javadocs-pom.verbose>
    <generate-javadocs-pom.templatePomFile>${project.basedir}/template-pom.xml</generate-javadocs-pom.templatePomFile>
    <generate-javadocs-pom.serverDistDir>${serverDistBaseDir}/jboss-eap-8.1</generate-javadocs-pom.serverDistDir>
    <generate-javadocs-pom.xpSourceDir>${xpSourceBaseDir}/jboss-eap-8.1-src</generate-javadocs-pom.xpSourceDir>
    <generate-javadocs-pom.serverSourceDir>${serverSourceBaseDir}/jboss-eap-8.1-src</generate-javadocs-pom.serverSourceDir>
    <generate-javadocs-pom.serverCoreSourceDir>${serverCoreSourceBaseDir}/jboss-eap-8.1-core-src</generate-javadocs-pom.serverCoreSourceDir>
    <generate-javadocs-pom.serverVersion>${server.version}</generate-javadocs-pom.serverVersion>
    <generate-javadocs-pom.projectVersion>${project.version}</generate-javadocs-pom.projectVersion>
    <version.org.wildfly.javadocs-pom-generator-plugin>@version.org.wildfly.javadocs-pom-generator-plugin@</version.org.wildfly.javadocs-pom-generator-plugin>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.wildfly</groupId>
          <artifactId>javadocs-pom-generator-plugin</artifactId>
          <version>${version.org.wildfly.javadocs-pom-generator-plugin}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>download-files</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.googlecode.maven-download-plugin</groupId>
            <artifactId>download-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
              <execution>
                <id>download-eap-xp-dist</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.jboss.eap.xp</groupId>
                  <artifactId>wildfly-dist</artifactId>
                  <version>${xp.version}</version>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${serverDistBaseDir}</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>download-eap-xp-src</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.jboss.eap.xp</groupId>
                  <artifactId>wildfly-dist</artifactId>
                  <version>${xp.version}</version>
                  <classifier>src</classifier>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${xpSourceBaseDir}</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>download-server-source</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.jboss.eap</groupId>
                  <artifactId>wildfly-ee-dist</artifactId>
                  <version>${server.version}</version>
                  <classifier>src</classifier>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${serverSourceBaseDir}</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>download-server-core-source</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.wildfly.core</groupId>
                  <artifactId>wildfly-core-parent</artifactId>
                  <version>${core.version}</version>
                  <classifier>project-sources</classifier>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${serverCoreSourceBaseDir}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
