<?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>org.pragmatica-lite</groupId>
    <artifactId>peglib-parent</artifactId>
    <version>0.7.2</version>
    <packaging>pom</packaging>

    <name>Peglib Parent</name>
    <description>Multi-module parent POM for peglib PEG parser library</description>
    <url>https://github.com/siy/java-peglib</url>

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

    <developers>
        <developer>
            <id>siy</id>
            <name>Sergiy Yevtushenko</name>
            <url>https://github.com/siy</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/siy/java-peglib.git</connection>
        <developerConnection>scm:git:ssh://github.com:siy/java-peglib.git</developerConnection>
        <url>https://github.com/siy/java-peglib</url>
    </scm>

    <modules>
        <module>peglib-runtime</module>
        <module>peglib-core</module>
        <module>peglib-formatter</module>
        <module>peglib-maven-plugin</module>
        <module>peglib-playground</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>25</maven.compiler.release>
        <pragmatica-lite.version>1.0.0-rc2</pragmatica-lite.version>
        <jbct.version>1.0.0-rc2</jbct.version>
        <!-- Default: lint is ON for the whole reactor. Override with -Djbct.skip=true. -->
        <jbct.skip>false</jbct.skip>
        <junit.version>5.11.0</junit.version>
        <assertj.version>3.26.0</assertj.version>
        <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
        <maven.surefire.plugin.version>3.5.0</maven.surefire.plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>peglib-runtime</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>peglib</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>peglib-formatter</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>core</artifactId>
                <version>${pragmatica-lite.version}</version>
            </dependency>
            <dependency>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>jackson</artifactId>
                <version>${pragmatica-lite.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.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>

    <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>
            </plugins>
        </pluginManagement>

        <!-- JBCT lint + format, inherited by every module.
             0.7.0: the 0.5.x legacy path is gone, so there is no longer an exempt
             subtree — the whole reactor is linted. No sourceDirectory override. -->
        <plugins>
            <plugin>
                <groupId>org.pragmatica-lite</groupId>
                <artifactId>jbct-maven-plugin</artifactId>
                <version>${jbct.version}</version>
                <configuration>
                    <skip>${jbct.skip}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- Source JAR -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Javadoc JAR -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <doclint>none</doclint>
                            <failOnError>false</failOnError>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- GPG Signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.7</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Central Publishing -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <!-- 0.11.0: 0.6.0 cannot deserialize Central's current publish response.
                             During the 0.7.0 release the bundle uploaded and auto-published
                             correctly, then the plugin threw
                             UnrecognizedPropertyException: Unrecognized field "warnings"
                             while polling for confirmation, reporting BUILD FAILURE for a
                             release that had in fact succeeded. -->
                        <version>0.11.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>published</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
