<?xml version="1.0"?>
<project
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
        xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

	<parent>
        <artifactId>cg</artifactId>
        <groupId>org.wso2.carbon</groupId>
        <version>4.2.0</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

    <groupId>org.wso2.carbon</groupId>
	<version>4.2.0</version>
    <artifactId>org.wso2.carbon.cloud.gateway.common</artifactId>
    <packaging>bundle</packaging>
    <name>Cloud Gateway common component</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <libthrift.version>0.8.0.wso2v1</libthrift.version>
    </properties>

    <profiles>
        <profile>
            <id>gen-csg-thrift-classes</id>
            <activation>
                <file>
                    <exists>/usr/local/bin/thrift</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <!-- best lock down version of the plugin too -->
                        <configuration>
                            <source>1.5</source>
                            <target>1.5</target>
                        </configuration>
                    </plugin>

                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-sources</id>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <tasks>
                                        <exec executable="thrift">
                                            <arg value="--gen"/>
                                            <arg value="java"/>
                                            <arg value="-out"/>
                                            <arg value="src/main/java"/>
                                            <arg value="src/main/resources/cg.thrift"/>
                                        </exec>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Export-Package>org.wso2.carbon.cloud.gateway.common.*</Export-Package>
                        <Import-Package>
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <dependencies>
        <!--Do not change the order of dependency as it caused an older version to come through -->
        <!--transitive dependency-->
        <dependency>
            <groupId>libthrift.wso2</groupId>
            <artifactId>libthrift</artifactId>
            <version>${libthrift.version}</version>
        </dependency>
        <dependency>
            <groupId>slf4j.wso2</groupId>
            <artifactId>slf4j</artifactId>
            <version>${slf4j.wso2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
            <version>${wso2carbon.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.authenticator.stub</artifactId>
            <version>${wso2carbon.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>
