<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you 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>org.wso2.carbon.analytics</groupId>
        <artifactId>org.wso2.carbon.analytics.parent</artifactId>
        <version>3.0.37</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.siddhi.editor.core</artifactId>
    <packaging>bundle</packaging>

    <name>WSO2 Streaming Integrator - Editor Core</name>
    <url>http://wso2.org</url>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.deployment</groupId>
            <artifactId>org.wso2.carbon.deployment.engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi.services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics</groupId>
            <artifactId>org.wso2.carbon.streaming.integrator.common</artifactId>
        </dependency>

        <!--Dependencies for Siddhi debugger begins here-->
        <dependency>
            <groupId>org.wso2.msf4j</groupId>
            <artifactId>msf4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>io.siddhi</groupId>
            <artifactId>siddhi-query-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.siddhi</groupId>
            <artifactId>siddhi-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.siddhi</groupId>
            <artifactId>siddhi-query-compiler</artifactId>
        </dependency>
        <dependency>
            <groupId>io.siddhi</groupId>
            <artifactId>siddhi-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.utils</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io.wso2</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.websocket</groupId>
            <artifactId>javax.websocket-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics</groupId>
            <artifactId>org.wso2.carbon.editor.log.appender</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics-common</groupId>
            <artifactId>org.wso2.carbon.analytics.idp.client</artifactId>
        </dependency>
        <dependency>
            <groupId>com.spotify</groupId>
            <artifactId>docker-client</artifactId>
            <classifier>shaded</classifier>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>net.minidev</groupId>
            <artifactId>json-smart</artifactId>
        </dependency>
    </dependencies>

    <properties>
        <maven.findbugsplugin.version.exclude>findbugs-exclude.xml</maven.findbugsplugin.version.exclude>
        <carbon.component>
            osgi.service; objectClass="org.wso2.msf4j.Microservice"; serviceCount="1"
        </carbon.component>
    </properties>

    <profiles>
        <profile>
            <id>extract-dependency</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <!--<filtering>true</filtering>-->
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <configuration>
                            <nonFilteredFileExtensions>
                                <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                                <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                                <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                                <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                                <nonFilteredFileExtension>ico</nonFilteredFileExtension>
                                <nonFilteredFileExtension>js</nonFilteredFileExtension>
                                <nonFilteredFileExtension>css</nonFilteredFileExtension>
                                <nonFilteredFileExtension>json</nonFilteredFileExtension>
                            </nonFilteredFileExtensions>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>node</executable>
                                    <workingDirectory>${basedir}/src/main/resources/tools</workingDirectory>
                                    <arguments>
                                        <argument>r.js</argument>
                                        <argument>-o</argument>
                                        <argument>build.js</argument>
                                        <!--<argument>optimize=none</argument>-->
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <configuration>
                                    <tasks>
                                        <move file="target/classes/web/editor/commons" todir="target/classes/web" />
                                        <move file="target/classes/web/editor/css" todir="target/classes/web" />
                                        <move file="target/classes/web/editor/images" todir="target/classes/web" />
                                        <move file="target/classes/web/editor/js" todir="target/classes/web" />
                                        <delete dir="target/classes/web/editor" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-dependencies</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <markersDirectory>
                                        ${project.build.directory}/dependencies/dependency-maven-plugin-markers
                                    </markersDirectory>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>com.spotify</groupId>
                                            <artifactId>docker-client</artifactId>
                                            <classifier>shaded</classifier>
                                            <outputDirectory>${project.build.directory}/dependencies/docker-client
                                            </outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <instructions>
                                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                                <Bundle-Name>${project.artifactId}</Bundle-Name>
                                <Include-Resource>
                                    web=target/classes/web,
                                    target/classes/mime-map.properties,
                                    META-INF=target/classes/META-INF,
                                    META-INF/services=${project.build.directory}/dependencies/docker-client/META-INF/services
                                </Include-Resource>
                                <Private-Package>
                                    org.wso2.carbon.siddhi.editor.core.internal,
                                    org.wso2.carbon.siddhi.editor.core.internal.*,
                                    com.spotify.docker.*,
                                    com.kenai.*,
                                    org.apache.commons.*,
                                    jni.*,
                                    jersey.repackaged.com.*,
                                    com.jayway.jsonpath.*,
                                    net.minidev.*
                                </Private-Package>
                                <Export-Package>
                                    org.wso2.carbon.siddhi.editor.core.*
                                </Export-Package>
                                <Import-Package>
                                    org.osgi.framework.*;version="${osgi.framework.import.version.range}",
                                    org.wso2.carbon.kernel;version="${carbon.kernel.package.import.version.range}",
                                    io.siddhi.*;version="${siddhi.version.range}",
                                    org.wso2.carbon.streaming.integrator.common.*;version="${carbon.analytics.version.range}",
                                    org.wso2.carbon.editor.log.appender.*,
                                    org.wso2.msf4j.*;version="${msf4j.import.version.range}",
                                    javax.management.*,
                                    javax.ws.rs.*;version="${javax.ws.rs.version.range}",
                                    com.fasterxml.jackson.core.*;version="${com.fasterxml.jackson.core.version.range}",
                                    com.fasterxml.jackson.databind.*;version="${com.fasterxml.jackson.core.version.range}",
                                    *;resolution:=optional
                                </Import-Package>
                                <DynamicImport-Package>*</DynamicImport-Package>
                            </instructions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>sonatype.releases</id>
            <url>https://oss.sonatype.org/content/repositories/releases/</url>
        </repository>
    </repositories>
</project>

