<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  Copyright 2021 Goldman Sachs
  ~
  ~  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">
    <parent>
        <groupId>org.finos.legend.depot</groupId>
        <artifactId>legend-depot</artifactId>
        <version>2.93.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <name>Legend Depot - Server</name>
    <artifactId>legend-depot-server</artifactId>
    <packaging>jar</packaging>

    <properties>
        <mainClass>org.finos.legend.depot.server.LegendDepotServer</mainClass>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- DEPOT -->
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-servers-common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-metrics-query-services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-metrics-query-store-mongo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-core-schedules</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-core-schedules-store-mongo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-core-data-services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-core-data-store-mongo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-entities-services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-pure-model-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-notifications-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-entities-store-mongo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-generations-services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-generations-store-mongo</artifactId>
        </dependency>
        <!-- DEPOT -->


        <!-- SHARED -->
        <dependency>
            <groupId>org.finos.legend.shared</groupId>
            <artifactId>legend-shared-pac4j-gitlab</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- SHARED -->

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.depot</groupId>
            <artifactId>legend-depot-notifications-queue-mongo</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>docker</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>tag</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <tag>${project.version}</tag>
                            <username>${env.DOCKER_USERNAME}</username>
                            <password>${env.DOCKER_PASSWORD}</password>
                            <repository>registry.hub.docker.com/${env.DOCKER_USERNAME}/${project.artifactId}</repository>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>docker-snapshot</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>tag</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <tag>snapshot</tag>
                            <username>${env.DOCKER_USERNAME}</username>
                            <password>${env.DOCKER_PASSWORD}</password>
                            <repository>registry.hub.docker.com/${env.DOCKER_USERNAME}/${project.artifactId}</repository>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
