releasebuild.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #! /bin/sh
  2. # This script must be run from the project root directory
  3. #
  4. # Release Process.
  5. #
  6. # 1. Do clean check out of source from svn.
  7. # 2. Set the version number in the pom.xml files of all the module
  8. # 3. Set the correct spring version number in the pom.xml.
  9. # 3a Set the same version number in this script
  10. # 4. Commit the source with the changed version numbers and note the revision number.
  11. # 5. Run this script to generate the artifacts and web site in the 'release' directory.
  12. #
  13. #
  14. #
  15. # Edit this release number before running. It is used to check jar names etc.
  16. #
  17. RELEASE_VERSION=1.0.5-SNAPSHOT
  18. PROJ_DIR=`pwd`;
  19. RELEASE_DIR=$PROJ_DIR/release
  20. SITE_DIR=$RELEASE_DIR/site
  21. echo "** Project directory is $PROJ_DIR"
  22. SVN_REV=`svn info $PROJ_DIR | grep Revision | sed "s/Revision: //"`
  23. echo "** Building from revision $SVN_REV"
  24. #
  25. # Check the sandbox builds with the current configuration
  26. #
  27. pushd sandbox
  28. mvn clean test
  29. if [ "$?" -ne 0 ]
  30. then
  31. echo "Failed to build sandbox with current configuration."
  32. exit 1;
  33. fi
  34. popd
  35. #
  36. # Create the release directory if it doesn't already exist
  37. #
  38. if [[ -e $RELEASE_DIR ]]
  39. then
  40. rm -Rf $RELEASE_DIR
  41. fi
  42. mkdir $RELEASE_DIR
  43. mkdir $SITE_DIR
  44. # run maven to generate jars
  45. mvn clean install -DcreateChecksum=true
  46. if [ "$?" -ne 0 ]
  47. then
  48. echo "mvn install failed"
  49. exit 1;
  50. fi
  51. echo "** Generating site in $SITE_DIR".
  52. mvn site docbkx:generate-html docbkx:generate-pdf site:deploy -DsiteDirectory=file://${SITE_DIR}
  53. if [ "$?" -ne 0 ]
  54. then
  55. echo "mvn site generation failed"
  56. exit 1;
  57. fi
  58. # Patch the module site files to point to the root css files, change names of oversized menus,
  59. # remove dodgy standard maven text etc.
  60. #
  61. pushd $RELEASE_DIR/site
  62. find . -name "*.html" -maxdepth 2 -mindepth 2 | xargs perl -i -p -e 's#\./css/#\.\./css/#;' \
  63. -e 's/Maven Surefire Report/Unit Tests/;' \
  64. -e 's/Cobertura Test Coverage/Test Coverage/;' \
  65. -e 's/A successful project.*greatly appreciated\.//;'
  66. popd
  67. # Assemble the required jar files
  68. find . -name "*${RELEASE_VERSION}.jar" | grep -v WEB-INF | xargs -I % -n 1 cp % $RELEASE_DIR
  69. find . -name "*${RELEASE_VERSION}.war" | xargs -I % -n 1 cp % $RELEASE_DIR
  70. # Should be 9 archives - core, core-tiger, the adapters (cas, jboss, resin, jetty, catalina), tutorial and contacts wars.
  71. pushd $RELEASE_DIR
  72. NUM_JARS=`ls *.jar *.war | wc -l`
  73. if [ "$NUM_JARS" -ne 9 ]
  74. then
  75. echo "Expected 9 Jar files but found $NUM_JARS."
  76. exit 1
  77. fi
  78. # Create the signatures
  79. for jar in $(ls *.jar *.war); do
  80. openssl sha1 < $jar > $jar.sha1
  81. openssl md5 < $jar > $jar.md5
  82. done
  83. popd