Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Sep 7, 2012
2 parents f186144 + 76d7afb commit 762a522
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
30 changes: 23 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ MAKE="make -j8"
JAVA_INC="include"
JAVA_BIN="bin"
JNI_LIB_SUFFIX=""
JNI_LIB_INST_DIR="lib/jni" # Absolute or relative to installation prefix


# Setup OS specific stuff
Expand All @@ -19,6 +20,7 @@ if [ "$OS" = "Darwin" ]; then
JAVA_INC="Headers"
JAVA_BIN="Commands"
JNI_LIB_SUFFIX=".jnilib"
JNI_LIB_INST_DIR="/System/Library/Java/Extensions"
fi


Expand Down Expand Up @@ -141,12 +143,28 @@ case "$MODE" in

"install")
PREFIX="$1"
PREFIX_WAS_SPECIFIED="$PREFIX"
if [ -z "$PREFIX" ]; then
PREFIX="/usr/local"
fi
(cd "$TIGHTDB_JAVA_HOME/tightdb_jni/src" && $MAKE prefix="$PREFIX" install) || exit 1
if [ "$JNI_LIB_SUFFIX" ]; then
(cd "$PREFIX/lib/jni" && ln -s "libtightdb-jni.so" "libtightdb-jni$JNI_LIB_SUFFIX") || exit 1
if [ "$JNI_LIB_SUFFIX" -a "$JNI_LIB_SUFFIX" != ".so" -o "$JNI_LIB_INST_DIR" -a "$JNI_LIB_INST_DIR" != "lib" ]; then
SUFFIX="${JNI_LIB_SUFFIX:-.so}"
INST_DIR="${JNI_LIB_INST_DIR:-lib}"
if [ "$PREFIX_WAS_SPECIFIED" ]; then
if printf "%s\n" "$INST_DIR" |grep '^/' >/dev/null; then
INST_DIR="lib"
fi
fi
if ! printf "%s\n" "$INST_DIR" |grep '^/' >/dev/null; then
INST_DIR="$PREFIX/$INST_DIR"
fi
if [ "$INST_DIR" = "$PREFIX/lib" ]; then
(cd "$INST_DIR" && ln -f -s "libtightdb-jni.so" "libtightdb-jni$SUFFIX") || exit 1
else
install -d "$INST_DIR" || exit 1
(cd "$INST_DIR" && ln -f -s "$PREFIX/lib/libtightdb-jni.so" "libtightdb-jni$SUFFIX") || exit 1
fi
fi
install -d "$PREFIX/share/java" || exit 1
install -m 644 "src/main/tightdb.jar" "$PREFIX/share/java" || exit 1
Expand All @@ -157,13 +175,11 @@ case "$MODE" in
"test-installed")
PREFIX="$1"
find_java || exit 1
if [ -z "$PREFIX" ]; then
if [ "$PREFIX" ]; then
JAVA="$JAVA -Djava.library.path=$PREFIX/lib"
else
PREFIX="/usr/local"
fi
# FIXME: For which PREFIX, if any, is $PREFIX/lib/jni automatically in java.library.path? (Ubuntu, other Linuxes, Darwin, ...)
if [ "$PREFIX" != "/usr/local" ]; then
JAVA="$JAVA -Djava.library.path=$PREFIX/lib/jni"
fi
cd "$TIGHTDB_JAVA_HOME/test-installed" || exit 1
TEMP_DIR="$(mktemp -d /tmp/tightdb.java.test-installed.XXXX)" || exit 1
export CLASSPATH="$PREFIX/share/java/tightdb.jar:."
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/tightdb/ColumnType.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.tightdb;

// Make sure numbers match with <tightdb/column_type.hpp>

public enum ColumnType {
ColumnTypeInt(0),
ColumnTypeBool(1),
ColumnTypeString(2),
ColumnTypeStringEnum(3), // This is NOT a user selectable datatype - You can not create a table containing this type
// FIXME: Try to get rid of this one!
ColumnTypeStringEnum(3), // This is NOT a user selectable datatype - You can not create a table containing this type
ColumnTypeBinary(4),
ColumnTypeTable(5),
ColumnTypeMixed(6),
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/tightdb/lib/TableColumnsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void shouldFindAllRecordsByColumnValue()
assertEquals(0, view.size());
}

@Test(enabled = false)
@Test(enabled=false)
public void shouldAggregateColumnValue() {
assertEquals(EmployeesFixture.EMPLOYEES[0].salary,
employees.salary.minimum());
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/tightdb/lib/TableQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void shouldCalculateStatistics() {
assertEquals(40000, results.salary.sum(0, 2, 100)); // both
}

@Test
@Test(enabled=false)
public void shouldMatchOnSimpleStringCriteria() {
assertEquals(1, employees.firstName.eq("John").findAll().size());
assertEquals(1, employees.firstName.equal("John").findAll().size());
Expand Down Expand Up @@ -182,4 +182,4 @@ public void shouldntRemoveNonMatchingRows() {
assertEquals(3, employees.size());
}

}
}
2 changes: 1 addition & 1 deletion src/test/java/com/tightdb/lib/ViewColumnsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void shouldFindAllRecordsByColumnValue()
assertEquals(0, view.size());
}

@Test(enabled = false)
@Test(enabled=false)
public void shouldAggregateColumnValue() {
assertEquals(EmployeesFixture.EMPLOYEES[0].salary,
employeesView.salary.minimum());
Expand Down
5 changes: 1 addition & 4 deletions tightdb_jni/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
EXTRA_INSTALL_PREFIXES = jni

jni_LIBRARIES = libtightdb-jni.a
jni_DIR = $(jnidir)
lib_LIBRARIES = libtightdb-jni.a

libtightdb_jni_a_SOURCES = $(wildcard *.cpp)
libtightdb_jni_a_LDFLAGS = -ltightdb -lproc
Expand Down

0 comments on commit 762a522

Please sign in to comment.