<?xml version="1.0" encoding="UTF-8"?>
<!--

    Jakarta Bean Validation TCK

    License: Apache License, Version 2.0
    See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.

-->
<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>jakarta.validation</groupId>
        <artifactId>beanvalidation-tck-parent</artifactId>
        <version>3.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>beanvalidation-tck-documentation</artifactId>
    <packaging>jar</packaging>

    <name>Jakarta Bean Validation TCK Documentation</name>
    <description>Jakarta Bean Validation TCK Documentation</description>

    <properties>
        <beanvalidation-tck-parent.basedir>${project.parent.basedir}</beanvalidation-tck-parent.basedir>

        <asciidoctor.base-output-dir>${project.build.directory}/asciidoctor</asciidoctor.base-output-dir>
        <asciidoctor.theme-dir>${project.build.directory}/hibernate-asciidoctor-theme</asciidoctor.theme-dir>
        <asciidoctor.aggregated-resources-dir>${project.build.directory}/aggregated-resources</asciidoctor.aggregated-resources-dir>
        <asciidoctor.tests-source-dir>${basedir}/../tests/src/main/java</asciidoctor.tests-source-dir>

        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-asciidoctor-theme</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.hibernate.infra</groupId>
                                    <artifactId>hibernate-asciidoctor-theme</artifactId>
                                    <version>${hibernate-asciidoctor-theme.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-asciidoc-theme-to-aggregated-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoctor.theme-dir}</directory>
                                    <filtering>true</filtering>
                                    <excludes>
                                        <exclude>**/hibernate*.png</exclude>
                                        <exclude>**/hibernate.css</exclude>
                                    </excludes>
                                </resource>
                            </resources>
                            <outputDirectory>${asciidoctor.aggregated-resources-dir}</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-local-resources-to-aggregated-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <outputDirectory>${asciidoctor.aggregated-resources-dir}</outputDirectory>
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-css-to-html-output</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoctor.aggregated-resources-dir}/css/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${asciidoctor.base-output-dir}/html_single/css/</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-images-to-html-output</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoctor.aggregated-resources-dir}/images/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${asciidoctor.base-output-dir}/html_single/images/</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                        <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                        <nonFilteredFileExtension>otf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <outputDirectory>${asciidoctor.base-output-dir}/html_single</outputDirectory>
                            <sourceHighlighter>prettify</sourceHighlighter>
                            <attributes>
                                <stylesdir>css</stylesdir>
                                <iconfont-remote>false</iconfont-remote>
                                <iconfont-name>font-awesome/css/font-awesome.min</iconfont-name>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <sourceDocumentName>index.asciidoc</sourceDocumentName>
                    <attributes>
                        <docinfodir>${asciidoctor.aggregated-resources-dir}/docinfo</docinfodir>
                        <icons>font</icons>
                        <tabsize>4</tabsize>

                        <copyrightYear>2009 - ${current-year}</copyrightYear>
                        <tckVersion>${project.version}</tckVersion>
                        <validationApiVersion>${validation.api.version}</validationApiVersion>
                        <hibernateValidatorVersion>${hibernate.validator.version}</hibernateValidatorVersion>
                        <testsSourceDir>${asciidoctor.tests-source-dir}</testsSourceDir>
                    </attributes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>timestamp-property</id>
                        <goals>
                            <goal>timestamp-property</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <name>current-year</name>
                            <pattern>yyyy</pattern>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>documentation-pdf</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>output-pdf</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                                <configuration>
                                    <backend>pdf</backend>
                                    <outputDirectory>${asciidoctor.base-output-dir}/pdf</outputDirectory>
                                    <sourceHighlighter>coderay</sourceHighlighter>
                                    <attributes>
                                        <imagesDir>${asciidoctor.aggregated-resources-dir}/images/</imagesDir>
                                        <pdf-stylesdir>${asciidoctor.aggregated-resources-dir}/theme</pdf-stylesdir>
                                        <pdf-style>hibernate</pdf-style>
                                        <pdf-fontsdir>${asciidoctor.aggregated-resources-dir}/theme/fonts</pdf-fontsdir>
                                        <pagenums/>
                                        <idprefix/>
                                        <idseparator>-</idseparator>
                                    </attributes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>ch.mfrey.maven.plugin</groupId>
                        <artifactId>copy-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${asciidoctor.base-output-dir}/pdf</directory>
                                            <move>true</move>
                                            <includes>
                                                <include>index.pdf</include>
                                            </includes>
                                            <paths>
                                                <path>
                                                    <from>index.pdf</from>
                                                    <to>beanvalidation-tck-documentation.pdf</to>
                                                </path>
                                            </paths>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
