-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-script.sh
More file actions
executable file
·44 lines (40 loc) · 1.63 KB
/
Copy pathbuild-script.sh
File metadata and controls
executable file
·44 lines (40 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
mainclasspath="com.ozone.main.Main"
directories=`ls`
src="src"
bin="bin"
libs="libs"
if [[ " ${directories[@]} " =~ $libs ]]; then
echo "Including Libraries..."
libraries_for_compiler=`echo $(ls libs/) | perl -pe 's/jar/jar:/g' | perl -pe 's/ //g' | perl -pe 's/:$//g' | perl -pe 's/:/:libs\//g' | perl -pe 's/^/libs\//g'`
libraries_for_manifest=`echo $(ls libs/)`
echo $libraries_for_compiler
echo $libraries_for_manifest
if [[ " ${directories[@]} " =~ $bin ]]; then
echo "Recompiling..."
rm -r $bin/
else
echo "Compiling..."
fi
if [[ " ${directories[@]} " =~ $src ]]; then
mkdir bin && javac -cp $libraries_for_compiler -d bin $(find . -name "*.java" | egrep -v "^\./test/") && echo "Class-Path: " > manifest.txt && for i in $libraries_for_manifest; do echo " libs/"$i" " >> manifest.txt ; done && echo "Main-Class: "$mainclasspath >> manifest.txt && cd bin && jar -cvfm ../runnable.jar ../manifest.txt *
echo "Build succeeded. To run, use: java -jar runnable.jar"
else
echo "build-script is not in a java project. Please move the script directly in a java project."
exit 1
fi
exit 1
fi
if [[ " ${directories[@]} " =~ $bin ]]; then
echo "Recompiling..."
rm -r $bin/
else
echo "Compiling..."
fi
if [[ " ${directories[@]} " =~ $src ]]; then
mkdir bin && javac -d bin $(find . -name "*.java" | egrep -v "^\./test/") && cd bin && echo "Main-Class: "$mainclasspath > manifest.txt && jar -cvfm runnable.jar manifest.txt * && mv runnable.jar ../
echo "Build succeeded. To run, use: java -jar runnable.jar"
else
echo "build-script is not in a java project. Please move the script directly in a java project."
exit 1
fi