]> git.mxchange.org Git - jprojects-scripts.git/blobdiff - build-dist-cores.sh
Continued:
[jprojects-scripts.git] / build-dist-cores.sh
diff --git a/build-dist-cores.sh b/build-dist-cores.sh
new file mode 100755 (executable)
index 0000000..2c702fc
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+. ./.jprojects.sh || exit 255
+
+for project in ${LIST}; do
+       IS_CORE="${project: -5}"
+
+       if [ "${project}" = "jprojects-scripts" ]
+       then
+               echo "$0: Skipping jprojects-scripts ..."
+               continue
+       elif [ "${IS_CORE}" != "-core" ]
+       then
+               echo "$0: Project '${project}' is no 'core', skipped."
+               continue
+       elif [ ! -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
+
+       if [ ! -e "build.xml" ]
+       then
+               echo "$0: No build.xml found, skipping project '${P}'."
+               continue
+       fi
+
+       if [ -x "${ANT_BIN}" -a "$1" != "d" ]
+       then
+               if [ "$1" = "c" ]
+               then
+                       # Cleanup
+                       ${ANT_BIN} clean
+               fi
+
+               # Build JAR
+               "${ANT_BIN}" jar
+
+               # Save status
+               STATUS="$?"
+
+               # Has it failed?
+               if [ "${STATUS}" != "0" ]
+               then
+                       # This has failed, so try "dist"
+                       "${ANT_BIN}" dist
+                       STATUS="$?"
+
+                       # Still failing? Oh, to bad
+                       if [ "${STATUS}" != "0" ]
+                       then
+                               echo "$0: Failed to build '${project}'."
+                               exit 1
+                       fi
+               fi
+       fi
+
+       if [ ! -f "./dist.sh" ]
+       then
+               echo "$0: Project '${project}' has no dist.sh"
+       elif [ ! -e "./dist.sh" ]
+       then
+               echo "$0: Error: Project '${project}' has non-executable dist.sh!"
+               exit 1
+       else
+               if [ "$1" = "r" ]
+               then
+                       ./dist.sh r
+               else
+                       ./dist.sh
+               fi
+       fi
+done
+
+echo "$0: All done."
+exit 0