Repository: yetus
Updated Branches:
  refs/heads/master 5c8df77f2 -> a08fcef86


YETUS-258. build.sh should detect missing third party dependecies and suggest 
how to install

Signed-off-by: Kengo Seki <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/a08fcef8
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/a08fcef8
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/a08fcef8

Branch: refs/heads/master
Commit: a08fcef86d63d14f974c71f7c76eb2bebbc089e3
Parents: 5c8df77
Author: Wei-Chiu Chuang <[email protected]>
Authored: Tue Dec 22 11:34:00 2015 -0800
Committer: Kengo Seki <[email protected]>
Committed: Thu Dec 24 05:37:25 2015 +0900

----------------------------------------------------------------------
 build.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/a08fcef8/build.sh
----------------------------------------------------------------------
diff --git a/build.sh b/build.sh
index d3e92a2..ccdebb2 100755
--- a/build.sh
+++ b/build.sh
@@ -24,6 +24,37 @@
 #   * maven 3.2.0+
 #   * jdk 1.7+ (1.7 in --release)
 #   * ruby + gems needed to run middleman
+
+## @description  Verify that all required dependencies exist
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+## @return       1 - Some dependencies are missing
+## @return       0 - All dependencies exist
+function detect_dependencies
+{
+  local exit_code=0
+  if ! [ -x "$(command -v java)" ]; then
+    echo "Java not found! Must install JDK version >= 1.7" >&2
+    exit_code=1
+  fi
+  if ! [ -x "$(command -v mvn)" ]; then
+    echo "Apache Maven not found! Must install version >= 3.2.0" >&2
+    echo "Download it at https://maven.apache.org/download.cgi"; >&2
+    exit_code=1
+  fi
+  if ! [ -x "$(command -v bundle)" ]; then
+    echo "building docs requires a Ruby executable bundle." >&2
+    echo "Install it by executing 'gem install bundler && bundle install'" >&2
+    exit_code=1
+  fi
+
+  if [[ "${exit_code}" -ne "0" ]]; then
+    echo "Some dependencies are missing. Exit now." >&2
+  fi
+  return ${exit_code}
+}
+
 YETUS_VERSION=$(cat VERSION)
 
RAT_DOWNLOAD_URL=https://repo1.maven.org/maven2/org/apache/rat/apache-rat/0.11/apache-rat-0.11.jar
 
@@ -38,6 +69,8 @@ for arg in "$@"; do
 done
 
 echo "working on version '${YETUS_VERSION}'"
+
+detect_dependencies
 mkdir -p target
 
 if [ "${offline}" != "true" ]; then

Reply via email to