<?xml version="1.0"?>
<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.mapr.data</groupId>
    <artifactId>mapr-data-root</artifactId>
    <version>3.0.0.0-mapr</version>
    <relativePath>..</relativePath>
  </parent>

  <artifactId>mapr-data-service-launcher</artifactId>
  <name>MapR Data Service - Launcher</name>
  <packaging>jar</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>stage-native-libraries</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <excludeTransitive>true</excludeTransitive>
              <includeArtifactIds>mapr-windows-x86_64,mapr-rhel-x86_64,mapr-ubuntu-x86_64,mapr-mac-x86_64</includeArtifactIds>
              <outputDirectory>${project.build.directory}/staged_libs</outputDirectory>
              <overWriteSnapshots>true</overWriteSnapshots>
              <overWriteReleases>true</overWriteReleases>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>build-dir</id>
      <activation><property><name>dir</name></property></activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>assemble-dir</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/bin-dir.xml</descriptor>
                  </descriptors>
                  <attach>false</attach>
                  <appendAssemblyId>false</appendAssemblyId>
                  <finalName>mapr-data-service</finalName>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>build-packages</id>
      <activation><property><name>!dir</name></property></activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>assemble-tar</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/bin-tar.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>false</appendAssemblyId>
                  <finalName>mapr-data-service-${project.version}</finalName>
                  <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.mapr.data</groupId>
      <artifactId>mapr-data-service</artifactId>
      <version>${mapr.data.protocol.version}</version>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.mapr.data</groupId>
      <artifactId>mapr-simulated-ojai-driver</artifactId>
      <version>${mapr.data.protocol.version}</version>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.11.1</version><!--$NO-MVN-MAN-VER$-->
    </dependency>

    <dependency>
      <groupId>com.mapr.fs.native</groupId>
      <artifactId>mapr-windows-x86_64</artifactId>
      <version>${mapr.version}</version>
      <type>dll</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.mapr.fs.native</groupId>
      <artifactId>mapr-rhel-x86_64</artifactId>
      <version>${mapr.version}</version>
      <type>so</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.mapr.fs.native</groupId>
      <artifactId>mapr-ubuntu-x86_64</artifactId>
      <version>${mapr.version}</version>
      <type>so</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.mapr.fs.native</groupId>
      <artifactId>mapr-mac-x86_64</artifactId>
      <version>${mapr.version}</version>
      <type>dylib</type>
      <scope>provided</scope>
    </dependency>
  </dependencies>

</project>
