<?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">
    <parent>
        <artifactId>quickbuf-parent</artifactId>
        <groupId>us.hebi.quickbuf</groupId>
        <version>1.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>protoc-gen-request</artifactId>

    <properties>
        <protocPluginName>${project.artifactId}</protocPluginName>
        <javaModuleName>us.hebi.quickbuf.parser</javaModuleName>
        <mainClass>us.hebi.quickbuf.parser.SaveRequestPlugin</mainClass>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <!-- Create uber-jar that we can call as a plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
            </plugin>

            <!-- Create wrapper scripts -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>

            <!-- Add native image artifacts (not in -Pnative because the artifacts get copied from CI) -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${finalName}-linux-x86_64.exe</file>
                                    <classifier>linux-x86_64</classifier>
                                    <type>exe</type>
                                </artifact>
                                <artifact>
                                    <file>${project.build.directory}/${finalName}-linux-aarch_64.exe</file>
                                    <classifier>linux-aarch_64</classifier>
                                    <type>exe</type>
                                </artifact>
                                <artifact>
                                    <file>${project.build.directory}/${finalName}-osx-x86_64.exe</file>
                                    <classifier>osx-x86_64</classifier>
                                    <type>exe</type>
                                </artifact>
                                <artifact>
                                    <file>${project.build.directory}/${finalName}-osx-aarch_64.exe</file>
                                    <classifier>osx-aarch_64</classifier>
                                    <type>exe</type>
                                </artifact>
                                <artifact>
                                    <file>${project.build.directory}/${finalName}-windows-x86_64.exe</file>
                                    <classifier>windows-x86_64</classifier>
                                    <type>exe</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- Compile the uber-jar as a native image -->
        <profile>
            <id>makeNative</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.graalvm.buildtools</groupId>
                        <artifactId>native-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>