The last commit from my workplace removed push-stick.sh, which was not intended.
[jprojects-scripts.git] / build-dist-all.sh
index 1738107..aeb747e 100755 (executable)
@@ -2,9 +2,15 @@
 
 . ./.jprojects.sh || exit 255
 
-for DIST in ${LIST}; do
-       echo "$0: Executing '${DIST}' ..."
-       P=${DIST%/*}
+for project in ${LIST}; do
+       if [ ! -d "${JPROJECTS_HOME}/${project}" ]
+       then
+               echo "$0: Project '${project}' does not exist."
+               continue;
+       fi
+
+       echo "$0: Executing '${project}' ..."
+       P=${project%/*}
 
        echo "$0: P='${P}'"
        cd "${JPROJECTS_HOME}/${P}" || exit 255
@@ -15,10 +21,10 @@ for DIST in ${LIST}; do
                continue
        fi
 
-       if [ "$1" != "d" ]
+       if [ -x "${ANT_BIN}" -a "$1" != "d" ]
        then
                # Cleanup project and build JAR
-               ant clean jar
+               ${ANT_BIN} clean jar
 
                # Save status
                STATUS="$?"
@@ -27,13 +33,13 @@ for DIST in ${LIST}; do
                if [ "${STATUS}" != "0" ]
                then
                        # This has failed, so try "dist"
-                       ant clean dist
+                       ${ANT_BIN} clean dist
                        STATUS="$?"
 
                        # Still failing? Oh, to bad
                        if [ "${STATUS}" != "0" ]
                        then
-                               echo "$0: Failed to build '${DIST}'."
+                               echo "$0: Failed to build '${project}'."
                                exit 1
                        fi
                fi
@@ -41,13 +47,18 @@ for DIST in ${LIST}; do
 
        if [ ! -f "./dist.sh" ]
        then
-               echo "$0: Project '${DIST}' has no dist.sh"
+               echo "$0: Project '${project}' has no dist.sh"
        elif [ ! -e "./dist.sh" ]
        then
-               echo "$0: Error: Project '${DIST}' has non-executable dist.sh!"
+               echo "$0: Error: Project '${project}' has non-executable dist.sh!"
                exit 1
        else
-               ./dist.sh
+               if [ "$1" = "r" ]
+               then
+                       ./dist.sh r
+               else
+                       ./dist.sh
+               fi
        fi
 done