<?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>com.dlsc</groupId>
        <artifactId>dlsc-maven-parent</artifactId>
        <version>1.0.0</version>
    </parent>

    <name>UnitFXParent</name>
    <groupId>com.dlsc.unitfx</groupId>
    <artifactId>unitfx-parent</artifactId>
    <version>1.0.9</version>
    <packaging>pom</packaging>

    <modules>
        <module>unitfx</module>
        <module>unitfx-demo</module>
    </modules>

    <properties>
        <project.identifier>unitfx</project.identifier>
        <project.github.repository>dlsc-software-consulting-gmbh/UnitFX</project.github.repository>
        <local.repository.path>/tmp/repository</local.repository.path>
        <sonar.projectKey>dlsc-software-consulting-gmbh_UnitFX</sonar.projectKey>
        <java.version>11</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <asciidoctor.maven.plugin.version>1.6.0</asciidoctor.maven.plugin.version>
        <asciidoctorj.version>1.6.2</asciidoctorj.version>
        <jruby.version>9.2.6.0</jruby.version>
        <javafx.version>17.0.1</javafx.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.dlsc.unitfx</groupId>
                <artifactId>unitfx</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.measure</groupId>
                <artifactId>unit-api</artifactId>
                <version>2.1.2</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <inherited>false</inherited>
                <dependencies>
                    <!-- Comment this section to use the default jruby artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                    <!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDirectory>docs</sourceDirectory>
                    <attributes>
                        <project-version>${project.version}</project-version>
                    </attributes>
                </configuration>
                <executions>
                    <execution>
                        <id>asciidoc-to-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <sourceHighlighter>coderay</sourceHighlighter>
                            <attributes>
                                <coderay-linenums-mode>table</coderay-linenums-mode>
                                <imagesdir></imagesdir>
                                <toc>left</toc>
                                <icons>font</icons>
                                <linkattrs>true</linkattrs>
                                <encoding>utf-8</encoding>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>0.10.0</version>
                        <configuration>
                            <jreleaser>
                                <release>
                                    <github>
                                        <branch>master</branch>
                                        <tagName>{{projectVersion}}</tagName>
                                        <overwrite>true</overwrite>
                                        <changelog>
                                            <formatted>ALWAYS</formatted>
                                            <format>- {{commitShortHash}} {{commitTitle}}</format>
                                            <contributors>
                                                <format>- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
                                            </contributors>
                                            <hide>
                                                <contributors>GitHub</contributors>
                                            </hide>
                                        </changelog>
                                    </github>
                                </release>
                            </jreleaser>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
