<?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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.bitbucket.mesh</groupId>
        <artifactId>mesh-distribution-parent</artifactId>
        <version>2.2.0-m6</version>
    </parent>

    <artifactId>mesh-distribution-source</artifactId>
    <packaging>pom</packaging>

    <name>Bitbucket Mesh - Source Distribution</name>

    <properties>
        <parent.root.dir>${basedir}/../..</parent.root.dir>
        <mesh.checkout.dir>${basedir}/target/checkouts/mesh-parent</mesh.checkout.dir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.bitbucket.mesh</groupId>
            <artifactId>mesh-distribution-licenses</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.bitbucket.mesh</groupId>
            <artifactId>mesh-parent</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>

    <build>
        <finalName>bitbucket-mesh</finalName>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>atlassian-source-distribution-maven-plugin</artifactId>
                <version>5.0.3</version>
                <executions>
                    <execution>
                        <id>source-release</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>source</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <baseProject>com.atlassian.bitbucket.mesh:mesh-parent</baseProject>
                    <!--generate the build command-->
                    <finalMavenBuildCommands>
                        <finalMavenBuildCommand>
                            <!-- The source distribution plugin only accepts specific versions.
                                 See https://bitbucket.org/atlassian/source-distribution-maven-plugin/src/master/src/main/java/com/atlassian/distribution/MavenVersion.java -->
                            <mavenVersion>3.8.3</mavenVersion>
                            <cmdArgs>clean install -f mesh-parent/pom.xml "-Pfull"</cmdArgs>
                        </finalMavenBuildCommand>
                    </finalMavenBuildCommands>
                    <useReactor>true</useReactor>
                    <excludedArtifacts>
                        <!-- the following dependencies' source jars are not in maven.a.c -->
                        <excludedArtifact>com.atlassian.bitbucket.server:bitbucket-mesh-callback</excludedArtifact>
                    </excludedArtifacts>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <finalName>${project.build.finalName}-${project.version}</finalName>
                </configuration>
                <executions>
                    <execution>
                        <id>source</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/source.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
