<?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>org.infinispan</groupId>
        <artifactId>infinispan-parent</artifactId>
        <version>12.1.7.Final-redhat-00001</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>infinispan-docs</artifactId>

    <name>Infinispan Documentation</name>
    <description>The Infinispan Documentation</description>

    <properties>
        <download.url>https://infinispan.org/download/</download.url>
        <infinispan.tutorials>https://github.com/infinispan/infinispan-simple-tutorials/</infinispan.tutorials>
        <javadoc.root>https://docs.jboss.org/infinispan/${infinispan.base.version}/apidocs</javadoc.root>
        <configdoc.root>https://docs.jboss.org/infinispan/${infinispan.base.version}/configdocs/</configdoc.root>
        <wildfly.docroot>https://docs.jboss.org/author/display/WFLY11</wildfly.docroot>
        <jdk.root>https://docs.oracle.com/javase/8/docs</jdk.root>
        <jdk.docroot>${jdk.root}/api</jdk.docroot>
        <javaee.docroot>https://docs.oracle.com/javaee/7/api</javaee.docroot>
        <skipTests>true</skipTests>
        <defaults.file>${project.build.directory}/default-attributes.adoc</defaults.file>
        <asciidoctorj.version>2.1.0</asciidoctorj.version>
        <asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
        <asciidoctorj.pdf.version>1.5.0-alpha.18</asciidoctorj.pdf.version>
        <jruby.version>9.2.9.0</jruby.version>
        <asciidoctorj.tabbed.code.version>0.3</asciidoctorj.tabbed.code.version>
        <infinispanslot>${infinispan.module.slot.prefix}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</infinispanslot>
        <schemaVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</schemaVersion>
        <protostream.api.docs>https://www.javadoc.io/doc/org.infinispan.protostream/protostream/${version.protostream}</protostream.api.docs>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-cachestore-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-cachestore-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-cachestore-remote</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-cachestore-rocksdb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-clustered-counter</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>extract-slot</id>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.infinispan</groupId>
                <artifactId>infinispan-defaults-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <id>extract-defaults</id>
                        <goals>
                            <goal>extract-defaults</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <attributeDefType>ALL</attributeDefType>
                            <defaultsFile>${defaults.file}</defaultsFile>
                            <outputAscii>true</outputAscii>
                            <filterXsd>false</filterXsd>
                            <jars>
                                <jar>infinispan-core</jar>
                                <jar>infinispan-cachestore-jdbc</jar>
                                <jar>infinispan-cachestore-jpa</jar>
                                <jar>infinispan-cachestore-rocksdb</jar>
                                <jar>infinispan-cachestore-remote</jar>
                            </jars>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>${asciidoctorj.pdf.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                    <dependency>
                      <groupId>com.bmuschko</groupId>
                      <artifactId>asciidoctorj-tabbed-code-extension</artifactId>
                      <version>${asciidoctorj.tabbed.code.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <doctype>book</doctype>
                            <outputDirectory>${project.build.directory}/generated/${infinispan.base.version}/html</outputDirectory>
                            <imagesDir>.</imagesDir>
                            <preserveDirectories>true</preserveDirectories>
                            <relativeBaseDir>true</relativeBaseDir>
                            <sourceDocumentExtensions>
                                <sourceDocumentExtension>asciidoc</sourceDocumentExtension>
                                <sourceDocumentExtension>asciidoctorj-tabbed-code-extension</sourceDocumentExtension>
                            </sourceDocumentExtensions>
                            <sourceHighlighter>coderay</sourceHighlighter>
                            <attributes>
                                <idprefix />
                                <sectanchors>true</sectanchors>
                                <toclevels>5</toclevels>
                                <numbered>true</numbered>
                                <icons>font</icons>
                                <docinfo>true</docinfo>
                                <experimental>true</experimental>
                                <infinispanversion>${infinispan.base.version}</infinispanversion>
                                <infinispancomponentversion>${version.infinispan}</infinispancomponentversion>
                                <schemaversion>${schemaVersion}</schemaversion>
                                <brandname>${infinispan.brand.name}</brandname>
                                <brandshortname>${infinispan.brand.short-name}</brandshortname>
                                <fullbrandname>${infinispan.brand.name}</fullbrandname>
                                <moduleprefix>${infinispan.module.slot.prefix}</moduleprefix>
                                <infinispanslot>${infinispanslot}</infinispanslot>
                                <defaults>${defaults.file}</defaults>
                                <javadocroot>${javadoc.root}</javadocroot>
                                <protostreamdocroot>${protostream.api.docs}</protostreamdocroot>
                                <configdocroot>${configdoc.root}</configdocroot>
                                <wildflydocroot>${wildfly.docroot}</wildflydocroot>
                                <jdkdocroot>${jdk.docroot}</jdkdocroot>
                                <javaeedocroot>${javaee.docroot}</javaeedocroot>
                                <download_url>${download.url}</download_url>
                                <code_tutorials>${infinispan.tutorials}</code_tutorials>
                                <imagesdir>../../topics/images</imagesdir>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>distribution</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <version>${asciidoctor.maven.plugin.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj</artifactId>
                                <version>${asciidoctorj.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctorj-pdf</artifactId>
                                <version>${asciidoctorj.pdf.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>pdf</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                                <configuration>
                                    <backend>pdf</backend>
                                    <doctype>book</doctype>
                                    <outputDirectory>${project.build.directory}/generated/${infinispan.base.version}/pdf</outputDirectory>
                                    <imagesDir>.</imagesDir>
                                    <preserveDirectories>false</preserveDirectories>
                                    <relativeBaseDir>true</relativeBaseDir>
                                    <sourceDocumentExtensions>
                                        <sourceDocumentExtension>asciidoc</sourceDocumentExtension>
                                        <sourceDocumentExtension>asciidoctorj-tabbed-code-extension</sourceDocumentExtension>
                                    </sourceDocumentExtensions>
                                    <sourceHighlighter>coderay</sourceHighlighter>
                                    <attributes>
                                        <idprefix />
                                        <sectanchors>true</sectanchors>
                                        <toclevels>3</toclevels>
                                        <numbered>true</numbered>
                                        <icons>font</icons>
                                        <docinfo>true</docinfo>
                                        <experimental>true</experimental>
                                        <infinispanversion>${infinispan.base.version}</infinispanversion>
                                        <infinispancomponentversion>${version.infinispan}</infinispancomponentversion>
                                        <schemaversion>${schemaVersion}</schemaversion>
                                        <brandname>${infinispan.brand.name}</brandname>
                                        <fullbrandname>${infinispan.brand.name}</fullbrandname>
                                        <defaults>${defaults.file}</defaults>
                                        <infinispanslot>${infinispanslot}</infinispanslot>
                                        <javadocroot>${javadoc.root}</javadocroot>
                                        <protostreamdocroot>${protostream.api.docs}</protostreamdocroot>
                                        <configdocroot>${configdoc.root}</configdocroot>
                                        <wildflydocroot>${wildfly.docroot}</wildflydocroot>
                                        <jdkdocroot>${jdk.docroot}</jdkdocroot>
                                        <javaeedocroot>${javaee.docroot}</javaeedocroot>
                                        <download_url>${download.url}</download_url>
                                        <code_tutorials>${infinispan.tutorials}</code_tutorials>
                                        <imagesdir>../../topics/images</imagesdir>
                                    </attributes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>optimize-pdf</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <target>
                                        <ant antfile="optimize-pdf.xml" inheritRefs="true">
                                            <target name="optimize-pdf" />
                                        </ant>
                                    </target>
                                </configuration>
                            </execution>
                            <execution>
                                <id>upload-pdf</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipArtifactUpload}</skip>
                                    <target>
                                        <echo message="Uploading PDF docs" />
                                        <exec dir="${project.build.directory}/generated/${infinispan.base.version}" executable="rsync">
                                            <arg value="-rvm" />
                                            <arg line="--protocol=29" />
                                            <arg line="-e &quot;ssh -i ${upload.keyFile}&quot;" />
                                            <arg line="--exclude='*.png'" />
                                            <arg line="--exclude='*.svg'" />
                                            <arg line="--include='*.pdf'" />
                                            <arg value="pdf" />
                                            <arg value="${upload.docsDir}" />
                                        </exec>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>assemble-html</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assemblies/html.xml</descriptor>
                                        <descriptor>src/main/assemblies/pdf.xml</descriptor>
                                    </descriptors>
                                    <attach>true</attach>
                                    <recompressZippedFiles>true</recompressZippedFiles>
                                    <finalName>${project.artifactId}-${project.version}</finalName>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <workDirectory>${project.build.directory}/assembly/work</workDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
