Changeset 1705


Ignore:
Timestamp:
2010-09-08 12:51:06 (3 years ago)
Author:
mpo
Message:

making the script suitable for running in hudson context

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/restlet-dependency/make_restlet4kauri.sh

    r1698 r1705  
    11#!/bin/bash 
     2# 
     3# environment variables you can set before running this 
     4# DIR - should point to the directory holding the restlet-svn checkout to build 
     5#   if omitted the script will create a new checkout directory for each version it is building  
     6# TAG - should indicate the revision name to use 
     7#   if omitted the script will assign a tag based on the current restlet-repo-revision number: svn{revision} 
     8# note these are intended to optimise the use in the hudson context at ci.outerthought.org 
     9# when ran locally you should typically let the script assign DIR and TAG 
     10#  
    211 
    312ME=$(basename ${0}); 
     
    514NAME="restlet"; 
    615SVN_TRUNK_URI="http://restlet.tigris.org/svn/restlet/trunk"; 
    7 BUILD_PARAMS="-Dverify=false"; #unsafe build - clear to run tests! 
     16BUILD_PARAMS=${BUILD_PARAMS:-}; # to skip tests use BUILD_PARAMS="-Dverify=false" 
    817JDK_VERSION_TEST="java version \"1.5"; 
    918 
    10 echo "-- ${ME} -- Check JDK version "; 
    11 JAVA_CMD="$(which java)"; 
    12 if [[ -x ${JAVA_HOME}/bin/java ]] ; then 
    13  JAVA_CMD="${JAVA_HOME}/bin/java"; 
     19 
     20if [[ ! -d ${DIR} ]] ; then 
     21  echo "-- ${ME} -- Check JDK version "; 
     22  JAVA_CMD="$(which java)"; 
     23  if [[ -x ${JAVA_HOME}/bin/java ]] ; then 
     24   JAVA_CMD="${JAVA_HOME}/bin/java"; 
     25  fi 
     26  CHECK=$(${JAVA_CMD} -version 2>&1| grep "${JDK_VERSION_TEST}"); 
     27 
     28  if [[ "${CHECK}" = "" ]] ; then 
     29    echo "Java JDK version does not match <<${JDK_VERSION_TEST}>>"; 
     30    exit 1; 
     31  fi  
     32 
     33  echo "-- ${ME} -- Retrieving current trunk revision number "; 
     34  REVISION=$(svn info ${SVN_TRUNK_URI} |grep Revision|sed -e "s/Revision: //"); 
     35  TAG="svn${REVISION}"; 
     36 
     37  SVN_REV_URI="${SVN_TRUNK_URI}@${REVISION}"; 
     38  DIR="${NAME}-${TAG}"; 
     39  echo "-- ${ME} -- Export current trunk revision to ./${DIR}"; 
     40  svn export ${SVN_REV_URI} ${DIR}; 
     41else  
     42  TAG=${TAG:-TEMP_OVERWRITE}; 
    1443fi 
    15 CHECK=$(${JAVA_CMD} -version 2>&1| grep "${JDK_VERSION_TEST}"); 
    16  
    17 if [[ "${CHECK}" = "" ]] ; then 
    18   echo "Java JDK version does not match <<${JDK_VERSION_TEST}>>"; 
    19   exit 1; 
    20 fi  
    21  
    22  
    23 echo "-- ${ME} -- Retrieving current trunk revision number "; 
    24 REVISION=$(svn info ${SVN_TRUNK_URI} |grep Revision|sed -e "s/Revision: //"); 
    25  
    26  
    27 SVN_REV_URI="${SVN_TRUNK_URI}@${REVISION}"; 
    28 DIR="${NAME}-r${REVISION}"; 
    29 echo "-- ${ME} -- Export current trunk revision to ./${DIR}"; 
    30 svn export ${SVN_REV_URI} ${DIR}; 
    3144 
    3245 
     
    3447echo "-- ${ME} -- Generate custom build props to ./${PROPS}"; 
    3548cat <<-EOF  > ${PROPS} 
    36 # Custom Kauri-friendly build properties - generated for r${REVISION} 
     49# Custom Kauri-friendly build properties - generated for ${TAG} 
    3750# ------------------------------------------------------------------- 
    3851# Used only for the maven distribution 
    39 suffix-maven: -svn${REVISION} 
    40 version-maven: svn${REVISION} 
     52suffix-maven: -${TAG} 
     53version-maven: ${TAG} 
    4154# Indicates if the Maven distribution should be regenerated. 
    4255maven: true 
     
    5265cd ${DIR}/build; 
    5366ant rebuild ${BUILD_PARAMS}; 
    54 SUCCESS=$?; 
     67SUCCESS=$?; #helas ant reports suucessful builds with warnings as != 0 
    5568cd -; 
    5669 
    5770 
    5871echo "-- ${ME} -- Grab Maven2 Artifacts."; 
    59 M2_TGZ="restlet-${REVISION}-m2.tgz"; 
     72M2_TGZ="restlet-${TAG}-m2.tgz"; 
    6073M2_DIST="${DIR}/build/dist/maven2"; 
    6174DISTNAME="$(ls -1 ${M2_DIST} | head -1)"; 
     
    7487 
    7588 
    76 echo "-- ${ME} -- Done building restlet-${REVISION}"; 
    77  
    78 # TODO maybe something to clean/remove old builds (not the current one: as that is useful sometimes to have around) - maybe do it at the start then (easier) 
     89echo "-- ${ME} -- Done building restlet-${TAG}"; 
Note: See TracChangeset for help on using the changeset viewer.