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