<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->

<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>org.wildfly.core</groupId>
        <artifactId>wildfly-core-parent</artifactId>
        <version>27.1.10.Final-redhat-00001</version>
    </parent>

    <artifactId>wildfly-core-dist</artifactId>
    <name>WildFly Core: Distribution</name>
    <packaging>pom</packaging>
    <dependencies>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-core-galleon-pack</artifactId>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
    <build>
        <finalName>${server.output.dir.prefix}-${wildfly.core.release.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.jboss.galleon</groupId>
                <artifactId>galleon-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>server-provisioning</id>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <configuration>
                            <install-dir>${project.build.directory}/${project.build.finalName}</install-dir>
                            <record-state>false</record-state>
                            <log-time>${galleon.log.time}</log-time>
                            <offline>true</offline>
                            <plugin-options>
                                <jboss-fork-embedded>${galleon.fork.embedded}</jboss-fork-embedded>
                            </plugin-options>
                            <feature-packs>
                                <feature-pack>
                                    <groupId>org.wildfly.core</groupId>
                                    <artifactId>wildfly-core-galleon-pack</artifactId>
                                    <version>${project.version}</version>
                                </feature-pack>
                            </feature-packs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>verifications-configuration</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>process-classes</phase>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${basedir}/target/verifier</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/verifier</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-verifier-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>assemble</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>assembly.xml</descriptor>
                                    </descriptors>
                                    <recompressZippedFiles>true</recompressZippedFiles>
                                    <finalName>${project.build.finalName}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <workDirectory>${project.build.directory}/assembly/work</workDirectory>
                                    <tarLongFileMode>gnu</tarLongFileMode>
                                </configuration>
                            </execution>
                            <execution>
                                <id>assemble-src</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>assembly-src.xml</descriptor>
                                    </descriptors>
                                    <finalName>${project.build.finalName}</finalName>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <workDirectory>${project.build.directory}/assembly-src/work</workDirectory>
                                    <tarLongFileMode>gnu</tarLongFileMode>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
