<?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>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-build-parent</artifactId>
        <version>999-SNAPSHOT</version>
        <relativePath>../../build-parent/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>io.quarkus.gradle.plugin</artifactId>
    <packaging>pom</packaging>
    <name>Quarkus - Gradle Plugin</name>
    <description>Quarkus - Gradle Plugin</description>

    <properties>
        <gradle.executable>./gradlew</gradle.executable>
        <gradle.task>build</gradle.task>
        <skip.gradle.build>false</skip.gradle.build>
    </properties>

    <dependencies>
        <!-- Compile -->
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-bootstrap-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devtools-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-development-mode</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-platform-descriptor-json</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-platform-descriptor-resolver-json</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>gradle</id>
                        <phase>prepare-package</phase>
                        <configuration>
                            <executable>${gradle.executable}</executable>
                            <arguments>
                                <argument>clean</argument>
                                <argument>${gradle.task}</argument>
                                <argument>-Pdescription=${project.description}</argument>
                                <argument>-S</argument>
                                <argument>--stacktrace</argument>
                            </arguments>
                            <environmentVariables>
                                <MAVEN_LOCAL_REPO>${settings.localRepository}</MAVEN_LOCAL_REPO>
                                <GRADLE_OPTS>${env.MAVEN_OPTS}</GRADLE_OPTS>
                            </environmentVariables>
                            <skip>${skip.gradle.build}</skip>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <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>build/libs/quarkus-gradle-plugin-${project.version}.jar</file>
                                    <type>jar</type>
                                </artifact>
                                <artifact>
                                    <file>build/libs/quarkus-gradle-plugin-${project.version}-javadoc.jar</file>
                                    <type>jar</type>
                                    <classifier>javadoc</classifier>
                                </artifact>
                                <artifact>
                                    <file>build/libs/quarkus-gradle-plugin-${project.version}-sources.jar</file>
                                    <type>jar</type>
                                    <classifier>sources</classifier>
                                </artifact>
                            </artifacts>
                            <skipAttach>${skip.gradle.build}</skipAttach>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Do not deploy this project-->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <configuration>
                    <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <gradle.executable>gradlew.bat</gradle.executable>
            </properties>
        </profile>
        <profile>
            <id>skipTests</id>
            <activation>
                <property>
                    <name>skipTests</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <gradle.task>assemble</gradle.task>
            </properties>
        </profile>
    </profiles>
</project>
