foo-user-ejb are now merged into foo-ejb to ease deployment.
[jprojects-scripts.git] / build-dist-all.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 for DIST in ${LIST}; do
6         echo "$0: Executing '${DIST}' ..."
7         P=${DIST%/*}
8
9         echo "$0: P='${P}'"
10         cd "${JPROJECTS_HOME}/${P}" || exit 255
11
12         if [ ! -e "build.xml" ]
13         then
14                 echo "$0: No build.xml found, skipping project '${P}'."
15                 continue
16         fi
17
18         if [ "$1" != "d" ]
19         then
20                 # Cleanup project and build JAR
21                 ant clean jar
22
23                 # Save status
24                 STATUS="$?"
25
26                 # Has it failed?
27                 if [ "${STATUS}" != "0" ]
28                 then
29                         # This has failed, so try "dist"
30                         ant clean dist
31                         STATUS="$?"
32
33                         # Still failing? Oh, to bad
34                         if [ "${STATUS}" != "0" ]
35                         then
36                                 echo "$0: Failed to build '${DIST}'."
37                                 exit 1
38                         fi
39                 fi
40         fi
41
42         if [ ! -f "./dist.sh" ]
43         then
44                 echo "$0: Project '${DIST}' has no dist.sh"
45         elif [ ! -e "./dist.sh" ]
46         then
47                 echo "$0: Error: Project '${DIST}' has non-executable dist.sh!"
48                 exit 1
49         else
50                 ./dist.sh
51         fi
52 done
53
54 echo "$0: All done."
55 exit 0