<?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.server</groupId>
        <artifactId>bitbucket-scm-parent</artifactId>
        <version>9.6.1</version>
    </parent>

    <artifactId>bitbucket-git</artifactId>

    <name>Bitbucket Server - Git SCM</name>
    <description>Provides support for the Git SCM</description>

    <properties>
        <!-- excludedGroups is used to skip slow tests when building on the command line. The setting is overridden in
             CI to ensure all tests are run -->
        <surefire.excludedGroups>com.atlassian.bitbucket.junit.OnlyInCi</surefire.excludedGroups>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-git-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-git-binary</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-git-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-git-mesh</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-mesh-callback</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-platform</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-process-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-process</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-scm-cache</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-scm-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-service-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-web-common</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.support</groupId>
            <artifactId>stp-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.util</groupId>
            <artifactId>content-cache</artifactId>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue-retry</artifactId>
        </dependency>
        <dependency>
            <groupId>io.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>nuprocess</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-tcnative-boringssl-static</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-epoll</artifactId>
            <classifier>linux-x86_64</classifier>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>

        <!-- Repositories with fixed test data -->
        <dependency>
            <groupId>com.atlassian.bitbucket.server.git</groupId>
            <artifactId>gpg-sanity</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server.git</groupId>
            <artifactId>ref-sanity</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>binary-files-repository</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>comment-drift</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>default-repository</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>diff-tree</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>garbage</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>mailmap</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>merge</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>merge-commits</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>pull-requests</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>qa-resources</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>subrepositories</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.stash.git</groupId>
            <artifactId>suggestion-drift</artifactId>
            <type>zip</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.bitbucket.mesh</groupId>
            <artifactId>mesh-app</artifactId>
            <scope>test</scope>
            <!-- We need mesh-app in our dependencies to ensure we can copy it in with the dependency plugin,
                 but we don't want Mesh's codebase (or transitive dependencies) on our classpath. -->
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.mesh</groupId>
            <artifactId>mesh-test-cluster</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-branch</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-scm-test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-service-impl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-ssh</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-suggestions</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-test-util</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-memory</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock-jre8</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.schlichtherle.truezip</groupId>
            <artifactId>truezip-file</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.schlichtherle.truezip</groupId>
            <artifactId>truezip-driver-zip</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.schlichtherle.truezip</groupId>
            <artifactId>truezip-driver-tar</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-text-patterns</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>bitbucket-plugin.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>bitbucket-plugin.xml</exclude>
                </excludes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/main/templates</directory>
                <excludes>
                    <exclude>config</exclude>
                </excludes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-scripts</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <attach>false</attach>
                            <descriptors>
                                <descriptor>src/main/assembly/scripts.xml</descriptor>
                            </descriptors>
                            <finalName>scripts</finalName>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package-templates</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <attach>false</attach>
                            <descriptors>
                                <descriptor>src/main/assembly/templates.xml</descriptor>
                            </descriptors>
                            <finalName>templates</finalName>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-mesh</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.bitbucket.mesh</groupId>
                                    <artifactId>mesh-app</artifactId>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.testOutputDirectory}/mesh</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-repositories</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeArtifactIds>git</excludeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                            <includeScope>test</includeScope>
                            <includeTypes>zip</includeTypes>
                            <outputDirectory>${project.build.testOutputDirectory}/git</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${surefire.argLine}</argLine>
                    <excludedGroups>${surefire.excludedGroups}</excludedGroups>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ci</id>
            <properties>
                <!-- Include all tests -->
                <surefire.excludedGroups />
            </properties>
        </profile>
        <profile>
            <id>full</id>
            <properties>
                <!-- Run all tests -->
                <surefire.excludedGroups />
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <!-- To simplify deploying the correct version of Mesh with Bitbucket Server, copy
                                 its distribution to target/ so Bamboo can attach it as a build artifact -->
                            <execution>
                                <id>copy-mesh-distribution-and-source</id>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <phase>prepare-package</phase>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>com.atlassian.bitbucket.mesh</groupId>
                                            <artifactId>mesh-distribution</artifactId>
                                            <version>${atl.mesh.libversion}</version>
                                            <type>zip</type>
                                            <destFileName>
                                                bitbucket-mesh-distribution-${atl.mesh.libversion}.zip
                                            </destFileName>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.atlassian.bitbucket.mesh</groupId>
                                            <artifactId>mesh-distribution</artifactId>
                                            <version>${atl.mesh.libversion}</version>
                                            <type>tar.gz</type>
                                            <destFileName>
                                                bitbucket-mesh-distribution-${atl.mesh.libversion}.tar.gz
                                            </destFileName>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.atlassian.bitbucket.mesh</groupId>
                                            <artifactId>mesh-distribution-source</artifactId>
                                            <version>${atl.mesh.libversion}</version>
                                            <type>zip</type>
                                            <classifier>source</classifier>
                                            <destFileName>
                                                bitbucket-mesh-source-${atl.mesh.libversion}.zip
                                            </destFileName>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Mesh will not support Windows, so running its tests there only serves to make the Windows builds
                 slower and create test failures we don't actually need to fix. This profile excludes tests with
                 @Category(MeshTestWiring.class), which is expected to be on all Mesh-related tests. -->
            <id>skip-mesh-tests-on-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <surefire.excludedGroups>com.atlassian.stash.internal.scm.git.mesh.MeshTestWiring</surefire.excludedGroups>
            </properties>
        </profile>
    </profiles>
</project>
