-
Notifications
You must be signed in to change notification settings - Fork 62
/
build.bsh
executable file
·163 lines (127 loc) · 3.77 KB
/
build.bsh
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
JARS=lib/xstream-1.1.2.jar:lib/mail-1.4.jar:lib/junit-3.8.1.jar:lib/jaudiotagger-1.0.8.jar:lib/velocity-1.6.4.jar:lib/commons-collections-3.2.1.jar:lib/commons-fileupload-1.2.1.jar:lib/activation-1.1.jar:lib/httpunit-1.6.2.jar:lib/tidy.jar:lib/jdom-1.0.jar:lib/mail-1.4.1.jar:lib/servlet-api-2.4.jar:lib/gwt-user.jar:lib/itext-2.0.2.jar:lib/gwt-dnd.jar:lib/log4j-1.2.14.jar:lib/google-collect-1.0-rc1.jar:lib/gdata-client-1.0.jar:lib/gdata-contacts-3.0.jar:lib/gdata-core-1.0.jar:lib/oacurl-1.0.0.jar:lib/openid4java-0.9.5.jar:lib/testng-5.8.jar
SRC=`pwd`
BUILD=$SRC/.build
BUILD_CLASSES=$BUILD/classes
BUILD_JAVADOC=$BUILD/javadoc
DEST=$BUILD/ilarkesto
DEST_BIN=$DEST/bin
DEST_TOOLS=$DEST/tools
DEST_BASHRC=$DEST/bashrc
DEST_JAR=$DEST/jar
DEST_IMG=$DEST/img
# checking if in project dir
############################
if [ ! -f "src/main/java/ilarkesto/Servers.java" ]
then
echo "$0: build must be started from the organizanto project dir"
exit 1
fi
echo ""
echo "###############"
echo "# cleaning up #"
echo "###############"
rm -rf $DEST
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "##############################"
echo "# building main bash-scripts #"
echo "##############################"
mkdir -p $DEST_BIN
cd $SRC/src/main/bash
for file in $( find . -name '*.bsh' )
do
file=${file#./}
filename=${file%.bsh}
echo " ${filename}"
destfile=$DEST_BIN/$filename
cp $file $destfile
if [ $? != 0 ]; then exit 1; fi
done
#chown root:root $DEST_BIN/*
#if [ $? != 0 ]; then exit 1; fi
chmod 555 $DEST_BIN/*
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "####################################"
echo "# building additional bash-Scripts #"
echo "####################################"
mkdir -p $DEST_TOOLS
cd $SRC/src/tools/bash
for file in $( find . -name '*.bsh' )
do
file=${file#./}
filename=${file%.bsh}
echo " ${filename}"
destfile=$DEST_TOOLS/$filename
cp $file $destfile
if [ $? != 0 ]; then exit 1; fi
done
#chown root:root $DEST_TOOLS/*
#if [ $? != 0 ]; then exit 1; fi
chmod 555 $DEST_TOOLS/*
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "############################"
echo "# building bashrc-includes #"
echo "############################"
mkdir -p $DEST_BASHRC
cp $SRC/src/main/bashrc/* $DEST_BASHRC
if [ $? != 0 ]; then exit 1; fi
#chown root:root $DEST_BASHRC/*
#if [ $? != 0 ]; then exit 1; fi
chmod 444 $DEST_BASHRC/*
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "###################"
echo "# building images #"
echo "###################"
mkdir -p $DEST_IMG
cp -r $SRC/img/* $DEST_IMG
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "############################"
echo "# downloading dependencies #"
echo "############################"
cd $SRC
$SRC/update-libs.bsh
echo ""
echo "################"
echo "# building jar #"
echo "################"
cd $SRC
find src/main/java -name "*.java" > $BUILD/java-files
mkdir -p $BUILD_CLASSES
javac -nowarn -encoding UTF-8 -cp $JARS -sourcepath src/main/java/ -d $BUILD_CLASSES @$BUILD/java-files
if [ $? != 0 ]; then exit 1; fi
mkdir -p $DEST_JAR
cp -r src/main/java/* $BUILD_CLASSES
find $BUILD_CLASSES -name ".svn" -exec rm -rf {} \;
find $BUILD_CLASSES -name "*.java" -exec rm {} \;
cd $BUILD_CLASSES
jar -cf $DEST_JAR/ilarkesto.jar *
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "-> $DEST_JAR/ilarkesto.jar"
# echo ""
# echo "####################"
# echo "# building javadoc #"
# echo "####################"
#
# cd $SRC
# mkdir -p $BUILD_JAVADOC
# javadoc -quiet -encoding UTF-8 -d $BUILD_JAVADOC @$BUILD/java-files
# if [ $? != 0 ]; then exit 1; fi
echo ""
echo "####################"
echo "# building tarball #"
echo "####################"
cd $BUILD
tar -cvz --owner=root --group=root -f ilarkesto.tar.gz ilarkesto
if [ $? != 0 ]; then exit 1; fi
echo ""
echo "-> $BUILD/ilarkesto.tar.gz"
echo ""
echo "#######"
echo "# :-D #"
echo "#######"