-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathbuildall.sh
executable file
·132 lines (117 loc) · 3.05 KB
/
buildall.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/sh
error() {
decrement_buildnumber
echo "There were errors..."
}
jobCompleted() {
echo "Done!"
}
CLASSPATH=build.~:dist/lib/swing-layout-1.0.1.jar:dist/lib/hfsx_dmglib.jar:lib/java_awt_Desktop.jar
SOURCES_DIR=src
BUILD_DIR=build.~
LIBRARY_PATH=lib
JARFILE_DIR=dist/lib
JARFILE=hfsx.jar
RESOURCE_SRC_DIR=resource
RESOURCE_DST_DIR=$BUILD_DIR/res
BUILDENUM_CP=lib/buildenumerator.jar
removeclassfiles() {
echo "Removing all class files..."
rm -r $BUILD_DIR
mkdir $BUILD_DIR
return $?
}
copyresources() {
echo "Copying resources to classpath..."
mkdir $RESOURCE_DST_DIR
cp $RESOURCE_SRC_DIR/*.png $RESOURCE_DST_DIR
#copy /y \\.\\"%RESOURCE_SRC_DIR%\*.png" "%RESOURCE_DST_DIR%" > NUL:
}
increment_buildnumber() {
echo "Incrementing build number..."
java -cp $BUILDENUM_CP BuildEnumerator $SOURCES_DIR/org/catacombae/hfsexplorer/BuildNumber.java 1
}
decrement_buildnumber() {
echo "Decrementing build number..."
java -cp $BUILDENUM_CP BuildEnumerator $SOURCES_DIR/org/catacombae/hfsexplorer/BuildNumber.java -1
}
buildhfsx() {
echo "Building org.catacombae.hfsexplorer..."
javac -cp $CLASSPATH -sourcepath $SOURCES_DIR -d $BUILD_DIR -Xlint:unchecked $SOURCES_DIR/org/catacombae/hfsexplorer/*.java
return $?
}
buildhfsx_partitioning() {
echo "Building org.catacombae.hfsexplorer.partitioning..."
javac -cp $CLASSPATH -sourcepath $SOURCES_DIR -d $BUILD_DIR -Xlint:unchecked $SOURCES_DIR/org/catacombae/hfsexplorer/partitioning/*.java
return $?
}
buildhfsx_gui() {
echo "Building org.catacombae.hfsexplorer.gui..."
javac -cp $CLASSPATH -sourcepath $SOURCES_DIR -d $BUILD_DIR -Xlint:unchecked $SOURCES_DIR/org/catacombae/hfsexplorer/gui/*.java
return $?
}
buildhfsx_testcode() {
echo "Building org.catacombae.hfsexplorer.testcode..."
javac -cp $CLASSPATH -sourcepath $SOURCES_DIR -d $BUILD_DIR -Xlint:unchecked $SOURCES_DIR/org/catacombae/hfsexplorer/testcode/*.java
return $?
}
buildhfsx_types() {
echo "Building org.catacombae.hfsexplorer.types..."
javac -cp $CLASSPATH -sourcepath $SOURCES_DIR -d $BUILD_DIR -Xlint:unchecked $SOURCES_DIR/org/catacombae/hfsexplorer/types/*.java
return $?
}
buildjar() {
echo "Building jar-file..."
if [ ! -d "$JARFILE_DIR" ]; then # if not exists $LIBRARY_PATH...
echo "Making library path"
mkdir $JARFILE_DIR
fi
jar cf $JARFILE_DIR/$JARFILE -C $BUILD_DIR .
return $?
}
main() {
increment_buildnumber
removeclassfiles
if [ "$?" == 0 ]; then
copyresources
if [ "$?" == 0 ]; then
buildhfsx
if [ "$?" == 0 ]; then
buildhfsx_partitioning
if [ "$?" == 0 ]; then
buildhfsx_gui
if [ "$?" == 0 ]; then
buildhfsx_testcode
if [ "$?" == 0 ]; then
buildhfsx_types
if [ "$?" == 0 ]; then
buildjar
if [ "$?" == 0 ]; then
jobCompleted
else
error
fi
else
error
fi
else
error
fi
else
error
fi
else
error
fi
else
error
fi
else
error
fi
else
error
fi
}
#entry point
main