<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>

    <groupId>org.hibernate.infra</groupId>
    <artifactId>hibernate-asciidoctor-theme</artifactId>
    <packaging>pom</packaging>
    <version>5.0.2.Final</version>

    <name>Hibernate Asciidoctor theme</name>
    <description>
        The Asciidoctor theme used for the reference documentations of the Hibernate projects.
    </description>
    <url>http://hibernate.org</url>

    <organization>
        <name>Hibernate</name>
        <url>http://www.hibernate.org</url>
    </organization>

    <developers>
        <developer>
            <id>guillaume.smet</id>
            <name>Guillaume Smet</name>
            <email>guillaume@hibernate.org</email>
            <url>http://in.relation.to/guillaume-smet/</url>
        </developer>
        <developer>
            <id>yoann.rodiere</id>
            <name>Yoann Rodière</name>
            <email>yoann@hibernate.org</email>
            <organization>Red Hat, Inc.</organization>
            <url>http://in.relation.to/yoann-rodiere/</url>
        </developer>
    </developers>

    <properties>
        <resources.dir>${basedir}/src/main/resources</resources.dir>
        <zip-content.dir>${project.build.directory}/zip-content</zip-content.dir>

        <jdk.min.version>17</jdk.min.version>
        <maven.min.version>3.9.8</maven.min.version>
        <!-- Run mvn wrapper:wrapper when updating the wrapper plugin version -->
        <maven-wrapper-plugin.version>3.3.2</maven-wrapper-plugin.version>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
        <maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
        <version.enforcer.plugin>3.5.0</version.enforcer.plugin>
        <version.gpg.plugin>3.2.5</version.gpg.plugin>
        <version.nexus-staging.plugin>1.7.0</version.nexus-staging.plugin>

        <gpg.sign.skip>true</gpg.sign.skip>
        <deploy.skip>true</deploy.skip>

        <asciidoctor-maven-plugin.version>3.0.0</asciidoctor-maven-plugin.version>
        <asciidoctorj.version>3.0.0</asciidoctorj.version>
        <asciidoctorj-pdf.version>2.3.18</asciidoctorj-pdf.version>

        <!-- Repository Deployment URLs -->
        <ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
        <ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</ossrh.releases.repo.url>
        <ossrh.releases.repo.baseUrl>https://oss.sonatype.org/</ossrh.releases.repo.baseUrl>
        <ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
        <ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-wrapper-plugin</artifactId>
                <version>${maven-wrapper-plugin.version}</version>
                <configuration>
                    <mavenVersion>${maven.min.version}</mavenVersion>
                    <distributionType>bin</distributionType>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-images-to-zip-content</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${resources.dir}/images/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${zip-content.dir}/images</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-css-to-zip-content</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${resources.dir}/css/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${zip-content.dir}/css</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-script-to-zip-content</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${resources.dir}/script/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${zip-content.dir}/script</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-theme-to-zip-content</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${resources.dir}/theme/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${zip-content.dir}/theme</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-docinfo-to-zip-content</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${resources.dir}/docinfo/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${zip-content.dir}/docinfo</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- Only for testing -->
                    <execution>
                        <id>copy-images-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${zip-content.dir}/images/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/images</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-css-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${zip-content.dir}/css/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/css</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-script-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${zip-content.dir}/script/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/script</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <descriptors>
                        <descriptor>${basedir}/src/main/assembly/zip-content.xml</descriptor>
                    </descriptors>
                    <finalName>${project.artifactId}-${project.version}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>test</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <attributes>
                                <source-highlighter>prettify</source-highlighter>
                            </attributes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>output-pdf</id>
                        <phase>test</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>pdf</backend>
                            <attributes>
                                <pdf-themesdir>${zip-content.dir}/theme</pdf-themesdir>
                                <pdf-theme>hibernate</pdf-theme>
                                <pdf-fontsdir>${zip-content.dir}/theme/fonts;GEM_FONTS_DIR</pdf-fontsdir>
                                <pagenums />
                                <idprefix />
                                <idseparator>-</idseparator>
                                <imagesdir>${zip-content.dir}/images/</imagesdir>
                                <source-highlighter>coderay</source-highlighter>
                            </attributes>
                            <enableVerbose>true</enableVerbose>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>src/test/asciidoc</sourceDirectory>
                    <sourceDocumentName>index.asciidoc</sourceDocumentName>
                    <outputDirectory>${project.build.directory}/asciidoctor</outputDirectory>
                    <attributes>
                        <icons>font</icons>
                        <tabsize>4</tabsize>
                        <docinfodir>${zip-content.dir}/docinfo/noorm-documentation</docinfodir>

                        <sourcedir>${basedir}/src/test/java</sourcedir>
                        <theme-version>${project.version}</theme-version>
                    </attributes>
                </configuration>
                <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>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${version.enforcer.plugin}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[${jdk.min.version},)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>${maven.min.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${version.gpg.plugin}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <skip>${gpg.sign.skip}</skip>
                            <homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
                            <bestPractices>true</bestPractices>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${version.nexus-staging.plugin}</version>
                <extensions>true</extensions>
                <configuration>
                    <skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
                    <serverId>${ossrh.releases.repo.id}</serverId>
                    <!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
                    <nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
                    <!-- oss.sonatype.org has been very slow when closing repositories lately;
                         let's raise the timeout until we switch to s01.sonatype.org -->
                    <stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <gpg.sign.skip>false</gpg.sign.skip>
                <deploy.skip>false</deploy.skip>
            </properties>
        </profile>
    </profiles>

    <inceptionYear>2017</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/hibernate/hibernate-asciidoctor-theme.git</connection>
        <developerConnection>scm:git:git@github.com:hibernate/hibernate-asciidoctor-theme.git</developerConnection>
        <url>http://github.com/hibernate/hibernate-asciidoctor-theme</url>
        <tag>HEAD</tag>
    </scm>

    <ciManagement>
        <system>Jenkins</system>
        <url>http://ci.hibernate.org/</url>
    </ciManagement>

    <distributionManagement>
        <repository>
            <id>${ossrh.releases.repo.id}</id>
            <name>OSSRH Releases Repository</name>
            <url>${ossrh.releases.repo.url}</url>
        </repository>
        <snapshotRepository>
            <id>${ossrh.snapshots.repo.id}</id>
            <name>OSSRH Snapshots Repository</name>
            <url>${ossrh.snapshots.repo.url}</url>
        </snapshotRepository>
    </distributionManagement>

</project>
