Skip to content
Permalink
Browse files

set up jni build in maven

  • Loading branch information...
joshbooks committed Apr 1, 2019
1 parent 9f0e78d commit 86985e9c5cd83311da9e6aeabc3d6315b4aadff1
Showing with 63 additions and 8 deletions.
  1. +2 −0 JoshDB.iml
  2. +1 −0 main/main.iml
  3. +12 −8 main/src/org/josh/JoshDB/FileTrie/MergeFile.java
  4. +47 −0 pom.xml
  5. +1 −0 resources/.gitkeep
@@ -6,10 +6,12 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/main/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.github.adamheinrich:native-utils:master-e6a3948966-1" level="project" />
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.3.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.6.1" level="project" />
@@ -11,5 +11,6 @@
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.4.11" level="project" />
<orderEntry type="library" name="Maven: com.boundary:high-scale-lib:1.0.6" level="project" />
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.3.7" level="project" />
<orderEntry type="library" name="Maven: com.github.adamheinrich:native-utils:master-e6a3948966-1" level="project" />
</component>
</module>
@@ -1,5 +1,6 @@
package org.josh.JoshDB.FileTrie;

import cz.adamh.utils.NativeUtils;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
import org.slf4j.LoggerFactory;

@@ -18,19 +19,22 @@
{
static
{
try
{
NativeUtils.loadLibraryFromJar("/resources/jniUtilLib.solib");
}
catch (IOException e)
{
try
{
System.load("/home/flatline/src/JoshDB/jniUtilLib.solib");
System.load("/home/flatline/src/JoshDB/jniUtilLib.solib");
}
catch (UnsatisfiedLinkError e)
catch (UnsatisfiedLinkError ule)
{
// TODO I guess NativeUtils is going to be the best way to
// load a jni lib from a jar, then have System.load as a fallback
// for testing. A static block with that logic seems like something
// that could be automagically inserted with a bach script :D
System.out.println("Couldn't load native lib");
System.exit(1);
System.out.println("Couldn't load native lib");
System.exit(1);
}
}
}

// all objects representations stored to file will take up a positive
47 pom.xml
@@ -4,10 +4,52 @@
<groupId>org.josh.JoshDB</groupId>
<artifactId>JoshDB</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<build>
<sourceDirectory>main/src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.6.0</version>
<executions>
<execution><!-- Run our jni build script -->
<id>JNI Make</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/jniUtil/jniMake.sh</executable>
</configuration>
</execution>
<execution><!-- copy jni lib to resources dir -->
<id>copy JNI lib</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cp</executable>
<arguments>
<argument>jniUtilLib.solib</argument>
<argument>resources/</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -21,6 +63,11 @@
</build>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.github.adamheinrich</groupId>
<artifactId>native-utils</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
@@ -0,0 +1 @@

0 comments on commit 86985e9

Please sign in to comment.
You can’t perform that action at this time.