<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014-2022 JKOOL, LLC.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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.jkoolcloud</groupId>
        <artifactId>tnt4j</artifactId>
        <version>2.15.2</version>
    </parent>
    <packaging>pom</packaging>

    <artifactId>tnt4j--distribution</artifactId>

    <properties>
        <release.deploy.name>${project.parent.artifactId}</release.deploy.name>
        <release.deploy.dir>../build/</release.deploy.dir>
        <release.deploy.finalName>${release.deploy.name}-${project.version}</release.deploy.finalName>
        <release.deploy.zip.assembly>src/assembly/zipDeployAssembly.xml</release.deploy.zip.assembly>
        <release.deploy.gz.assembly>src/assembly/gzDeployAssembly.xml</release.deploy.gz.assembly>
        <release.deploy.dir.assembly>src/assembly/dirDeployAssembly.xml</release.deploy.dir.assembly>
        <build.assemblies.attach>false</build.assemblies.attach>

        <assembly.line.endings>unix</assembly.line.endings>

        <maven.javadoc.skip>true</maven.javadoc.skip>
        <!-- TODO: skip this module from deployment staging -->
        <!--<skipStaging>true</skipStaging>-->
    </properties>

    <profiles>
        <profile>
            <id>win-ln</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <assembly.line.endings>crlf</assembly.line.endings>
            </properties>
        </profile>
    </profiles>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
                <inherited>false</inherited>
                <configuration>
                    <skip>${assembly.skipAssembly}</skip>
                    <filesets>
                        <fileset>
                            <directory>${release.deploy.dir}</directory>
                            <includes>
                                <include>${release.deploy.finalName}/</include>
                                <include>${release.deploy.finalName}.*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>make-deploy-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>${release.deploy.dir.assembly}</descriptor>
                                <descriptor>${release.deploy.zip.assembly}</descriptor>
                                <descriptor>${release.deploy.gz.assembly}</descriptor>
                            </descriptors>
                            <outputDirectory>${release.deploy.dir}</outputDirectory>
                            <attach>${build.assemblies.attach}</attach>
                            <finalName>${release.deploy.finalName}</finalName>
                            <tarLongFileMode>gnu</tarLongFileMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- Just to make sure distribution assemblies are made after all modules have been built -->
    <!-- It is enough to have dependency to single (mandatory) module to have modules correctly ordered by Maven -->
    <dependencies>
        <dependency>
            <groupId>com.jkoolcloud</groupId>
            <artifactId>tnt4j-core</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</project>