<?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>berlin.yuna</groupId>
    <artifactId>email-html-validator</artifactId>
    <version>2026.01.0162034</version>
    <packaging>jar</packaging>

    <name>email-html-validator</name>
    <description>Plain Java CLI that validates HTML for email clients with GraalVM support.</description>
    <url>https://github.com/YunaBraska/email-html-validator</url>

    <scm>
        <connection>scm:git:ssh://git@github.com/YunaBraska/email-html-validator.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/YunaBraska/email-html-validator.git</developerConnection>
        <url>https://github.com/YunaBraska/email-html-validator.git</url>
    </scm>

    <developers>
        <developer>
            <name>Yuna Morgenstern</name>
            <email>io@yuna.berlin</email>
        </developer>
    </developers>

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

    <properties>
        <!-- Java -->
        <java.version>21</java.version>
        <project.encoding>UTF-8</project.encoding>
        <project.build.sourceEncoding>${project.encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${project.encoding}</project.reporting.outputEncoding>

        <!-- Runtime deps -->
        <jsoup.version>1.22.1</jsoup.version>
        <typemap.version>2026.01.0070717</typemap.version>
        <axe-core.version>4.11.0</axe-core.version>
        <playwright.bundle.scope>compile</playwright.bundle.scope>

        <!-- Test deps -->
        <junit.version>6.0.2</junit.version>
        <assertj.version>3.27.6</assertj.version>
        <junit-platform-launcher.version>6.0.2</junit-platform-launcher.version>

        <!-- Build plugins -->
        <maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-scm-plugin.version>1.11.2</maven-scm-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-assembly-plugin.version>3.8.0</maven-assembly-plugin.version>
        <native-maven-plugin.version>0.10.2</native-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>
        <central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>${jsoup.version}</version>
        </dependency>
        <dependency>
            <groupId>berlin.yuna</groupId>
            <artifactId>type-map</artifactId>
            <version>${typemap.version}</version>
        </dependency>
        <dependency>
            <groupId>com.deque.html.axe-core</groupId>
            <artifactId>playwright</artifactId>
            <version>${axe-core.version}</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.playwright</groupId>
            <artifactId>playwright</artifactId>
            <version>1.55.0</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>${junit-platform-launcher.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.microsoft.playwright</groupId>
                <artifactId>driver-bundle</artifactId>
                <version>1.55.0</version>
                <scope>${playwright.bundle.scope}</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <finalName>${project.name}-no-dependencies</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <release>${java.version}</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <nodeprecatedlist>true</nodeprecatedlist>
                            <quiet>true</quiet>
                            <!-- disable strict checking -->
                            <doclint>none</doclint>
                            <failOnError>false</failOnError>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>berlin.yuna.apidoccrafter.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <finalName>${project.name}</finalName>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <configuration>
                    <excludes>
                        <!--
                        *   Match zero or more characters
                        **  Match zero or more directories
                        ?   Match a single character
                        -->
                        <!--                        <exclude>**/*/config/**/*</exclude>-->
                        <!--                        <exclude>**/*/model/**/*</exclude>-->
                        <!--                        <exclude>**/*/domain/**/*</exclude>-->
                        <exclude>**/*/persistence/**/*</exclude>
                        <exclude>**/*/target/**/*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution> <!-- 1 -->
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/jacoco-ut.exec</destFile>
                        </configuration>
                    </execution>
                    <execution> <!-- 2 -->
                        <id>pre-integration-prepare</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                    <execution> <!-- 3 -->
                        <id>report</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${project.build.directory}</directory>
                                    <includes>
                                        <include>*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>
                    <execution> <!-- 4 -->
                        <id>merged-report-generation</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>native</id>
            <properties>
                <playwright.bundle.scope>provided</playwright.bundle.scope>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <version>${native-maven-plugin.version}</version>
                        <configuration>
                            <imageName>${project.artifactId}.native</imageName>
                            <mainClass>berlin.yuna.ehv.cli.EmailHtmlValidatorCli</mainClass>
                            <buildArgs>
                                <!-- Reduces the image size - Ensures the native image doesn't include the JVM as a fallback option -->
                                <buildArg>--no-fallback</buildArg>
                                <!-- Disables the use of the GraalVM compilation server -->
                                <buildArg>--no-server</buildArg>
                                <!-- Improve startup time - Initialize classes at build time rather than at runtime -->
                                <buildArg>--initialize-at-build-time</buildArg>
                                <!-- Aggressively remove unused code -->
                                <buildArg>--allow-incomplete-classpath</buildArg>
                                <!-- Install exit handlers to properly handle app termination -->
                                <buildArg>--install-exit-handlers</buildArg>
                                <!-- Report unsupported elements at runtime not at build time -->
                                <buildArg>--report-unsupported-elements-at-runtime</buildArg>
                                <!-- epsilon = if you don’t want garbage collection at all -->
                                <!-- serial = if you need basic garbage collection -->
                                <!-- Default Serial garbage collector -->
                                <buildArg>--gc=serial</buildArg>
                                <!-- compatibility = for best compatibility-->
                                <!-- native = for best performance for machine with the same CPU features -->
                                <!-- Defaults to x86-64-v3 on AMD64 and armv8-a on AArch64 -->
                                <!-- <buildArg>-march=native</buildArg>-->
                            </buildArgs>
                            <resourceIncludedPatterns>
                                <!-- Resource folder to include -->
                                <resourceIncludedPattern>.*bin.static.*</resourceIncludedPattern>
                            </resourceIncludedPatterns>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <!-- Needed for including resources -->
                                    <goal>generateResourceConfig</goal>
                                    <goal>compile-no-fork</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    <!-- MAVEN CENTRAL USAGE -->
        <profile>
            <!-- mvn clean deploy -P release -->
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                    <value>true</value>
                </property>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <!-- QUALITY GATE -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <!-- https://maven.apache.org/guides/mini/guide-encryption.html -->
                                        <!-- https://central.sonatype.org/pages/apache-maven.html#distribution-management-and-authentication -->
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- DEPLOYMENT -->
                    <plugin>
                        <!-- https://central.sonatype.org/publish/publish-portal-maven/#plugin-configuration-options -->
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <deploymentName>${project.groupId}:${project.artifactId}:${project.version}</deploymentName>
                            <!--                                <ignorePublishedComponents>true</ignorePublishedComponents>-->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
