#!/bin/bash

set -e

. luan string:

rm -rf build
mkdir -p build/luan_editor/jars
cp $LUAN/jars/luan.jar build/luan_editor/jars
cp $LUAN/jars/miglayout-*.jar build/luan_editor/jars
cp $LUAN/jars/flatlaf-*.jar build/luan_editor/jars
cp lib/*.jar build/luan_editor/jars

. classpath.sh
cd src
javac -classpath $CLASSPATH `find . -name *.java`
jar cvf ../build/luan_editor/jars/luan_editor.jar `find . -name *.class -o -name *.luan`
cd ..

cp -r dictionaries build/luan_editor

cp scripts/install.sh build/luan_editor
cp scripts/uninstall.sh build/luan_editor
hg identify >build/luan_editor/hg_rev.txt

build/luan_editor/install.sh || sudo build/luan_editor/install.sh

echo done
