Skip to content

Instantly share code, notes, and snippets.

@saltnlight5
Created November 15, 2012 01:19
Show Gist options
  • Save saltnlight5/4076022 to your computer and use it in GitHub Desktop.
Save saltnlight5/4076022 to your computer and use it in GitHub Desktop.
kotlinc_bin tools
#!/usr/bin/env bash
# Author: Zemian Deng, Date: 2012-11-13_22:53:54
#
# Compile Kotlin source files and write into 'out' directory.
#
KOTLIN_DIR=$(cd $(dirname $0)/.. && pwd)
SRC='$KOTLIN_DIR/src'
if [[ $# -ge 1 ]]; then SRC=$1; shift; fi
CP=${CP:=}
for F in `ls -1 $KOTLIN_DIR/lib/*.jar`; do
CP="$F:$CP"
done
KOTLIN_CMD=$KOTLIN_DIR/bin/kotlinc-jvm
if [[ "$OS" == Windows* ]]; then
CP=`cygpath -mp $CP`
KOTLIN_CMD="$KOTLIN_CMD.bat"
fi
$KOTLIN_CMD -classpath "$CP" -output $KOTLIN_DIR/out -src $SRC "$@"
#!/usr/bin/env bash
# Author: Zemian Deng, Date: 2012-11-13_22:53:54
#
# Run Kotlin Program. User only needs to give the package name, and it will auto add the .namepace suffix.
#
KOTLIN_DIR=$(cd $(dirname $0)/.. && pwd)
PKG='namespace'
if [[ $# -ge 1 ]]; then PKG="$1.namespace"; shift; fi
CP=${CP:=}
CP="$KOTLIN_DIR/out:$CP"
for F in `ls -1 $KOTLIN_DIR/lib/*.jar`; do
CP="$F:$CP"
done
if [[ "$OS" == Windows* ]]; then CP=`cygpath -mp $CP`; fi
java -cp "$CP" $PKG "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment