<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-devtools-all</artifactId>
        <version>1.13.3.Final</version>
    </parent>

    <artifactId>quarkus-platform-descriptor-json</artifactId>
    <name>Quarkus - Dev tools - Platform Descriptor - JSON</name>

    <properties>
        <gradle-wrapper.path>${project.basedir}/../gradle</gradle-wrapper.path>
        <gradle.executable>gradlew</gradle.executable>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/filtered</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-bom</id>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>io.quarkus</groupId>
                                    <artifactId>quarkus-bom</artifactId>
                                    <version>${project.version}</version>
                                    <type>pom</type>
                                    <outputDirectory>${project.build.outputDirectory}/quarkus-bom</outputDirectory>
                                    <destFileName>pom.xml</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-bom-descriptor-json</id>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>io.quarkus</groupId>
                                    <artifactId>quarkus-bom-quarkus-platform-descriptor</artifactId>
                                    <version>${project.version}</version>
                                    <type>json</type>
                                    <classifier>${project.version}</classifier>
                                    <outputDirectory>${project.build.outputDirectory}/quarkus-bom-descriptor</outputDirectory>
                                    <destFileName>extensions.json</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-gradle-wrapper</id>
                        <phase>prepare-package</phase>
                        <configuration>
                            <executable>${gradle-wrapper.path}/${gradle.executable}</executable>
                            <environmentVariables>
                                <!-- Force a higher value than the default 64m, used by
                                 gradlew script, to make sure the no-daemon option is honoured
                                -->
                                <JAVA_OPTS>-Xmx512m</JAVA_OPTS>
                            </environmentVariables>
                            <arguments>
                                <argument>wrapper</argument>
                                <argument>--no-daemon</argument>
                                <argument>--gradle-version</argument>
                                <argument>${gradle-wrapper.version}</argument>
                            </arguments>
                            <workingDirectory>target/classes/gradle-wrapper</workingDirectory>
                            <addOutputToClasspath>true</addOutputToClasspath>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-bom-quarkus-platform-descriptor</artifactId>
            <version>${project.version}</version>
            <type>json</type>
            <classifier>${project.version}</classifier>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <gradle.executable>gradlew.bat</gradle.executable>
            </properties>
        </profile>
    </profiles>
</project>
