]> jaekl.net Git - cfb.git/commitdiff
Update script to invoke an analysis from inside Jenkins
authorChris Jaekl <cejaekl@yahoo.com>
Sat, 12 Dec 2015 09:12:15 +0000 (18:12 +0900)
committerChris Jaekl <cejaekl@yahoo.com>
Sat, 12 Dec 2015 09:12:15 +0000 (18:12 +0900)
analyze.sh [deleted file]
jenkins_invoke.sh [new file with mode: 0755]

diff --git a/analyze.sh b/analyze.sh
deleted file mode 100755 (executable)
index 2530a6f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-JOB_NAME=${1}
-BUILD_NUMBER=${2}
-OUT_FILE=${3}
-
-BUILD_WORKSPACE=${SCRIPT_DIR}/../jobs/${JOB_NAME}/workspace
-
-export FINDBUGS_HOME=${SCRIPT_DIR}/../findbugs-3.0.1
-. ./setcp.sh
-
-rm cfb.fbp
-cat >cfb.fbp <<EOF
-<Project projectName="CFB">
-  <Jar>${BUILD_WORKSPACE}/bin</Jar>
-  <SrcDir>${BUILD_WORKSPACE}/src</SrcDir>
-</Project>
-EOF
-
-cat cfb.fbp
-./go.sh -c config.properties -d cfb -u cfb -p cfb -f cfb.fbp -n jenkins_${JOB_NAME}_${BUILD_NUMBER} -o ${OUT_FILE}
diff --git a/jenkins_invoke.sh b/jenkins_invoke.sh
new file mode 100755 (executable)
index 0000000..d3e1b00
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -o nounset   ## (set -u) error exit on attempts to deref undefined variable
+set -o errexit   ## (set -e) error exit if subcommand returns nonzero
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+OUT_FILE=${1}
+
+export FINDBUGS_HOME=${SCRIPT_DIR}/../findbugs-3.0.1
+. ${SCRIPT_DIR}/setcp.sh
+
+echo CLASSPATH=${CLASSPATH}
+echo FINDBUGS_HOME=${FINDBUGS_HOME}
+
+rm cfb.fbp
+cat >cfb.fbp <<EOF
+<Project projectName="CFB">
+  <Jar>${WORKSPACE}/bin</Jar>
+  <SrcDir>${WORKSPACE}/src</SrcDir>
+</Project>
+EOF
+
+cat cfb.fbp
+./go.sh -c ${SCRIPT_DIR}/config.properties -d cfb -u cfb -p cfb -f cfb.fbp -n jenkins_${JOB_NAME}_${BUILD_NUMBER} -o ${OUT_FILE}