<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>eu.virtualparadox</groupId>
    <artifactId>vp-build</artifactId>
    <version>1.0.0-RC2</version>
    <packaging>pom</packaging>

    <name>Virtual Paradox Build Aggregator</name>
    <description>Release-only reactor aggregator for the eu.virtualparadox build stack: builds and publishes build-config (rule files) and parent (quality-gate parent POM). NOT a consumer parent - downstream projects set their &lt;parent&gt; to eu.virtualparadox:parent, never to this aggregator.</description>
    <url>https://github.com/virtualparadoxorg/parent</url>
    <inceptionYear>2026</inceptionYear>

    <organization>
        <name>Virtual Paradox</name>
        <url>https://virtualparadox.eu</url>
    </organization>

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

    <developers>
        <developer>
            <id>tothpeter</id>
            <name>Péter Tóth</name>
            <email>peter.toth@virtualparadox.eu</email>
            <organization>Virtual Paradox</organization>
            <organizationUrl>https://virtualparadox.eu</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/virtualparadoxorg/parent.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/virtualparadoxorg/parent.git</developerConnection>
        <url>https://github.com/virtualparadoxorg/parent</url>
        <tag>HEAD</tag>
    </scm>

    <!--
        Reactor order matters: build-config (the rule-file jar) must build BEFORE parent,
        because parent's quality-gate plugins resolve build-config from the reactor. build-config
        does NOT inherit parent (it inherits this gate-free aggregator), so it builds first with
        nothing pre-installed - breaking the old circular dependency. it/sample-consumer is built
        locally to prove a fork needs only <parent>; it is never deployed.
    -->
    <!--
        it/sample-consumer is deliberately NOT a module of this published reactor: it must never be
        deployed to Central, and the central-publishing plugin would otherwise try to publish it.
        It is a standalone gate-verification harness, built separately in CI (see ci.yml).
    -->
    <modules>
        <module>build-config</module>
        <module>parent</module>
    </modules>

    <distributionManagement>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com/api/v1/publisher/upload</url>
        </repository>
    </distributionManagement>

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

        <maven.gpg.plugin.version>3.2.8</maven.gpg.plugin.version>
        <central.publishing.plugin.version>0.10.0</central.publishing.plugin.version>
    </properties>

    <profiles>
        <!--
            Release to Maven Central via the Sonatype Central Portal.
            Activated on tag builds: ./mvnw -Prelease deploy
            Credentials come from settings.xml (server id 'central' + active 'gpg' profile);
            CI writes that settings.xml from the org-level secrets.
            The sample-consumer integration module is never deployed (skip configured in it).
        -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <configuration>
                            <keyname>0C4238D5A8FF369A</keyname>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <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.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
