<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
 Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.

 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0 which accompanies this distribution,
 and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<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.opendaylight.controller</groupId>
        <artifactId>bundle-parent</artifactId>
        <version>10.0.14</version>
        <relativePath>../../bundle-parent</relativePath>
    </parent>

    <artifactId>repackaged-akka</artifactId>
    <packaging>bundle</packaging>
    <name>${project.artifactId}</name>

    <properties>
        <!-- We are just juggling classes here -->
        <odlparent.modernizer.skip>true</odlparent.modernizer.skip>
        <odlparent.spotbugs.skip>true</odlparent.spotbugs.skip>

        <!-- We do not want to generate javadoc -->
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.opendaylight.controller</groupId>
            <artifactId>repackaged-akka-jar</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.typesafe</groupId>
            <artifactId>config</artifactId>
        </dependency>
        <dependency>
            <groupId>com.typesafe</groupId>
            <artifactId>ssl-config-core_2.13</artifactId>
        </dependency>
        <dependency>
            <groupId>io.aeron</groupId>
            <artifactId>aeron-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.aeron</groupId>
            <artifactId>aeron-driver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.agrona</groupId>
            <artifactId>agrona</artifactId>
        </dependency>
        <dependency>
            <groupId>org.reactivestreams</groupId>
            <artifactId>reactive-streams</artifactId>
        </dependency>
        <dependency>
            <groupId>org.lmdbjava</groupId>
            <artifactId>lmdbjava</artifactId>
            <version>0.7.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.jnr</groupId>
                    <artifactId>jffi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.github.jnr</groupId>
                    <artifactId>jnr-ffi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.github.jnr</groupId>
                    <artifactId>jnr-constants</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-reflect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang.modules</groupId>
            <artifactId>scala-java8-compat_2.13</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang.modules</groupId>
            <artifactId>scala-parser-combinators_2.13</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-license</id>
                        <configuration>
                            <!-- Akka is Apache-2.0 licensed -->
                            <skip>true</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.opendaylight.controller</groupId>
                                    <artifactId>repackaged-akka-jar</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.hierynomus</groupId>
                                    <artifactId>asn-one</artifactId>
                                    <version>0.4.0</version>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                            <includeArtifactIds>repackaged-akka-jar</includeArtifactIds>
                            <outputDirectory>${project.build.directory}/shaded-sources</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>move-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <move todir="${project.build.directory}/resources">
                                    <fileset dir="${project.build.directory}/classes">
                                        <include name="*.conf"/>
                                    </fileset>
                                </move>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>shaded-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                           <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>${project.build.directory}/shaded-sources</sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>shaded-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                           <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Automatic-Module-Name>org.opendaylight.controller.repackaged.akka</Automatic-Module-Name>
                        <Export-Package>
                            akka.*,
                            com.typesafe.sslconfig.akka.*,
                        </Export-Package>
                        <Import-Package>
                            jdk.jfr;resolution:=optional,
                            sun.misc;resolution:=optional,
                            sun.reflect;resolution:=optional,
                            org.fusesource.leveldbjni;resolution:=optional,
                            org.iq80.leveldb;resolution:=optional,
                            org.iq80.leveldb.impl;resolution:=optional,
                            org.jboss.netty.*;resolution:=optional,
                            *
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
