<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ 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.cellery.observability</groupId>
        <artifactId>io.cellery.observability.docker</artifactId>
        <version>0.1.1-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>io.cellery.observability.docker.sp</artifactId>
    <name>Cellery Observability Docker - Stream Processor</name>
    <description>Dockerfiles for Cellery Stream Processor Worker</description>
    <packaging>pom</packaging>

    <dependencies>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>io.cellery.observability.telemetry.receiver</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>gogoproto-java</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf-lite</artifactId>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>grpc</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opencensus</groupId>
            <artifactId>opencensus-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opencensus</groupId>
            <artifactId>opencensus-contrib-grpc-metrics</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>io.cellery.observability.tracing.receiver</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.api.grpc</groupId>
            <artifactId>proto-google-common-protos</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>protobuf</artifactId>
        </dependency>
        <dependency>
            <groupId>io.zipkin.zipkin2</groupId>
            <artifactId>zipkin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.extension.siddhi.io.http</groupId>
            <artifactId>siddhi-io-http</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.extension.siddhi.store.rdbms</groupId>
            <artifactId>siddhi-store-rdbms</artifactId>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java</artifactId>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java-proto</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp</groupId>
            <artifactId>okhttp-ws</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp</groupId>
            <artifactId>logging-interceptor</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>adal4j</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-ext-jdk15on</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>io.cellery.observability.api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>io.cellery.observability.model.generator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.cellery.observability</groupId>
            <artifactId>io.cellery.observability.k8s.api.server.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.oltu.oauth2</groupId>
            <artifactId>org.apache.oltu.oauth2.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.oltu.oauth2</groupId>
            <artifactId>org.apache.oltu.oauth2.common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore-nio</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpasyncclient</artifactId>
        </dependency>
        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Copy Maven dependencies into target/files/lib -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-osgi-libs</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <overWriteReleases>false</overWriteReleases>
                            <includeScope>runtime</includeScope>
                            <outputDirectory>${project.build.directory}/files/lib</outputDirectory>
                            <excludeArtifactIds>
                                grpc-protobuf, grpc-protobuf-lite, grpc-stub, opencensus-api,
                                opencensus-contrib-grpc-metrics, proto-google-common-protos,
                                okhttp-ws, okhttp, adal4j, logging-interceptor, org.apache.oltu.oauth2.client,
                                org.apache.oltu.oauth2.common,httpclient, httpcore, unirest-java, httpcore-nio,
                                httpasyncclient, jackson-databind, gson
                            </excludeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-non-osgi-libs</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <overWriteReleases>false</overWriteReleases>
                            <includeScope>runtime</includeScope>
                            <outputDirectory>${project.build.directory}/files/non-osgi/</outputDirectory>
                            <excludeArtifactIds>
                                io.cellery.observability.telemetry.receiver, commons-io, gogoproto-java, grpc,
                                io.cellery.observability.tracing.receiver, protobuf, io.cellery.observability.api,
                                io.cellery.observability.model.generator, siddhi-io-http, siddhi-store-rdbms,
                                io.cellery.observability.k8s.api.server.client, joda-time, zipkin, client-java,
                                client-java-api, guava, commons-codec, commons-compress, commons-lang3,
                                client-java-proto, bcpkix-jdk15on, bcprov-ext-jdk15on
                            </excludeArtifactIds>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Generate OSGI bundles from Non-OSGi jars and save in OSGi Jars directory -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includeProjectDependencies>true</includeProjectDependencies>
                    <includePluginDependencies>true</includePluginDependencies>
                    <mainClass>org.wso2.carbon.tools.CarbonToolExecutor</mainClass>
                    <arguments>
                        <argument>${project.build.directory}/files/non-osgi/</argument>
                        <argument>${project.build.directory}/files/lib/</argument>
                        <argument>${project.build.directory}</argument>
                    </arguments>
                    <systemProperties>
                        <systemProperty>
                            <key>wso2.carbon.tool</key>
                            <value>jar-to-bundle-converter</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.wso2.carbon</groupId>
                        <artifactId>org.wso2.carbon.tools.core</artifactId>
                        <version>5.2.8</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Build Docker Image -->
            <!--<plugin>-->
                <!--<groupId>com.spotify</groupId>-->
                <!--<artifactId>dockerfile-maven-plugin</artifactId>-->
                <!--<executions>-->
                    <!--<execution>-->
                        <!--<id>docker-build</id>-->
                        <!--<phase>package</phase>-->
                        <!--<goals>-->
                            <!--<goal>build</goal>-->
                        <!--</goals>-->
                        <!--<configuration>-->
                            <!--<repository>${docker.repo.name}/sp-worker</repository>-->
                            <!--<tag>${docker.image.tag}</tag>-->
                        <!--</configuration>-->
                    <!--</execution>-->
                <!--</executions>-->
            <!--</plugin>-->
        </plugins>
    </build>
</project>
