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

    <parent>
        <groupId>dev.jcputney</groupId>
        <artifactId>magika-java-parent</artifactId>
        <version>0.4.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>magika-java</artifactId>
    <packaging>jar</packaging>

    <name>magika-java</name>
    <description>Clean-room Java binding for Google Magika ONNX file-type detection. Independent community binding — not official, not endorsed by Google.</description>

    <dependencies>
        <dependency>
            <groupId>com.microsoft.onnxruntime</groupId>
            <artifactId>onnxruntime</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>

        <!--
          JMH (test-scope, always on classpath).

          Benchmarks live under src/test/java/dev/jcputney/magika/perf/. JMH's annotation
          processor needs jmh-generator-annprocess available at test-compile time so the
          BenchmarkList resource and synthetic *_jmhType / *_jmhTest classes are generated.
          Surefire's default include pattern (*Test.java etc.) does NOT match *Benchmark.java
          so the generated test wrappers are not run by mvn test.

          The perf Maven profile adds the jmh-maven-plugin so benchmarks can be invoked via
          mvn -P perf jmh:benchmark. See docs/perf.md.
        -->
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <configuration>
                    <projectsDirectory>src/it</projectsDirectory>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                </configuration>
                <executions>
                    <execution>
                        <id>jpms-consumer-it</id>
                        <goals>
                            <goal>install</goal>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
          Performance benchmarks (JMH).

          Activate with: mvn -P perf jmh:benchmark
          Filter:        mvn -P perf jmh:benchmark -Djmh.benchmarks=IdentifyBytes.*

          Benchmarks live under src/test/java/dev/jcputney/magika/perf/. Default
          mvn verify does NOT run them — surefire only matches *Test/*Tests classes
          and JMH benchmarks are *Benchmark, so they're skipped naturally.

          See docs/perf.md for methodology and caveats.
        -->
        <profile>
            <id>perf</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>pw.krejci</groupId>
                        <artifactId>jmh-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
