<?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.38.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.11.700</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>
                          <!-- OAK-7182 -->${guava.osgi.import},
                            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,
                            com.amazonaws.services.securitytoken.internal,
                            com.amazonaws*,
                            com.fasterxml.jackson.dataformat.cbor,
                            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>
                <executions>
                    <execution>
                        <id>baseline</id>
                        <goals>
                            <goal>baseline</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                        <configuration>
                            <!--
                              This is required because there's no prior (stable) version of oak-segment-aws
                              This should be removed post first release
                            -->
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </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>
                <version>3.0.0-M4</version>
                <configuration>
                    <argLine>-Dsqlite4java.library.path="${project.build.directory}/dependencies"</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <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>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.annotation</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>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </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>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>com.arakelian</groupId>
            <artifactId>docker-junit-rule</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>
        </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>
        <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>
