]> git.mxchange.org Git - jprojects-scripts.git/blob - build-dist-all.sh
Continued:
[jprojects-scripts.git] / build-dist-all.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 for project in ${LIST}; do
6         if [ "${project}" = "jprojects-scripts" ]
7         then
8                 echo "$0: Skipping jprojects-scripts ..."
9                 continue
10         elif [ ! -d "${JPROJECTS_HOME}/${project}" ]
11         then
12                 echo "$0: Project '${project}' does not exist."
13                 continue
14         fi
15
16         echo "$0: Executing '${project}' ..."
17         P=${project%/*}
18
19         echo "$0: P='${P}'"
20         cd "${JPROJECTS_HOME}/${P}" || exit 255
21
22         if [ ! -f "build.xml" ]
23         then
24                 echo "$0: No build.xml found, skipping project '${P}'."
25                 continue
26         fi
27
28         if [ "$1" != "d" ]
29         then
30                 if [ "$1" = "c" ]
31                 then
32                         # Cleanup
33                         echo "$0: Cleaning up '${project}' ..."
34                         "${ANT_BIN}" clean
35                 fi
36
37                 # Build JAR
38                 echo "$0: Building JAR for '${project}' ..."
39                 "${ANT_BIN}" jar
40
41                 # Save status
42                 STATUS="$?"
43
44                 # Has it failed?
45                 if [ "${STATUS}" != "0" ]
46                 then
47                         # This has failed, so try "dist"
48                         "${ANT_BIN}" dist
49                         STATUS="$?"
50
51                         # Still failing? Oh, to bad
52                         if [ "${STATUS}" != "0" ]
53                         then
54                                 echo "$0: Failed to build '${project}'."
55                                 exit 1
56                         fi
57                 fi
58         fi
59
60         if [ ! -f "./dist.sh" ]
61         then
62                 echo "$0: Project '${project}' has no dist.sh"
63         elif [ ! -e "./dist.sh" ]
64         then
65                 echo "$0: Error: Project '${project}' has non-executable dist.sh!"
66                 exit 1
67         else
68                 if [ "$1" = "r" ]
69                 then
70                         ./dist.sh r
71                 else
72                         ./dist.sh
73                 fi
74         fi
75 done
76
77 echo "$0: All done."
78 exit 0