<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Hibernate Validator, declare and validate application constraints
  ~
  ~ 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>org.hibernate.validator</groupId>
        <artifactId>hibernate-validator-parent</artifactId>
        <version>6.0.19.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>hibernate-validator-documentation</artifactId>
    <packaging>jar</packaging>

    <name>Hibernate Validator Manual</name>
    <description>The Hibernate Validator reference manual</description>

    <properties>
        <asciidoctor.base-output-dir>${project.build.directory}/asciidoctor/en-US</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.examples-source-dir>${basedir}/src/test/java</asciidoctor.examples-source-dir>
        <asciidoctor.examples-resources-dir>${basedir}/src/test/resources</asciidoctor.examples-resources-dir>
        <asciidoctor.engine-source-dir>${basedir}/../engine/src/main/java</asciidoctor.engine-source-dir>
        <asciidoctor.osgi-integrationtest-source-dir>${basedir}/../osgi/integrationtest/src/test/java</asciidoctor.osgi-integrationtest-source-dir>

        <html.meta.description>Hibernate Validator, Annotation based constraints for your domain model - Reference Documentation</html.meta.description>
        <html.meta.keywords>hibernate, validator, hibernate validator, validation, bean validation</html.meta.keywords>
        <html.meta.project-key>validator</html.meta.project-key>
        <html.google-analytics.id>UA-45270411-3</html.google-analytics.id>
        <html.google-analytics.tag-manager.id>GTM-NJWS5L</html.google-analytics.tag-manager.id>
        <html.google-analytics.tag-manager.channel>Hibernate</html.google-analytics.tag-manager.channel>
        <html.outdated-content.project-key>${html.meta.project-key}</html.outdated-content.project-key>

        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
        <maven-surefire-plugin.argLine>-Duser.language=en</maven-surefire-plugin.argLine>

        <forbiddenapis-junit.path>forbidden-allow-junit.txt</forbiddenapis-junit.path>
        <hibernate-validator-parent.path>..</hibernate-validator-parent.path>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-validator-cdi</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-jsr223</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Only use assertj when strictly necessary in the documentation tests -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>de.thetaphi</groupId>
                <artifactId>forbiddenapis</artifactId>
            </plugin>
            <plugin>
                <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>
                                </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>
                    </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>
                    <extensions>
                        <extension>
                            <className>org.hibernate.infra.asciidoctor.extensions.customnumbering.CustomNumberingProcessor</className>
                        </extension>
                    </extensions>
                    <sourceDocumentName>index.asciidoc</sourceDocumentName>
                    <attributes>
                        <docinfodir>${asciidoctor.aggregated-resources-dir}/docinfo/noorm-documentation</docinfodir>
                        <icons>font</icons>
                        <tabsize>4</tabsize>

                        <sourcedir>${asciidoctor.examples-source-dir}</sourcedir>
                        <resourcesdir>${asciidoctor.examples-resources-dir}</resourcesdir>
                        <engine-sourcedir>${asciidoctor.engine-source-dir}</engine-sourcedir>
                        <osgi-integrationtest-sourcedir>${asciidoctor.osgi-integrationtest-source-dir}</osgi-integrationtest-sourcedir>

                        <hvVersion>${project.version}</hvVersion>
                        <bvVersion>${bv.api.version}</bvVersion>
                        <jbossLoggingVersion>${jboss.logging.version}</jbossLoggingVersion>
                        <classmateVersion>${classmate.version}</classmateVersion>
                        <javaxElVersion>${javax.el.version}</javaxElVersion>

                        <wildflyVersion>${wildfly.version}</wildflyVersion>
                        <wildflySecondaryVersion>${wildfly-secondary.version}</wildflySecondaryVersion>

                        <!-- URLs -->
                        <javaApiDocsUrl>${java.api-docs.base-url}/</javaApiDocsUrl>
                        <bvApiDocsUrl>${bv.api-docs.base-url}/</bvApiDocsUrl>
                        <bvSpecUrl>${bv.spec.url}</bvSpecUrl>
                        <javaTechnotesBaseUrl>${java.technotes.base-url}</javaTechnotesBaseUrl>
                        <javafxDocsUrl>${javafx.docs.url}</javafxDocsUrl>
                    </attributes>
                </configuration>
            </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>hibernate_validator_reference.pdf</to>
                                                </path>
                                            </paths>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk11+</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-base</artifactId>
                    <version>${version.org.openjfx}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
