<?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>net.jacopobiscella</groupId>
    <artifactId>ha-track</artifactId>
    <version>0.57.0-alpha</version>
    <packaging>pom</packaging>

    <name>ha-track</name>
    <description>Heerwisch / Frau Holle / Nachtkrapp — three independent Java libraries and a shared kernel.</description>
    <url>https://github.com/jbiscella/ha-track</url>

    <licenses>
        <license>
            <name>0BSD</name>
            <url>https://opensource.org/license/0bsd</url>
            <distribution>repo</distribution>
            <comments>BSD Zero Clause License</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Jacopo Biscella</name>
            <url>https://jacopobiscella.net</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/jbiscella/ha-track.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/jbiscella/ha-track.git</developerConnection>
        <url>https://github.com/jbiscella/ha-track</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>25</maven.compiler.release>
        <cucumber.version>7.29.0</cucumber.version>
        <junit.platform.version>1.13.4</junit.platform.version>
        <junit.jupiter.version>5.13.4</junit.jupiter.version>
        <jqwik.version>1.9.2</jqwik.version>
        <jfreechart.version>1.5.6</jfreechart.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
        <japicmp-maven-plugin.version>0.25.6</japicmp-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
        <maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>
        <license-maven-plugin.version>2.7.1</license-maven-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
    </properties>

    <modules>
        <module>commons</module>
        <module>indicators</module>
        <module>heerwisch-api</module>
        <module>heerwisch-jfreechart</module>
        <module>frau-holle</module>
        <module>frau-holle-csv</module>
        <module>frau-holle-eodhd</module>
        <module>nachtkrapp</module>
        <module>dsl-eval</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <!-- Reactor modules -->
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>commons</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>indicators</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>heerwisch-api</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>frau-holle</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>nachtkrapp</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>dsl-eval</artifactId>
                <version>0.57.0-alpha</version>
            </dependency>
            <!-- Shared MarketDataSourceContract suite, consumed by the driver
                 modules' tests. -->
            <dependency>
                <groupId>net.jacopobiscella</groupId>
                <artifactId>frau-holle</artifactId>
                <version>0.57.0-alpha</version>
                <type>test-jar</type>
            </dependency>

            <!-- External libraries -->
            <dependency>
                <groupId>org.jfree</groupId>
                <artifactId>jfreechart</artifactId>
                <version>${jfreechart.version}</version>
            </dependency>
            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-java</artifactId>
                <version>${cucumber.version}</version>
            </dependency>
            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-junit-platform-engine</artifactId>
                <version>${cucumber.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.platform</groupId>
                <artifactId>junit-platform-suite</artifactId>
                <version>${junit.platform.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>net.jqwik</groupId>
                <artifactId>jqwik</artifactId>
                <version>${jqwik.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </plugin>
                <!-- Semantic-versioning enforcement: compares each module's API
                     against its last released artifact and fails the build if the
                     version bump does not match the API change. No-op until the
                     first non-SNAPSHOT release exists as a baseline. -->
                <plugin>
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>${japicmp-maven-plugin.version}</version>
                    <configuration>
                        <oldVersion>
                            <dependency>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <version>RELEASE</version>
                                <type>${project.packaging}</type>
                            </dependency>
                        </oldVersion>
                        <parameter>
                            <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
                            <ignoreMissingOldVersion>true</ignoreMissingOldVersion>
                            <onlyModified>true</onlyModified>
                        </parameter>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>cmp</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Third-party license enumeration. Run manually to regenerate
                     THIRD_PARTY_LICENSES.md:  ./mvnw license:aggregate-add-third-party
                     Rendered as Markdown via src/license/third-party.md.ftl.
                     The notice documents the full license closure of the
                     published artifacts, so the sibling reactor modules (0BSD)
                     are intentionally included as transitive dependencies. -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                    <configuration>
                        <outputDirectory>${maven.multiModuleProjectDirectory}</outputDirectory>
                        <thirdPartyFilename>THIRD_PARTY_LICENSES.md</thirdPartyFilename>
                        <fileTemplate>${maven.multiModuleProjectDirectory}/src/license/third-party.md.ftl</fileTemplate>
                        <includeTransitiveDependencies>true</includeTransitiveDependencies>
                        <sortArtifactByName>true</sortArtifactByName>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.github.siom79.japicmp</groupId>
                <artifactId>japicmp-maven-plugin</artifactId>
            </plugin>
            <!-- Source jars are cheap to generate and are published to Maven
                 Central on every deploy so consumers get IDE-readable API.
                 Javadoc + GPG signing remain in the 'release' profile. -->
            <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>
            <!-- Coverage instrumentation. prepare-agent wires the JaCoCo agent
                 into the surefire argLine; report renders per-module HTML/XML in
                 target/site/jacoco. check enforces a per-module floor at verify.
                 Inherited by every child module (the pom-packaged reactor root is
                 a no-op — no classes, no tests). -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>jacoco-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <!-- Coverage floor. Deliberately conservative: it sits below
                         today's lowest module (frau-holle-eodhd, whose live-API
                         paths are exercised only by the -DskipITs-excluded smoke
                         ITs) so a normal `-DskipITs verify` is green everywhere.
                         The floor is a ratchet — raise it as coverage improves,
                         never lower it. Skipped in the IT-only smoke job via
                         -Djacoco.skip=true (no unit tests run there). -->
                    <execution>
                        <id>jacoco-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.70</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.65</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- Activated only when publishing to Maven Central:  ./mvnw -Prelease deploy
         Plugins requiring deploy-time artifact attachment (javadoc, GPG
         signing) and infrequent execution live here. Source jar generation
         moved to the default build (cheap, and consumers get sources on
         every published artifact).
         Requires a GPG key on the build host and a 'central' server entry
         (Portal user token) in settings.xml. -->
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <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>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <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>false</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
