• Donald H. (Donnie) Pinkston, III's avatar
    Improve support for NanoDB on Windows · efef4169
    Donald H. (Donnie) Pinkston, III authored
    Updated the nanodb script to properly handle being run under Git Bash.
    Needed to wrap the Java program with "winpty" when starting it from Git
    Bash.
    
    Also updated the Surefire configuration to not require all tests to pass
    before building a JAR file.  There are a few tests that aren't working
    on Windows due to file-locking differences from *NIX.
    efef4169
nanodb 1.16 KB
#!/bin/bash

# Look for the NanoDB server JAR file in the target directory
NANODB_SERVER_JAR=`ls target/nanodb-server-*.jar 2>/dev/null`
if [ -z "$NANODB_SERVER_JAR" ]
then
    echo "Can't find NanoDB server JAR file.  Run 'mvn package' to build the project."
    exit 1
fi

JAVA_OPTS="-Dlog4j.configurationFile=log4j2.properties"

# Server properties can be specified as system-property arguments.  Examples:
#  - To change the default page-size to use, add "-Dnanodb.pagesize=2048"
#  - To enable transaction processing, add "-Dnanodb.enableTransactions=on"
# JAVA_OPTS="$JAVA_OPTS -Dnanodb.enableTransactions=on"

# To enable connection to a running server via the IntelliJ IDEA debugger,
# uncomment this line:
# JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009"

PLATFORM=`uname`
if [[ $PLATFORM == *"MINGW"* ]]; then
	# Windows, probably git bash
	WRAPPER=winpty
else
	# See if we have the rlwrap utility; if so, it makes using NanoDB
	# from the command-line sooo much nicer...
	testrl=$(which rlwrap)
	if [ -z "$testrl" ]; then
		# No wrapper
		WRAPPER=
	else
		WRAPPER=rlwrap
	fi
fi

$WRAPPER java $JAVA_OPTS "$@" -jar $NANODB_SERVER_JAR