<?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>io.karatelabs</groupId>
        <artifactId>karate-parent</artifactId>
        <version>2.1.0</version>
    </parent>

    <artifactId>karate-image</artifactId>
    <packaging>jar</packaging>
    <name>${project.artifactId}</name>
    <description>Karate image-comparison extension (visual regression) — OSS ext</description>

    <dependencies>
        <!-- karate-core is provided: the host project / Rust launcher already has it
             on the classpath. Provided scope keeps it out of the fatjar drop-in too. -->
        <dependency>
            <groupId>io.karatelabs</groupId>
            <artifactId>karate-core</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Server-side pixel-diff engines (jkeys089's own MIT libraries on Maven
             Central). resemble produces the diff image + mismatch %; ssim is the
             alternate structural-similarity engine. Compile scope so they are
             transitive Maven deps and get shaded into the fatjar. -->
        <dependency>
            <groupId>io.github.t12y</groupId>
            <artifactId>resemble</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.t12y</groupId>
            <artifactId>ssim</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Fatjar for ~/.karate/ext/ drop-in (Rust launcher, no Maven). Bundles
             the t12y diff engines + this module; karate-core stays out (provided).
             Build: mvn package -pl karate-image -am -Pfatjar -DskipTests
               →  target/karate-image-X.Y.Z.jar
             Drop-in jars are named per-ext: karate-image-X.Y.Z.jar, karate-max-X.Y.Z.jar,
             etc. The launcher classpaths every ext/*.jar regardless of name. -->
        <profile>
            <id>fatjar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.6.2</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <finalName>karate-image-${project.version}</finalName>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer">
                                        </transformer>
                                    </transformers>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
