<?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>14.0.6.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://infinispan.org/tutorials/simple/simple_tutorials.html</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/en/java/javase/11</jdk.root>
        <jdk.docroot>${jdk.root}/docs/api</jdk.docroot>
        <javaee.docroot>https://jakarta.ee/specifications/platform/9/apidocs</javaee.docroot>
        <skipTests>true</skipTests>
        <defaults.file>${project.build.directory}/default-attributes.adoc</defaults.file>
        <asciidoctorj.version>2.5.2</asciidoctorj.version>
        <asciidoctor.maven.plugin.version>2.2.1</asciidoctor.maven.plugin.version>
        <asciidoctorj.pdf.version>1.6.0</asciidoctorj.pdf.version>
        <jruby.version>9.2.17.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>
        <logging.html.tmp>${project.build.directory}/report/tmp</logging.html.tmp>
    </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-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>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</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-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>
                                <jdkroot>${jdk.root}</jdkroot>
                                <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>pdf</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 level="info" message="Uploading PDF docs" />
                                        <exec dir="${project.build.directory}/generated/${infinispan.base.version}" executable="rsync" failonerror="${rsync.failonerror}">
                                            <arg value="-rvm" />
                                            <arg line="--protocol=29" />
                                            <arg line="-e &quot;ssh -i ${upload.keyFile} -p ${upload.remotePort}&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/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>
        <profile>
            <id>distribution</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-logging-report</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>install</phase>
                                <configuration>
                                    <target>
                                        <ant antfile="collect-logs.xml" inheritRefs="true" />
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <version>${versionx.org.codehaus.mojo.xml-maven-plugin}</version>
                        <executions>
                            <execution>
                                <id>generate-logging-html</id>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                                <phase>install</phase>
                                <configuration>
                                    <transformationSets>
                                        <transformationSet>
                                            <dir>.</dir>
                                            <includes>
                                                <include>logs.html</include>
                                            </includes>
                                            <stylesheet>logging-report.xsl</stylesheet>
                                            <outputDir>${project.build.directory}/generated/${infinispan.base.version}/html/logging</outputDir>
                                            <parameters>
                                                <parameter>
                                                    <name>directory</name>
                                                    <value>${logging.html.tmp}</value>
                                                </parameter>
                                            </parameters>
                                        </transformationSet>
                                    </transformationSets>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>net.sf.saxon</groupId>
                                <artifactId>Saxon-HE</artifactId>
                                <version>10.5</version>
                            </dependency>
                        </dependencies>
                    </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>
                                    </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>
