<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2022, WSO2 LLC (http://www.wso2.com).
  ~
  ~ WSO2 LLC 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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.wso2</groupId>
        <artifactId>wso2</artifactId>
        <version>5.1</version>
    </parent>

    <groupId>org.wso2.carbon</groupId>
    <artifactId>org.wso2.carbon.securevault.aws</artifactId>
    <version>1.0.0</version>
    <packaging>bundle</packaging>

    <scm>
        <url>https://github.com/wso2-extensions/carbon-securevault-aws.git</url>
        <developerConnection>scm:git:https://github.com/wso2-extensions/carbon-securevault-aws.git
        </developerConnection>
        <connection>scm:git:https://github.com/wso2-extensions/carbon-securevault-aws.git</connection>
        <tag>v1.0.0</tag>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${maven.bundle.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Export-Package>
                            org.wso2.carbon.securevault.aws.*
                        </Export-Package>
                        <Import-Package>
                            org.apache.commons.lang;version="${commons-lang.wso2.osgi.version.range}",
                            org.apache.commons.logging;version="${commons-logging.osgi.version.range}",

                            org.apache.http;version="${httpcomponents-httpcore.osgi.version.range}",
                            org.apache.http.auth;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.client;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.client.config;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.client.methods;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.client.protocol;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.config;version="${httpcomponents-httpcore.osgi.version.range}",
                            org.apache.http.conn;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.conn.routing;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.conn.socket;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.conn.ssl;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.entity;version="${httpcomponents-httpcore.osgi.version.range}",
                            org.apache.http.impl.auth;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.impl.client;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.impl.conn;version="${httpcomponents-httpclient.osgi.version.range}",
                            org.apache.http.params;version="${httpcomponents-httpcore.osgi.version.range}",
                            org.apache.http.pool;version="${httpcomponents-httpcore.osgi.version.range}",
                            org.apache.http.protocol;version="${httpcomponents-httpcore.osgi.version.range}",

                            org.wso2.carbon.utils;version="${carbon.kernel.version.range}",
                            org.wso2.securevault;version="${org.wso2.securevault.version.range}",
                            org.wso2.securevault.definition;version="${org.wso2.securevault.version.range}",
                            org.wso2.securevault.keystore;version="${org.wso2.securevault.version.range}",
                            org.wso2.securevault.secret;version="${org.wso2.securevault.version.range}",
                        </Import-Package>
                        <!-- Only the dependencies that are required by the AWS SDK which are not available in the IS are embedded.-->
                        <!-- They are embedded because these dependencies are only required within this extension.-->
                        <Embed-Dependency>
                            secretsmanager,
                            endpoints-spi,
                            http-auth,
                            http-clients,
                            http-auth-aws,
                            retries,
                            http-auth-scheme,
                            retries-spi,
                            identity-spi,                    
                            aws-json-protocol,
                            third-party-jackson-core,
                            json-utils,
                            protocol-core,
                            core-interceptor,
                            checksums,
                            checksums-spi,
                            http-auth-spi,
                            sdk-core,
                            profiles,
                            reactive-streams,
                            auth,
                            eventstream,
                            http-client-spi,
                            regions,
                            annotations,
                            utils,
                            aws-core,
                            metrics-spi,
                            apache-client,
                            aws-crt-client,
                            aws-crt,
                            sts,
                            aws-query-protocol,
                        </Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                        <_fixupmessages>"Classes found in the wrong directory..."</_fixupmessages>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.12</version>
                <executions>
                    <execution>
                        <id>default-instrument</id>
                        <goals>
                            <goal>instrument</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-restore-instrumented-classes</id>
                        <goals>
                            <goal>restore-instrumented-classes</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report-integration</id>
                        <goals>
                            <goal>report-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>COMPLEXITY</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.75</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testing.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemPropertyVariables>
                        <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
                    </systemPropertyVariables>
                    <reuseForks>true</reuseForks>
                    <classpathDependencyExcludes>
                        <classpathDependencyExclude>org.ops4j.pax.logging</classpathDependencyExclude>
                    </classpathDependencyExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.scm.id>my-scm-server</project.scm.id>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <carbon.kernel.version.range>[4.7.0,5.0.0)</carbon.kernel.version.range>

        <org.wso2.securevault.version.range>[1.1.3,2.0.0)</org.wso2.securevault.version.range>

        <software.amazon.awssdk.version>2.28.0</software.amazon.awssdk.version>
        <software.amazon.awssdk.aws-crt-client.version>${software.amazon.awssdk.version}-PREVIEW</software.amazon.awssdk.aws-crt-client.version>

        <commons-lang.wso2.osgi.version.range>[2.6.0,3.0.0)</commons-lang.wso2.osgi.version.range>
        <commons-logging.osgi.version.range>[1.2.0,2.0.0)</commons-logging.osgi.version.range>
        <httpcomponents-httpclient.osgi.version.range>[4.5.13.wso2v1,4.6.0.wso2v1)</httpcomponents-httpclient.osgi.version.range>
        <httpcomponents-httpcore.osgi.version.range>[4.4.14.wso2v1,4.5.0.wso2v1)</httpcomponents-httpcore.osgi.version.range>

        <spotbugs-annotations.version>4.8.6</spotbugs-annotations.version>

        <maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
        <maven.bundle.plugin.version>5.1.9</maven.bundle.plugin.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!--Test Dependencies-->
        <junit.version>4.13.1</junit.version>
        <testng.version>6.11</testng.version>
        <powermock.version>2.0.9</powermock.version>
        <jacoco.agent.version>0.8.12</jacoco.agent.version>
        <findbugs.skip>true</findbugs.skip>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>${software.amazon.awssdk.version}</version>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.wso2.securevault</groupId>
            <artifactId>org.wso2.securevault</artifactId>
            <version>${org.wso2.securevault.version.range}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.ops4j.pax.logging</groupId>
                    <artifactId>pax-logging-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
            <version>${carbon.kernel.version.range}</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>secretsmanager</artifactId>
            <version>${software.amazon.awssdk.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>software.amazon.awssdk</groupId>
                    <artifactId>netty-nio-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>sts</artifactId>
            <version>${software.amazon.awssdk.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>software.amazon.awssdk</groupId>
                    <artifactId>netty-nio-client</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>apache-client</artifactId>
            <version>${software.amazon.awssdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-annotations</artifactId>
            <version>${spotbugs-annotations.version}</version>
            <scope>compile</scope>
        </dependency>

        <!--Test Dependencies-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-core</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito2</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-testng</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <version>${jacoco.agent.version}</version>
            <classifier>runtime</classifier>
        </dependency>
    </dependencies>
</project>
