mirror of
https://github.com/sigmasternchen/NurseBot
synced 2025-03-16 00:28:58 +00:00
automatic version determine
This commit is contained in:
parent
e7ce527aba
commit
61a756eea4
2 changed files with 42 additions and 0 deletions
|
@ -1,9 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEPLOY=$1
|
||||||
|
VERSIONS=./versions
|
||||||
|
|
||||||
EXIT_SUCCESS=0
|
EXIT_SUCCESS=0
|
||||||
EXIT_COMPILE_FAILED=1
|
EXIT_COMPILE_FAILED=1
|
||||||
EXIT_PACKING_FAILED=2
|
EXIT_PACKING_FAILED=2
|
||||||
EXIT_INSTRUMENTATION_FAILED=3
|
EXIT_INSTRUMENTATION_FAILED=3
|
||||||
|
EXIT_READY_FAILED=4
|
||||||
|
|
||||||
mkdir -p ../bin/
|
mkdir -p ../bin/
|
||||||
mkdir -p ../build/
|
mkdir -p ../build/
|
||||||
|
@ -11,28 +15,61 @@ mkdir -p ../build/NurseBot_lib/
|
||||||
|
|
||||||
pushd ../src/
|
pushd ../src/
|
||||||
|
|
||||||
|
echo "Building... "
|
||||||
javac -cp $(find ../build/NurseBot_lib -iname "*.jar" | tr "\n" ":") -d ../bin/ $(find ./ -iname "*.java")
|
javac -cp $(find ../build/NurseBot_lib -iname "*.jar" | tr "\n" ":") -d ../bin/ $(find ./ -iname "*.java")
|
||||||
if test ! $? = 0; then
|
if test ! $? = 0; then
|
||||||
|
echo "... failed"
|
||||||
exit $EXIT_COMPILE_FAILED
|
exit $EXIT_COMPILE_FAILED
|
||||||
fi
|
fi
|
||||||
|
echo "... done"
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd ../bin/
|
pushd ../bin/
|
||||||
|
|
||||||
|
echo "Packing jar..."
|
||||||
jar cmf ../buildtools/MANIFEST.MF ../build/NurseBot.jar $(find ./ -iname "*.class")
|
jar cmf ../buildtools/MANIFEST.MF ../build/NurseBot.jar $(find ./ -iname "*.class")
|
||||||
if test ! $? = 0; then
|
if test ! $? = 0; then
|
||||||
|
echo "... failed"
|
||||||
exit $EXIT_PACKING_FAILED
|
exit $EXIT_PACKING_FAILED
|
||||||
fi
|
fi
|
||||||
|
echo "... done"
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
echo "Building instrumentation..."
|
||||||
./instrumentation.sh
|
./instrumentation.sh
|
||||||
if test ! $? = 0; then
|
if test ! $? = 0; then
|
||||||
|
echo "... failed"
|
||||||
exit $EXIT_INSTRUMENTATION_FAILED
|
exit $EXIT_INSTRUMENTATION_FAILED
|
||||||
fi
|
fi
|
||||||
|
echo "... done"
|
||||||
|
|
||||||
|
echo "Copying instrumentation..."
|
||||||
cp ../bin/activejdbc_models.properties ../build/
|
cp ../bin/activejdbc_models.properties ../build/
|
||||||
|
if test ! $? = 0; then
|
||||||
|
echo "... failed"
|
||||||
|
exit $EXIT_INSTRUMENTATION_FAILED
|
||||||
|
fi
|
||||||
|
echo "... done"
|
||||||
|
|
||||||
|
pushd ../build
|
||||||
|
echo "Determine version..."
|
||||||
|
version=$(java -jar NurseBot.jar -v)
|
||||||
|
echo "This is version $version."
|
||||||
|
|
||||||
|
if test ! "$DEPLOY" = ""; then
|
||||||
|
echo "Set to deploy..."
|
||||||
|
cp NurseBot.jar $DEPLOY/$VERSERIONS
|
||||||
|
if test ! $? = 0; then
|
||||||
|
echo "... failed"
|
||||||
|
exit $EXIT_READY_FAILED
|
||||||
|
fi
|
||||||
|
echo "... done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Overall done."
|
||||||
|
popd
|
||||||
|
|
||||||
exit $EXIT_SUCCESS
|
exit $EXIT_SUCCESS
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,11 @@ public class NurseNoakes extends TelegramLongPollingBot {
|
||||||
private static final int EXIT_CODE_INSTRUMENTATION_MISSING = 10;
|
private static final int EXIT_CODE_INSTRUMENTATION_MISSING = 10;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
if (Arrays.asList(args).contains("-v")) {
|
||||||
|
System.out.println(VERSION);
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
ApiContextInitializer.init();
|
ApiContextInitializer.init();
|
||||||
|
|
||||||
TelegramBotsApi botsApi = new TelegramBotsApi();
|
TelegramBotsApi botsApi = new TelegramBotsApi();
|
||||||
|
|
Loading…
Reference in a new issue