<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
  license agreements. See the NOTICE file distributed with this work for additional 
  information regarding copyright ownership. The ASF licenses this file to 
  You 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>
    <artifactId>drill-root</artifactId>
    <groupId>org.apache.drill</groupId>
    <version>0.5.0-incubating</version>
  </parent>

  <artifactId>distribution</artifactId>
  <packaging>pom</packaging>
  <name>Packaging and Distribution Assembly</name>


  <dependencies>
    <dependency>
      <groupId>sqlline</groupId>
      <artifactId>sqlline</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.drill</groupId>
      <artifactId>drill-protocol</artifactId>
      <version>${project.version}</version>
      <classifier>rebuffed</classifier>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.contrib.data</groupId>
      <artifactId>tpch-sample-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-java-exec</artifactId>
      <version>${project.version}</version>
      <classifier>rebuffed</classifier>
    </dependency>
    <dependency>
      <groupId>org.apache.drill</groupId>
      <artifactId>drill-common</artifactId>
      <version>${project.version}</version>
      <classifier>rebuffed</classifier>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-jdbc</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-jdbc-all</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.contrib.storage-hive</groupId>
      <artifactId>drill-storage-hive-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.contrib</groupId>
      <artifactId>drill-storage-hbase</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>


    <dependency>
      <groupId>de.huxhorn.lilith</groupId>
      <artifactId>de.huxhorn.lilith.logback.appender.multiplex-classic</artifactId>
      <version>0.9.44</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
            <execution>
                <id>distro-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <descriptors>
                        <descriptor>src/assemble/bin.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>apache-drill-${project.version}</finalName>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
            </execution>
        </executions>
    </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <excludes>
            <exclude>**/conffiles</exclude>
            <exclude>**/git.properties</exclude>
            <exclude>**/control</exclude>
            <exclude>**/*.checkstyle</exclude>
            <exclude>**/*.json</exclude>
            <exclude>**/README.md</exclude>
            <exclude>**/hadoop-excludes.txt</exclude>
          </excludes>
        </configuration>
      </plugin>

    </plugins>
  </build>
  <profiles>
    <profile>
      <id>default-hadoop</id>
      <activation>
        <property>
          <name>!alt-hadoop</name>
        </property>
      </activation>
      <dependencies>
      </dependencies>
      <build>
      </build>
    </profile>
    <profile>
      <id>mapr</id>
      <dependencies>

        <dependency>
          <groupId>com.mapr.hadoop</groupId>
          <artifactId>maprfs</artifactId>
        </dependency>
        <dependency>
          <groupId>com.mapr.hadoop</groupId>
          <artifactId>maprfs</artifactId>
        </dependency>
        <dependency>
          <groupId>com.mapr.fs</groupId>
          <artifactId>libprotodefs</artifactId>
        </dependency>
        <dependency>
          <groupId>com.mapr.fs</groupId>
          <artifactId>mapr-hbase</artifactId>
        </dependency>

      </dependencies>
      <build>
      </build>
    </profile>
    <profile>
      <id>rpm</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1-alpha-3</version>
            <executions>
              <execution>
                <id>generate-rpm</id>
                <goals>
                  <goal>rpm</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <copyright>2013 ASF</copyright>
              <group>Apache Software Foundation</group>
              <prefix>/opt</prefix>
              <release>SNAPSHOT</release>
              <version>1.0</version>
              <name>drill</name>
              <mappings>
                <mapping>
                  <directory>/opt/drill/bin</directory>
                  <sources>
                    <source>
                      <location>target/drill-${project.version}-bin/drill-${project.version}/bin</location>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/opt/drill/lib</directory>
                  <sources>
                    <source>
                      <location>target/drill-${project.version}-bin/drill-${project.version}/lib</location>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/opt/drill/jars</directory>
                  <sources>
                    <source>
                      <location>target/drill-${project.version}-bin/drill-${project.version}/jars</location>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/etc/drill/conf</directory>
                  <sources>
                    <source>
                      <location>target/drill-${project.version}-bin/drill-${project.version}/conf</location>
                    </source>
                  </sources>
                  <configuration>true</configuration>
                </mapping>
                <mapping>
                  <directory>/etc/init.d/</directory>
                  <sources>
                    <source>
                      <location>src/resources/drillbit</location>
                    </source>
                  </sources>
                  <directoryIncluded>false</directoryIncluded>
                </mapping>
              </mappings>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>deb</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>jdeb</artifactId>
            <groupId>org.vafer</groupId>
            <version>1.0</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jdeb</goal>
                </goals>
                <configuration>
                  <deb>target/drill-${project.version}.deb</deb>
                  <dataSet>
                    <data>
                      <src>target/drill-${project.version}-bin/drill-${project.version}/lib</src>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/opt/drill/lib/</prefix>
                      </mapper>
                    </data>
                    <data>
                      <src>target/drill-${project.version}-bin/drill-${project.version}/jars</src>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/opt/drill/jars/</prefix>
                      </mapper>
                    </data>
                    <data>
                      <src>target/drill-${project.version}-bin/drill-${project.version}/bin</src>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/opt/drill/bin/</prefix>
                        <filemode>755</filemode>
                      </mapper>
                    </data>
                    <data>
                      <src>target/drill-${project.version}-bin/drill-${project.version}/conf</src>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/etc/drill/conf</prefix>
                        <filemode>755</filemode>
                      </mapper>
                    </data>
                    <data>
                      <src>src/resources/drillbit</src>
                      <dst>/etc/init.d/drillbit</dst>
                      <type>file</type>
                      <mapper>
                        <type>perm</type>
                        <filemode>755</filemode>
                      </mapper>
                    </data>
                  </dataSet>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
