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