-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-script-part3.sh
More file actions
executable file
·47 lines (41 loc) · 1.67 KB
/
Copy pathbuild-script-part3.sh
File metadata and controls
executable file
·47 lines (41 loc) · 1.67 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
45
46
47
#!/bin/bash
directories=`ls`
jarName="ciff-image-shrinker.jar"
mainClass="com.ozone.ciff.DecreaseSizeOfAnImage"
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 -XDignore.symbol.file -cp $libraries_for_compiler -d bin $(find . -name "*.java" | grep -v Test) && echo "Class-Path: " > manifest.txt && for i in $libraries_for_manifest; do echo " libs/"$i" " >> manifest.txt ; done && echo "Main-Class: "$mainClass >> manifest.txt && cd bin && jar -cvfm ../$jarName ../manifest.txt *
echo "Build succeeded. To run, use: java -jar "$jarName
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 -XDignore.symbol.file -d bin $(find . -name "*.java" | grep -v Test) && cd bin && echo "Main-Class: "$mainClass > manifest.txt && jar -cvfm $jarName manifest.txt * && mv $jarName ../
echo "Build succeeded. To run, use: java -jar "$jarName
else
echo "build-script is not in a java project. Please move the script directly in a java project."
exit 1
fi