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

    Copyright 2017 The jetcd 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">

    <parent>
        <groupId>io.etcd</groupId>
        <artifactId>jetcd-parent</artifactId>
        <version>0.3.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jetcd-all</artifactId>
    <packaging>bundle</packaging>

    <dependencies>
        <dependency>
            <groupId>io.etcd</groupId>
            <artifactId>jetcd-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.etcd</groupId>
            <artifactId>jetcd-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.etcd</groupId>
            <artifactId>jetcd-extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>io.etcd</groupId>
            <artifactId>jetcd-resolver</artifactId>
        </dependency>
        <dependency>
            <groupId>io.etcd</groupId>
            <artifactId>jetcd-resolver-dns-srv</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createSourcesJar>true</createSourcesJar>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <minimizeJar>false</minimizeJar>
                            <artifactSet>
                                <excludes>
                                    <exclude>org.slf4j:slf4j-api</exclude>
                                    <exclude>com.google.errorprone:error_prone_annotations</exclude>
                                </excludes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>com.google</pattern>
                                    <shadedPattern>io.etcd.jetcd.shaded.com.google
                                    </shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.grpc</pattern>
                                    <shadedPattern>io.etcd.jetcd.shaded.io.grpc</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.netty</pattern>
                                    <shadedPattern>io.etcd.jetcd.shaded.io.netty</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>javax.annotation</pattern>
                                    <shadedPattern>io.etcd.jetcd.shaded.javax.annotation</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.opencensus</pattern>
                                    <shadedPattern>io.etcd.jetcd.shaded.io.opencensus
                                    </shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>etcd :: ${project.artifactId}</Bundle-Name>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Export-Package>
                            io.etcd.jetcd.common.exception,
                            io.etcd.jetcd.resolver,
                            io.etcd.jetcd.resolver.dnssrv,
                            io.etcd.jetcd,
                            io.etcd.jetcd.auth,
                            io.etcd.jetcd.cluster,
                            io.etcd.jetcd.kv,
                            io.etcd.jetcd.lease,
                            io.etcd.jetcd.lock,
                            io.etcd.jetcd.maintenance,
                            io.etcd.jetcd.op,
                            io.etcd.jetcd.options,
                            io.etcd.jetcd.watch,
                            io.etcd.jetcd.extensions
                        </Export-Package>
                        <Import-Package>
                            org.slf4j;version="[1.7,2)",
                            javax.security.cert,
                            javax.net.ssl;resolution:=optional
                        </Import-Package>
                    </instructions>
                    <unpackBundle>true</unpackBundle>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>
