<?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>de.bsommerfeld.jshepherd</groupId>
        <artifactId>jshepherd</artifactId>
        <version>4.1.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>toml</artifactId>
    <version>4.1.0</version>

    <name>jShepherd TOML</name>
    <description>TOML format support for jShepherd configuration management using tomlj.</description>

    <dependencies>
        <dependency>
            <groupId>org.tomlj</groupId>
            <artifactId>tomlj</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>de.bsommerfeld.jshepherd</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.auto.service</groupId>
            <artifactId>auto-service-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.auto.service</groupId>
            <artifactId>auto-service</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>module-info.class</exclude>
                                        <exclude>META-INF/versions/*/module-info.class</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <relocations>
                                <relocation>
                                    <pattern>org.tomlj</pattern>
                                    <shadedPattern>de.bsommerfeld.jshepherd.toml.shared.tomlj</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.antlr</pattern>
                                    <shadedPattern>de.bsommerfeld.jshepherd.toml.shared.antlr</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.checkerframework</pattern>
                                    <shadedPattern>de.bsommerfeld.jshepherd.toml.shared.checkerframework</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google.auto.service</pattern>
                                    <shadedPattern>de.bsommerfeld.jshepherd.toml.shared.autoservice</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Shade strips module-info.class because it can't relocate module
                 descriptor references. Moditect re-injects a valid descriptor
                 that only references external (non-shaded) modules. -->
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-info</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                            <module>
                                <moduleInfoSource>
                                    module de.bsommerfeld.jshepherd.toml {
                                        exports de.bsommerfeld.jshepherd.toml;
                                        opens de.bsommerfeld.jshepherd.toml to de.bsommerfeld.jshepherd.core;
                                        requires de.bsommerfeld.jshepherd.core;
                                        requires java.logging;
                                        provides de.bsommerfeld.jshepherd.core.PersistenceDelegateFactory
                                                with de.bsommerfeld.jshepherd.toml.TomlPersistenceDelegateFactory;
                                    }
                                </moduleInfoSource>
                            </module>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
