<?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>
    <groupId>com.github.xmlet</groupId>
    <artifactId>htmlflow-parent</artifactId>
    <version>5.0.2</version>
    <packaging>pom</packaging>
    <name>${project.groupId}:${project.artifactId}</name>

    <description>
        HtmlFlow project wrapper for the HtmlFlow library,
        which allows Java applications to easily write HTML documents in a fluent style into a java.io.PrintStream.
        This wrapper includes the core library and Kotlin support.
    </description>

    <url>https://github.com/xmlet/HtmlFlow</url>

    <modules>
        <module>htmlflow-core</module>
        <module>htmlflow-kotlin</module>
        <module>htmlflow-view-loader</module>
        <module>flowifier</module>
    </modules>

    <licenses>
        <license>
            <name>MIT license</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Miguel Gamboa</name>
            <email>miguelgamboa@outlook.com</email>
            <organization>CCISEL</organization>
            <organizationUrl>https://gamboa.pt</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:xmlet/HtmlFlow.git</connection>
        <developerConnection>scm:git:git@github.com:xmlet/HtmlFlow.git</developerConnection>
        <url>git@github.com:xmlet/HtmlFlow.git</url>
        <tag>htmlflow-parent-5.0.2</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <junit.jupiter-version>5.9.0</junit.jupiter-version>
        <mockito.junit-version>4.8.0</mockito.junit-version>
        <com.github.xmlet.xsd2poet.version>1.0.8</com.github.xmlet.xsd2poet.version>
        <argLine>-Xss16m -Xmx32M</argLine>
        <kotlin.version>1.9.22</kotlin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${junit.jupiter-version}</version>
                <scope>test</scope>
            </dependency>

            <!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API  -->
            <dependency>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
                <version>${junit.jupiter-version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <systemPropertyVariables>
                        <property>
                            <name>java.util.logging.config.file</name>
                            <value>src/test/resources/logging.properties</value>
                        </property>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                    <pushChanges>false</pushChanges>
                    <connectionUrl>scm:git:git@github.com:xmlet/HtmlFlow.git</connectionUrl>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>1.9.10</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>dokka</goal>
                            <goal>javadoc</goal>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectories>
                        <source>htmlflow-core/src/main/java</source>
                        <source>htmlflow-kotlin/src/main/kotlin</source>
                        <source>htmlflow-view-loader/src/main/kotlin</source>
                        <source>flowifier/src/main/java</source>
                    </sourceDirectories>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.12</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.20</minimum>
                                        </limit>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>CLASS</counter>
                                            <value>MISSEDCOUNT</value>
                                            <maximum>10</maximum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.6.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>5.1.0.4751</version>
            </plugin>

            <!-- Spotless plugin for code formatting -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.46.1</version>
                <configuration>
                    <formats>
                        <format>
                            <includes>
                                <include>htmlflow-core/src/main/java/**/*.java</include>
                                <include>flowifier/src/main/java/**/*.java</include>
                            </includes>
                            <excludes>
                                <exclude>htmlflow-core/src/test/java/**/*.java</exclude>
                                <exclude>flowifier/src/test/java/**/*.java</exclude>
                            </excludes>
                            <prettier>
                                <devDependencies>
                                    <prettier>3.6.1</prettier>
                                    <prettier-plugin-java>2.2.0</prettier-plugin-java>
                                </devDependencies>
                                <config>
                                    <tabWidth>4</tabWidth>
                                    <parser>java</parser>
                                    <plugins>prettier-plugin-java</plugins>
                                </config>
                            </prettier>
                        </format>
                    </formats>
                    <kotlin>
                        <includes>
                            <include>htmlflow-kotlin/src/*/kotlin/**/*.kt</include>
                        </includes>
                        <excludes>
                            <exclude>htmlflow-kotlin/src/test/kotlin/**/*.kt</exclude>
                        </excludes>
                        <ktfmt>
                            <version>0.56</version>
                            <style>KOTLINLANG</style>
                            <blockIndent>4</blockIndent>
                            <continuationIndent>4</continuationIndent>
                            <removeUnusedImports>true</removeUnusedImports>
                            <manageTrailingCommas>true</manageTrailingCommas>
                        </ktfmt>
                    </kotlin>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
