<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.3.1</version>
    </parent>

    <artifactId>resourcepackmanager-velocity</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.velocitypowered</groupId>
            <artifactId>velocity-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geysermc.geyser</groupId>
            <artifactId>api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.magmaguy</groupId>
            <artifactId>resourcepackmanager-proxy-common</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <build>
        <!-- Internal platform-adapter jar consumed by the universal
             ResourcePackManager.jar. The stable filename keeps local testbed links
             from churning, but this module no longer mirrors a public dist artifact. -->
        <finalName>resourcepackmanager-velocity</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths combine.children="append">
                        <path>
                            <groupId>com.velocitypowered</groupId>
                            <artifactId>velocity-api</artifactId>
                            <version>${velocity.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>verify-generated-velocity-descriptor-version</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <loadfile property="velocity.descriptor"
                                          srcFile="${project.build.outputDirectory}/velocity-plugin.json"/>
                                <condition property="velocity.descriptor.version.matches">
                                    <contains string="${velocity.descriptor}"
                                              substring="&quot;version&quot;:&quot;${project.version}&quot;"/>
                                </condition>
                                <fail unless="velocity.descriptor.version.matches"
                                      message="Generated velocity-plugin.json version must match ${project.version}"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
