<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>com.magmaguy</groupId>
        <artifactId>ResourcePackManager-parent</artifactId>
        <version>2.4.5</version>
    </parent>

    <artifactId>resourcepackmanager-geyser-bridge</artifactId>

    <dependencyManagement>
        <dependencies>
            <!-- Keep Geyser's provided Netty modules on one patched 4.2 release. -->
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-bom</artifactId>
                <version>4.2.18.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.airlift</groupId>
                <artifactId>aircompressor</artifactId>
                <version>2.0.3</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.geysermc.geyser</groupId>
            <artifactId>api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geysermc.geyser</groupId>
            <artifactId>core</artifactId>
            <version>${geyser.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.magmaguy</groupId>
            <artifactId>resourcepackmanager-bridge-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
    </dependencies>

    <build>
        <!-- Internal build adapter only. It is shaded into the one public
             ResourcePackManager.jar and is never copied or distributed alone. -->
        <finalName>resourcepackmanager-geyser-adapter-internal</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <relocations>
                                <relocation>
                                    <pattern>com.magmaguy.resourcepackmanager.bridge</pattern>
                                    <shadedPattern>com.magmaguy.resourcepackmanager.geyserbridge.libs.bridge</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google.gson</pattern>
                                    <shadedPattern>com.magmaguy.resourcepackmanager.geyserbridge.libs.gson</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>remove-shade-temporary-copy</id>
                        <phase>package</phase>
                        <goals><goal>run</goal></goals>
                        <configuration>
                            <target>
                                <!-- Shade can copy instead of rename on Windows. Its successful
                                     output is already in the stable main artifact at this point. -->
                                <delete file="${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
