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

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF 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.apache.jackrabbit</groupId>
        <artifactId>oak-parent</artifactId>
        <version>1.92.0</version>
        <relativePath>../oak-parent/pom.xml</relativePath>
    </parent>

    <artifactId>oak-segment-aws</artifactId>
    <packaging>bundle</packaging>

    <name>Oak Segment AWS</name>

    <properties>
        <aws.version>1.12.791</aws.version>
        <sqlite4java.version>1.0.392</sqlite4java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Import-Package>
                            org.apache.jackrabbit.oak.segment.spi*,
                            org.apache.jackrabbit.oak.segment.remote*,
                            !org.apache.jackrabbit.oak.segment*,
                            *
                        </Import-Package>
                        <Export-Package>
                            com.amazonaws.metrics.internal.cloudwatch;version=0.1.0,
                            com.amazonaws.services.securitytoken.internal;version=0.1.0,
                            com.amazonaws;version=0.1.0,
                            com.amazonaws.arn;version=0.1.0,
                            com.amazonaws.auth;version=0.1.0,
                            com.amazonaws.auth.profile.internal;version=0.1.0,
                            com.amazonaws.handlers;version=0.1.0,
                            com.amazonaws.http;version=0.1.0,
                            com.amazonaws.http.apache.request.impl;version=0.1.0,
                            com.amazonaws.internal;version=0.1.0,
                            com.amazonaws.internal.config;version=0.1.0,
                            com.amazonaws.protocol;version=0.1.0,
                            com.amazonaws.protocol.json;version=0.1.0,
                            com.amazonaws.protocol.json.internal;version=1.0.0,
                            com.amazonaws.regions;version=0.1.0,
                            com.amazonaws.services.dynamodbv2;version=1.0.0,
                            com.amazonaws.services.dynamodbv2.util;version=0.1.0,
                            com.amazonaws.services.s3;version=1.0.0,
                            com.amazonaws.services.s3.internal;version=0.1.0,
                            com.amazonaws.services.s3.model;version=1.0.0,
                            com.amazonaws.services.s3.model.transform;version=0.1.0,
                            com.amazonaws.services.s3.transfer;version=0.1.0,
                            com.amazonaws.util;version=1.0.0,
                            com.fasterxml.jackson.dataformat.cbor;version=3.0.0,
                            com.sun.org.apache.xpath.internal,
                            kotlin,
                            org.bouncycastle.jce.provider,
                            software.amazon.ion*
                        </Export-Package>
                        <Embed-Dependency>
                            aws-java-sdk-dynamodb,
                            aws-java-sdk-s3,
                            dynamodb-lock-client
                        </Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <excludes>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <id>failsafe-integration-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <argLine>-Dsqlite4java.library.path="${project.build.directory}/dependencies"</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Dsqlite4java.library.path="${project.build.directory}/dependencies"</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>test</includeScope>
                            <includeTypes>so,dll,dylib</includeTypes>
                            <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- ====================================================================== -->
    <!-- D E P E N D E N C I E S -->
    <!-- ====================================================================== -->
    <dependencies>
        <!-- Optional OSGi dependencies, used only when running within OSGi -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component.annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.metatype.annotations</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Dependencies to other Oak components -->
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-segment-tar</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
         <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-segment-remote</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-store-spi</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- AWS dependencies -->
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>${aws.version}</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-dynamodb</artifactId>
            <version>${aws.version}</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>dynamodb-lock-client</artifactId>
            <version>1.1.0</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-blob-plugins</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-segment-tar</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-store-spi</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
         <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-blob</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.findify</groupId>
            <artifactId>s3mock_2.12</artifactId>
            <version>0.2.5</version>
            <scope>test</scope>
        </dependency>

        <!-- Test dependencies for DynamoDBLocal -->
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>DynamoDBLocal</artifactId>
            <version>1.12.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>sqlite4java</artifactId>
            <version>${sqlite4java.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>sqlite4java-win32-x86</artifactId>
            <version>${sqlite4java.version}</version>
            <type>dll</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>sqlite4java-win32-x64</artifactId>
            <version>${sqlite4java.version}</version>
            <type>dll</type>
            <scope>test</scope>
        </dependency>
        <!-- add native implementation for Apple silicon from fork -->
        <dependency>
            <groupId>io.github.ganadist.sqlite4java</groupId>
            <artifactId>libsqlite4java-osx-aarch64</artifactId>
            <version>${sqlite4java.version}</version>
            <type>dylib</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>libsqlite4java-osx</artifactId>
            <version>${sqlite4java.version}</version>
            <type>dylib</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>libsqlite4java-linux-i386</artifactId>
            <version>${sqlite4java.version}</version>
            <type>so</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>libsqlite4java-linux-amd64</artifactId>
            <version>${sqlite4java.version}</version>
            <type>so</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <!--
            DynamoDBLocal is used for testing. Below repository is provided by Amazon for using it.
            More details here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.Maven.html
        -->
        <repository>
            <id>dynamodblocal</id>
            <name>AWS DynamoDB Local Release Repository</name>
            <url>https://s3-us-west-2.amazonaws.com/dynamodb-local/release</url>
        </repository>
    </repositories>
</project>
