--- a/shellfiles/build_mercurial.sh Sun Jun 09 02:15:40 2013 +0200
+++ b/shellfiles/build_mercurial.sh Tue Jun 11 13:56:58 2013 +0200
@@ -1,10 +1,16 @@
-#!/bin/bash
-
-# Simple Unix shell script to build STX:LIBJAVA using Jenkins CI
-# Actually, it is used on Windows (with UnxUtils) as well.
+#!/bin/bash
+# Simple Unix shell script to build Mercurial using Jenkins CI
+# Designed to run under Cygwin as well.
PROJECT="Mercurial Support"
+
+# ### START OF common.sh.in ##########################################
+#
+# Common set of function to build a project.
+#
+
+
# Determine operating system, bit simple but works
if [ "$OS" == "Windows_NT" ]; then
WIN32=1
@@ -14,8 +20,29 @@
UNIX=1
fi
+# =====================================================
# Utility functions
+# =====================================================
+
+# Simple logging functions
+function info {
+ echo "[INF] $1"
+ if [ ! -z "$2" ]; then
+ echo " $2"
+ fi
+}
+
+function error {
+ echo "[ERR] $1"
+ if [ ! -z "$2" ]; then
+ echo " $2"
+ fi
+ exit 1
+}
+
+# Run make in current directory. Caller should cd to target
+# directory before calling this method.
function mk {
if [ "$WIN32" == "1" ]; then
cmd /C bmake.bat $1 $2
@@ -31,34 +58,19 @@
fi
}
-function sunit {
+# Run tests for package specified in first argument.
+function sunit {
pushd stx/goodies/builder/reports
info "Running tests for $1"
if [ "$WIN32" == "1" ]; then
- cmd /C report-runner.bat -D . -r Builder::TestReport -p "$1" || error "Failed to run reports"
+ cmd /C report-runner.bat -D ../../../.. -r Builder::TestReport -p "$1" || error "Failed to run reports"
else
- (echo "" | ./report-runner.sh -D . -r Builder::TestReport -p "$1") || error "Failed to run reports"
+ (echo "" | ./report-runner.sh -D ../../../.. -r Builder::TestReport -p "$1") || error "Failed to run reports"
fi
popd
}
-
-function info {
- echo "[INF] $1"
- if [ ! -z "$2" ]; then
- echo " $2"
- fi
-}
-
-function error {
- echo "[ERR] $1"
- if [ ! -z "$2" ]; then
- echo " $2"
- fi
- exit 1
-}
-
-# Main function
+# Main function. Performs complete build or given task
function main {
pushd "$BUILD"
if [ -z "$1" ]; then
@@ -91,6 +103,7 @@
}
# Setup...
+
if [ "$WIN32" == "1" ]; then
# WINDOWS
# MUST export this, otherwise libjpeg fails to build!!!"
@@ -116,19 +129,6 @@
# Sorry, it's lot easier for all to have all the messages in EN :-)
export LANG=en_GB.UTF-8
-# Functions to override:
-function checkout {
- error "You have to override function 'checkout'"
-}
-
-function compile {
- error "You have to override function 'compile'"
-}
-
-function runtests {
- info "No tests specified" "To do so, override function runtests"
-}
-
# When run interactively, Jenkins env variables
# may not be set...
if [ -z "$WORKSPACE" ]; then
@@ -161,6 +161,27 @@
mkdir -p "$BUILD"
fi
+
+# ===================================================================
+# Actual build functions.
+# ===================================================================
+#
+# User scripts should override following functions to define a build
+
+function checkout {
+ error "You have to override function 'checkout'"
+}
+
+function compile {
+ error "You have to override function 'compile'"
+}
+
+function runtests {
+ info "No tests specified" "To do so, override function runtests"
+}
+
+# ### END OF common.sh.in ############################################
+
# Checkout
function checkout {
# Checkout stx
@@ -168,8 +189,8 @@
if ! cvs co stx; then
error "CVS: Cannot checkout stx";
fi
- else
- (cd stx && cvs update -d)
+ #else
+ # (cd stx && cvs update -d)
fi
# Checkout stx:libscm