<?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>

    <parent>
        <groupId>com.netmoor.moorhaven</groupId>
        <artifactId>moorhaven-parent</artifactId>
        <version>0.4.0-SNAPSHOT</version>
    </parent>

    <artifactId>moorhaven-onnxruntime-slim</artifactId>
    <name>Moorhaven :: ONNX Runtime (slim)</name>
    <description>
        com.microsoft.onnxruntime:onnxruntime repacked for one target platform. The upstream jar carries five
        platforms plus a 300 MB win-x64 .pdb; the native.platform profiles in the parent pick what to keep
        (property native.onnxruntime.excludes). Same ai.onnxruntime API, so it is a drop-in replacement.
    </description>

    <properties>
        <!-- SpotBugs/FindSecBugs skip: this module only repacks third-party ai.onnxruntime.* (onnxruntime) classes
             for one target platform (see description) and contains no project code, so findings
             there are not ours to fix. Upstream advisories are covered by the Trivy fat-jar scan.
             Added 2026-09-20 (#38); revisit 2026-12-20 or when the repack starts adding own classes. -->
        <spotbugs.skip>true</spotbugs.skip>
        <!-- Coverage ratchet (#50): repacked third-party bytecode only, no project code to
             exercise (see doc/coverage-baseline.md) — stays at the parent default. -->
        <jacoco.min>0.00</jacoco.min>
    </properties>

    <build>
        <plugins>
            <!-- The unpacked tree depends on the native-* profile, not on any source file, so an
                 incremental build after switching profile would keep the previous platform's files.
                 Always start from an empty target/. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <configuration>
                    <skip>${native.slim.install.skip}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>${native.slim.install.skip}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>reset-target</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-onnxruntime</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.microsoft.onnxruntime</groupId>
                                    <artifactId>onnxruntime</artifactId>
                                    <version>${onnxruntime.version}</version>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <excludes>${native.onnxruntime.excludes}</excludes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <native.excludes>${native.onnxruntime.excludes}</native.excludes>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
