forked from BitcoinJake09/CryptoPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat.sh
47 lines (40 loc) · 1.44 KB
/
format.sh
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
#Exit code :
# 0 work
# 1x google java format download error
# 10 fail google java format download
# 2x formating error
# 20 fail src/.../cryptoplugin/ format
# 21 fail src/.../cryptoplugin/commands/ format
# 22 fail src/.../cryptoplugin/events/ format
#Setting pwd to our path
DIR=$0
if [[ $DIR != /* ]] ; then
cd $(pwd)/$(dirname $0)
fi
# First step check if user have google format downloaded
if [ -e google-java-format-1.5-all-deps.jar ] ; then
echo "google java format all ready downloaded"
else
wget "https://github.com/google/google-java-format/releases/download/google-java-format-1.5/google-java-format-1.5-all-deps.jar"
if [ $? != 0 ] ; then
exit 10
fi
fi
# google java format need to be executed with pwd cryptoplugin/ or it will change import in a way to create compilation error.
chmod u+x google-java-format-1.5-all-deps.jar
java -jar google-java-format-1.5-all-deps.jar -r src/main/java/com/cryptoplugin/cryptoplugin/*.java
if [ $? != 0 ] ; then
exit 20
fi
java -jar google-java-format-1.5-all-deps.jar -r src/main/java/com/cryptoplugin/cryptoplugin/commands/*.java
if [ $? != 0 ] ; then
exit 21
fi
java -jar google-java-format-1.5-all-deps.jar -r src/main/java/com/cryptoplugin/cryptoplugin/events/*.java
if [ $? != 0 ] ; then
exit 22
fi
# google java format need to be executed with pwd cryptoplugin/ or it will change import in a way to create compilation error.
chmod u-x google-java-format-1.5-all-deps.jar
exit 0