<?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/maven-v4_0_0.xsd">
  <parent>
    <artifactId>hbase-thirdparty</artifactId>
    <groupId>org.apache.hbase.thirdparty</groupId>
    <version>3.3.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>hbase-shaded-protobuf</artifactId>
  <name>Apache HBase Patched and Relocated (Shaded) Protobuf</name>
  <description>Pulls down protobuf, patches it, compiles, and then relocates/shades.</description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <id>pre-generate-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/src/main/java</directory>
              <includes>
                <include>**/**</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.1.1</version>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.google.protobuf</groupId>
                  <artifactId>protobuf-java</artifactId>
                  <version>${protobuf.version}</version>
                  <classifier>sources</classifier>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${basedir}/src/main/java</outputDirectory>
                  <includes>**/**</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-patch-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>patch</id>
            <phase>process-sources</phase>
            <goals>
              <goal>apply</goal>
            </goals>
            <configuration>
              <strip>1</strip>
              <patchDirectory>${basedir}/src/main/patches</patchDirectory>
              <patchTrackingFile>${project.build.directory}/patches-applied.txt</patchTrackingFile>
              <naturalOrderProcessing>true</naturalOrderProcessing>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <targetDirectory>${basedir}</targetDirectory>
          <skipApplication>false</skipApplication>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadeSourcesContent>true</shadeSourcesContent>
              <createSourcesJar>true</createSourcesJar>
              <relocations>
                <relocation>
                  <pattern>com.google.protobuf</pattern>
                  <shadedPattern>${rename.offset}.com.google.protobuf</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
