<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) 2014 Google, Inc.

  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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>

  <parent>
    <groupId>com.google.cloud.bigdataoss</groupId>
    <artifactId>bigdataoss-parent</artifactId>
    <version>1.6.3</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>gcs-connector-parent</artifactId>
  <name>gcs-connector.jar</name>
  <description>
    An implementation of org.apache.hadoop.fs.FileSystem targeting Google Cloud Storage
  </description>
  <version>1.6.3</version>

  <profiles>
    <profile>
      <id>hadoop1</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
              <excludes>
                <exclude>**/GoogleHadoopFS.java</exclude>
              </excludes>
              <testExcludes>
                <!-- Exclude hadoop 2 specific tests -->
                <exclude>**/hcfs/*2Test.java</exclude>
                <exclude>**/contract/*.java</exclude>
              </testExcludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>hadoop2</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
              <testExcludes>
                <exclude>**/hcfs/*1Test.java</exclude>
              </testExcludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integration-test</id>
      <activation>
        <property><name>env.RUN_INTEGRATION_TESTS</name></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <phase>integration-test</phase>
                <configuration>
                  <excludes>
                    <exclude>none</exclude>
                  </excludes>
                  <includes>
                    <include>**/fs/gcs/GoogleHadoopFileSystemIntegrationTest.java</include>
                    <include>**/fs/gcs/GoogleHadoopGlobalRootedFileSystemIntegrationTest.java</include>
                    <include>**/fs/gcs/LocalFileSystemIntegrationTest.java</include>
                  </includes>
                  <reuseForks>false</reuseForks>
                  <forkCount>3</forkCount>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client-java6</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client-jackson2</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-storage</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.google.guava</groupId>
      <artifactId>guava-testlib</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client-java6</artifactId>
    </dependency>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.cloud.bigdataoss</groupId>
      <artifactId>util</artifactId>
      <version>${bigdataoss.util.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.cloud.bigdataoss</groupId>
      <artifactId>gcsio</artifactId>
      <version>${bigdataoss.gcsio.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.cloud.bigdataoss</groupId>
      <artifactId>gcsio</artifactId>
      <version>${bigdataoss.gcsio.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <!-- enable project.version substitution. -->
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*IntegrationTest.java</exclude>
            <exclude>**/GoogleCloudStorageImplTest.java</exclude>
          </excludes>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>
      </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.3</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <artifactSet>
                  <includes>
                    <include>com.fasterxml.jackson.core:jackson-core</include>
                    <include>com.google.api-client:*</include>
                    <include>com.google.apis:*</include>
                    <include>com.google.cloud.bigdataoss:util</include>
                    <include>com.google.cloud.bigdataoss:util-hadoop</include>
                    <include>com.google.cloud.bigdataoss:gcsio</include>
                    <include>com.google.guava:*</include>
                    <include>com.google.http-client:google-http-client</include>
                    <include>com.google.http-client:google-http-client-jackson2</include>
                    <include>com.google.oauth-client:google-oauth-client</include>
                    <include>com.google.oauth-client:google-oauth-client-java6</include>
                    <include>org.apache.httpcomponents:httpclient</include>
                    <include>org.apache.httpcomponents:httpcore</include>
                    <!-- needed by http client and versions conflict -->
                    <include>commons-codec:commons-codec</include>
                  </includes>
                </artifactSet>
                <minimizeJar>true</minimizeJar>
                <relocations>
                  <relocation>
                    <pattern>com.google.common</pattern>
                    <shadedPattern>com.google.cloud.hadoop.repackaged.com.google.common</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>com.fasterxml</pattern>
                    <shadedPattern>com.google.cloud.hadoop.repackaged.com.fasterxml</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>org.apache.http</pattern>
                    <shadedPattern>com.google.cloud.hadoop.repackaged.org.apache.http</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>org.apache.commons.codec</pattern>
                    <shadedPattern>com.google.cloud.hadoop.repackaged.org.apache.commons.codec</shadedPattern>
                  </relocation>
                </relocations>
                <shadedArtifactAttached>true</shadedArtifactAttached>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
