<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2019 The OpenTracing Authors

    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">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>lightstep-tracer-jre-bundle</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.lightstep.tracer</groupId>
        <artifactId>lightstep-tracer-java</artifactId>
        <version>0.30.0</version>
    </parent>

    <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>lightstep-tracer-jre</artifactId>
        <version>${project.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>tracer-okhttp</artifactId>
        <version>${lightstep.parent.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>tracer-grpc</artifactId>
        <version>${lightstep.parent.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty</artifactId>
        <version>${io.grpc.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-tcnative-boringssl-static</artifactId>
        <version>${io.netty.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>io.opentracing</groupId>
        <artifactId>opentracing-api</artifactId>
        <version>${io.opentracing.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>io.opentracing.contrib</groupId>
        <artifactId>opentracing-tracerresolver</artifactId>
        <version>${tracerresolver.version}</version>
        <scope>provided</scope>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>3.3.0</version>
        <scope>test</scope>
      </dependency>
    </dependencies>

    <build>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.1.1</version>
          <executions>
            <execution>
              <id>jar-with-dependencies</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
              <configuration>
                <descriptors>
                  <descriptor>assembly.xml</descriptor>
                </descriptors>
                <appendAssemblyId>false</appendAssemblyId>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>attach-javadoc</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.2.4</version>
          <configuration>
            <filters>
              <filter>
                <artifact>*:*</artifact>
                <excludes>
                  <exclude>META-INF/services/lightstep.io.grpc.*</exclude>
                </excludes>
              </filter>
            </filters>
          </configuration>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <createSourcesJar>false</createSourcesJar>
                <shadeSourcesContent>true</shadeSourcesContent>
                <transformers>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                </transformers>
                <relocations>
                  <relocation>
                    <pattern>com.google</pattern>
                    <shadedPattern>lightstep.com.google</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>google.protobuf</pattern>
                    <shadedPattern>lightstep.google.protobuf</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>javax.annotation</pattern>
                    <shadedPattern>lightstep.javax.annotation</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>okhttp</pattern>
                    <shadedPattern>lightstep.okhttp</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>io.grpc</pattern>
                    <shadedPattern>lightstep.io.grpc</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>io.netty</pattern>
                    <shadedPattern>lightstep.io.netty</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>META-INF/native/libnetty</pattern>
                    <shadedPattern>META-INF/native/liblightstep_netty</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>META-INF/native/netty</pattern>
                    <shadedPattern>META-INF/native/lightstep_netty</shadedPattern>
                  </relocation>
                </relocations>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
</project>
