<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ SPDX-FileCopyrightText: The devcontainer.java Authors
  ~ SPDX-License-Identifier: 0BSD
  -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <!-- ordering follows https://maven.apache.org/developers/conventions/code.html#POM_Code_Convention -->

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                                 PARENT                                  -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Inheritance -->
    <parent>
        <groupId>wtf.metio.maven</groupId>
        <artifactId>maven-parent</artifactId>
        <version>2026.5.29</version>
    </parent>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                               COORDINATES                               -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Maven_Coordinates -->
    <groupId>wtf.metio.devcontainer</groupId>
    <artifactId>devcontainer.java</artifactId>
    <version>2026.6.12</version>
    <packaging>jar</packaging>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                               INFORMATIONS                              -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#More_Project_Information -->
    <name>devcontainer.java</name>
    <description>Java implementation of the devcontainer file specification</description>
    <url>https://github.com/metio/devcontainer.java</url>
    <inceptionYear>2022</inceptionYear>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                                    SCM                                  -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#SCM -->
    <scm>
        <connection>scm:git:git@github.com:metio/devcontainer.java.git</connection>
        <developerConnection>scm:git:git@github.com:metio/devcontainer.java.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/metio/devcontainer.java</url>
    </scm>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                             ISSUE MANAGEMENT                            -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Issue_Management -->
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/metio/devcontainer.java/issues</url>
    </issueManagement>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                                PROPERTIES                               -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Properties -->
    <properties>
        <global.jdkVersion>25</global.jdkVersion>
        <version.jackson>3.2.0</version.jackson>
        <version.record-builder>52</version.record-builder>
        <version.junit>6.1.0</version.junit>
    </properties>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                          DEPENDENCY MANAGEMENT                          -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Dependency_Management -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>tools.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${version.jackson}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.junit}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--                               DEPENDENCIES                              -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- https://maven.apache.org/pom.html#Dependencies -->
    <dependencies>
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>io.soabase.record-builder</groupId>
            <artifactId>record-builder-core</artifactId>
            <version>${version.record-builder}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>io.soabase.record-builder</groupId>
                            <artifactId>record-builder-processor</artifactId>
                            <version>${version.record-builder}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <!-- Declaring the plugin activates the parent's managed check + cpd-check executions (both
                 bound to verify). PMD 7.x is pinned because the bundled engine must parse JDK 25 sources;
                 the focused ruleset keeps violations actionable. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <configuration>
                    <printFailingErrors>true</printFailingErrors>
                    <failOnViolation>true</failOnViolation>
                    <minimumTokens>100</minimumTokens>
                    <rulesets>
                        <ruleset>config/pmd/ruleset.xml</ruleset>
                    </rulesets>
                    <!-- record-builder emits many near-identical wither methods; analysing that
                         generated source only produces noise, so it is left out of source and CPD scans. -->
                    <excludeRoots>
                        <excludeRoot>${project.build.directory}/generated-sources/annotations</excludeRoot>
                    </excludeRoots>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sourceforge.pmd</groupId>
                        <artifactId>pmd-core</artifactId>
                        <version>7.25.0</version>
                    </dependency>
                    <dependency>
                        <groupId>net.sourceforge.pmd</groupId>
                        <artifactId>pmd-java</artifactId>
                        <version>7.25.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- The parent only manages the SpotBugs version; this binds its analysis to verify. The
                 exclude filter drops findings inherent to an immutable record data model (records that
                 hold List/Map necessarily expose them through the canonical accessor/constructor). -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <effort>Max</effort>
                    <excludeFilterFile>config/spotbugs/exclude.xml</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Declaring the plugin activates the parent's managed JaCoCo agent + check executions, which
                 gate verify at 100% coverage (jacoco.minCoverage). The only configuration needed here is the
                 exclude set: the record-builder *Builder classes are generated (not ours to test, mirroring
                 the PMD/SpotBugs stance) and the native smoke stand-in runs as a native executable rather
                 than under the agent, so both are kept out of the coverage analysis. -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*Builder.class</exclude>
                        <exclude>**/*Builder$*.class</exclude>
                        <exclude>**/NativeImageSmokeTest.class</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Verifies the library can be consumed by a GraalVM native image. The profile compiles a
             stand-in consumer (src/native/java), builds it into a native image the same way a
             downstream project such as ilo would, and runs it. Building exercises the records and
             reflect-config.json; running surfaces any missing runtime reflection metadata. The
             stand-in source is only added here, so it stays out of the published jar. -->
        <profile>
            <id>native</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.1</version>
                        <executions>
                            <execution>
                                <id>add-native-smoke-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/native/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <imageName>devcontainer-native-smoke</imageName>
                            <mainClass>wtf.metio.devcontainer.NativeImageSmokeTest</mainClass>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-native-smoke</id>
                                <goals>
                                    <goal>compile-no-fork</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>run-native-smoke</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>${project.build.directory}/devcontainer-native-smoke</executable>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
