<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>io.silverspoon</groupId>
    <artifactId>bulldog-parent</artifactId>
    <version>0.1.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>bulldog-board-raspberrypi</artifactId>
  <packaging>jar</packaging>

  <name>${project.groupId}:${project.artifactId}</name>

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

  <dependencies>
    <dependency>
      <groupId>io.silverspoon</groupId>
      <artifactId>bulldog-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.silverspoon</groupId>
      <artifactId>bulldog-linux</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.silverspoon</groupId>
      <artifactId>bulldog-linux-native-raspberrypi</artifactId>
      <version>${project.version}</version>
      <type>so</type>
      <scope>compile</scope>
    </dependency>
  </dependencies>

  <!-- Package the *.so library so we can load it directly from classpath -->
  <build>
    <plugins>
      <!-- RETRIEVE THE JNI NATIVE LIBRARY DEPENDENCY -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <phase>validate</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>io.silverspoon</groupId>
                  <artifactId>bulldog-linux-native-raspberrypi</artifactId>
                  <version>${project.version}</version>
                  <type>so</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                  <destFileName>bulldog-linux-native-raspberrypi.so</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- EMBED THE JNI NATIVE LIBRARY INSIDE THE JAR -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>embed-jni-native-resource</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${project.build.directory}/lib</directory>
                  <targetPath>lib</targetPath>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
