<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.mulesoft.mule.runtime</groupId>
        <artifactId>mule</artifactId>
        <version>4.5.0</version>
    </parent>
    <artifactId>mule-documentation</artifactId>
    <packaging>pom</packaging>
    <name>Mule Documentation</name>
    <description>Mule runtime documentation</description>

    <properties>
        <asciidoctor.maven.plugin.version>2.0.0</asciidoctor.maven.plugin.version>
        <asciidoctorj.diagram.version>2.0.2</asciidoctorj.diagram.version>
        <asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version>

        <skipGpg>true</skipGpg>
        <formatterConfigPath>../formatter.xml</formatterConfigPath>
    </properties>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <!-- added the resources plugin to copy images before adoc transform starts. -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.7</version>
                        <executions>
                            <execution>
                                <id>copy-resources</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/generated-docs/images</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/asciidoc/images</directory>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <version>${asciidoctor.maven.plugin.version}</version>
                        <configuration>
                            <backend>pdf</backend>
                            <imagesDir>${project.build.directory}/generated-docs/images</imagesDir>
                            <attributes>
                                <allow-uri-read/>
                                <imagesdir>${project.build.directory}/generated-docs/images</imagesdir>
                                <source-highlighter>coderay</source-highlighter>
                            </attributes>
                            <requires>
                                <require>asciidoctor-diagram</require>
                            </requires>
                        </configuration>
                        <executions>
                            <execution>
                                <id>output-html</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj-diagram</artifactId>
                                <version>${asciidoctorj.diagram.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj-pdf</artifactId>
                                <version>${asciidoctorj.pdf.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
