<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-build-parent</artifactId>
        <version>1.3.4.Final-redhat-00001</version>
        <relativePath>../build-parent/pom.xml</relativePath>
    </parent>

    <artifactId>quarkus-documentation</artifactId>

    <packaging>jar</packaging>

    <version>1.3.4.Final-redhat-00001</version>
    <properties>
        <asciidoctorj.version>2.2.0</asciidoctorj.version>
        <asciidoctor-maven-plugin.version>2.0.0-RC.1</asciidoctor-maven-plugin.version>
        <asciidoctorj-pdf.version>1.5.0-beta.8</asciidoctorj-pdf.version>
        <quarkus-home-url>https://quarkus.io</quarkus-home-url>
        <quarkus-base-url>https://github.com/quarkusio/quarkus</quarkus-base-url>
        <quickstarts-base-url>https://github.com/quarkusio/quarkus-quickstarts</quickstarts-base-url>
        <skipDocs>false</skipDocs>
        <ProductVersionOverride>1.3.4.Final</ProductVersionOverride>
    </properties>

    <name>Quarkus - Documentation</name>
    <description>The Quarkus documentation</description>

    <dependencies>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-extension-processor</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-bootstrap-core</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jsoup</groupId>
                    <artifactId>jsoup</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>${skipDocs}</skip>
                    <mainClass>io.quarkus.docs.generation.AllConfigGenerator</mainClass>
                    <arguments>
                        <argument>${project.version}</argument>
                        <argument>${project.basedir}/../devtools/bom-descriptor-json/target/extensions.json</argument>
                    </arguments>
                    <environmentVariables>
                        <MAVEN_CMD_LINE_ARGS>${env.MAVEN_CMD_LINE_ARGS}</MAVEN_CMD_LINE_ARGS>
                    </environmentVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor-maven-plugin.version}</version>
                <configuration>
                    <skip>${skipDocs}</skip>
                    <enableVerbose>true</enableVerbose>
                    <logHandler>
                        <failIf>
                          <severity>WARN</severity>
                        </failIf>
                    </logHandler>
                    <sourceDirectory>src/main/asciidoc</sourceDirectory>
                    <preserveDirectories>true</preserveDirectories>
                    <attributes>
                        <generated-dir>${project.basedir}/../target/asciidoc/generated</generated-dir>
                        <imagesdir>./images</imagesdir>
                        <icons>font</icons>
                        <sectanchors>true</sectanchors>
                        <!-- set the idprefix to blank -->
                        <idprefix></idprefix>
                        <idseparator>-</idseparator>
                        <docinfo1>true</docinfo1>
                        <!-- avoid content security policy violations -->
                        <skip-front-matter>true</skip-front-matter>

                        <quarkus-version>${project.version}</quarkus-version>
                        <surefire-version>${version.surefire.plugin}</surefire-version>
                        <graalvm-version>${graal-sdk.version-for-documentation}</graalvm-version>
                        <graalvm-flavor>${graal-sdk.version-for-documentation}-java11</graalvm-flavor>
                        <restassured-version>${rest-assured.version}</restassured-version>
                        <maven-version>${proposed-maven-version}</maven-version>
                        <gradle-version>${gradle-wrapper.version}</gradle-version>
                        <keycloak-docker-image>${keycloak.docker.image}</keycloak-docker-image>
                        <!-- Project website home page -->
                        <quarkus-home-url>${quarkus-home-url}</quarkus-home-url>
                        <!-- Root URL of the GitHub organization -->
                        <quarkus-org-url>https://github.com/quarkusio</quarkus-org-url>

                        <!-- === Website URLs === -->
                        <!-- This will probably go away once all the pages are integrated in the website but keep track of the links -->
                        <quarkus-site-getting-started>${quarkus-home-url}/getting-started</quarkus-site-getting-started>
                        <quarkus-site-extension-authors-guide>${quarkus-home-url}/documentation/extension-authors-guide</quarkus-site-extension-authors-guide>
                        <quarkus-site-live-coding>${quarkus-home-url}/live-coding</quarkus-site-live-coding>

                        <!-- === Communication === -->
                        <quarkus-chat-url>https://quarkusio.zulipchat.com/#</quarkus-chat-url>
                        <quarkus-mailing-list-subscription-email>quarkus-dev+subscribe@googlegroups.com</quarkus-mailing-list-subscription-email>
                        <quarkus-mailing-list-index>https://groups.google.com/d/forum/quarkus-dev</quarkus-mailing-list-index>

                        <!-- === Quarkus project settings === -->
                        <!-- Quarkus repository base URL -->
                        <quarkus-base-url>${quarkus-base-url}</quarkus-base-url>
                        <!-- Quarkus repository URL to clone -->
                        <quarkus-clone-url>${quarkus-base-url}.git</quarkus-clone-url>
                        <!-- Quarkus URL to master source archive -->
                        <quarkus-archive-url>${quarkus-base-url}/archive/master.zip</quarkus-archive-url>
                        <!-- Quarkus URL to master blob source tree; used for referencing source files -->
                        <quarkus-blob-url>${quarkus-base-url}/blob/master</quarkus-blob-url>
                        <!-- Quarkus URL to master source tree root; used for referencing directories -->
                        <quarkus-tree-url>${quarkus-base-url}/tree/master</quarkus-tree-url>
                        <!-- Quarkus URL to issues -->
                        <quarkus-issues-url>${quarkus-base-url}/issues</quarkus-issues-url>
                        <quarkus-images-url>https://github.com/quarkusio/quarkus-images/tree</quarkus-images-url>

                        <!-- === Quickstart settings === -->
                        <!-- Quickstart repository base URL -->
                        <quickstarts-base-url>${quickstarts-base-url}</quickstarts-base-url>
                        <!-- Quickstart repository URL to clone -->
                        <quickstarts-clone-url>${quickstarts-base-url}.git</quickstarts-clone-url>
                        <!-- Quickstart URL to master source archive -->
                        <quickstarts-archive-url>${quickstarts-base-url}/archive/master.zip</quickstarts-archive-url>
                        <!-- Quickstart URL to master blob source tree; used for referencing source files -->
                        <quickstarts-blob-url>${quickstarts-base-url}/blob/master</quickstarts-blob-url>
                        <!-- Quickstart URL to master source tree root; used for referencing directories -->
                        <quickstarts-tree-url>${quickstarts-base-url}/tree/master</quickstarts-tree-url>
                    </attributes>
                </configuration>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <skip>${skipDocs}</skip>
                            <backend>html5</backend>
                            <attributes>
                                <source-highlighter>coderay</source-highlighter>
                                <!-- avoid content security policy violations -->
                                <linkcss>true</linkcss>
                                <copycss>true</copycss>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly.xml</descriptor>
                            </descriptors>
                            <recompressZippedFiles>true</recompressZippedFiles>
                            <finalName>quarkus-documentation-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                            <outputDirectory>target/</outputDirectory>
                            <workDirectory>target/assembly/work</workDirectory>
                            <tarLongFileMode>posix</tarLongFileMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>us.bryon</groupId>
                <artifactId>graphviz-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>dot-files</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>dot</goal>
                        </goals>
                        <configuration></configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>documentation-pdf</id>
            <activation>
                <property>
                    <name>documentation-pdf</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj-pdf</artifactId>
                                <version>${asciidoctorj-pdf.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>output-pdf</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals> 
                                <configuration>
                                    <skip>${skipDocs}</skip>
                                    <backend>pdf</backend>
                                    <outputDirectory>${project.build.directory}/generated-docs-pdf</outputDirectory>
                                    <sourceHighlighter>coderay</sourceHighlighter>
                                    <attributes>
                                        <pdf-stylesdir>${basedir}/src/main/resources/theme</pdf-stylesdir>
                                        <pdf-style>quarkus</pdf-style>
                                        <pdf-fontsdir>${basedir}/src/main/resources/theme/fonts</pdf-fontsdir>
                                        <icon-set>fas</icon-set>
                                        <pagenums></pagenums>
                                    </attributes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>assemble-pdf</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>assembly-pdf.xml</descriptor>
                                    </descriptors>
                                    <recompressZippedFiles>true</recompressZippedFiles>
                                    <finalName>quarkus-documentation-${project.version}</finalName>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>target/</outputDirectory>
                                    <workDirectory>target/assembly-pdf/work</workDirectory>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
