releasebuild.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. Switch to 1.4 JVM and run 'mvn test' from core directory.
  8. # 3. Set the version number in the pom.xml files of all the module
  9. # 4. Set the correct spring version number in the pom.xml.
  10. # 4a Set the same version number in this script
  11. # 5. Commit the source with the changed version numbers and note the revision number.
  12. # 6. Run this script to generate the artifacts and web site in the 'release' directory.
  13. # 7. Copy the zip archives and unpack them to check the contents.
  14. # 8. Check the site looks Ok.
  15. # 9. Check the reference guide links in the site are valid and that images are shown and paths in HTML are relative.
  16. # 10. Deploy the contacts and tutorial sample apps in a web container and check they work.
  17. # 11. Upload the site to acegisecurity.org (or wherever).
  18. # 12. Sign the zip archives using PGP.
  19. # 13.
  20. #
  21. #
  22. ########################################################################################################################
  23. #
  24. # Edit this release number before running. It is used to check jar names etc.
  25. #
  26. ########################################################################################################################
  27. RELEASE_VERSION=1.0.5-SNAPSHOT
  28. PROJ_DIR=`pwd`;
  29. RELEASE_DIR=$PROJ_DIR/release-$RELEASE_VERSION
  30. SITE_DIR=$RELEASE_DIR/site
  31. echo "** Project directory is $PROJ_DIR"
  32. SVN_REV=`svn info $PROJ_DIR | grep Revision | sed "s/Revision: //"`
  33. echo "** Building from revision $SVN_REV"
  34. ########################################################################################################################
  35. #
  36. # Create the release directory if it doesn't already exist
  37. #
  38. ########################################################################################################################
  39. if [[ -e $RELEASE_DIR ]]
  40. then
  41. rm -Rf $RELEASE_DIR
  42. fi
  43. mkdir $RELEASE_DIR
  44. mkdir $SITE_DIR
  45. ########################################################################################################################
  46. #
  47. # run maven to generate jars
  48. #
  49. ########################################################################################################################
  50. mvn clean install -DcreateChecksum=true
  51. if [ "$?" -ne 0 ]
  52. then
  53. echo "mvn install failed"
  54. exit 1;
  55. fi
  56. ########################################################################################################################
  57. #
  58. # Check the sandbox builds with the current configuration
  59. #
  60. ########################################################################################################################
  61. pushd sandbox
  62. mvn clean test
  63. if [ "$?" -ne 0 ]
  64. then
  65. echo "Failed to build sandbox with current configuration."
  66. exit 1;
  67. fi
  68. popd
  69. ########################################################################################################################
  70. #
  71. # Generate Maven Web Site and Process Docbook Source.
  72. #
  73. ########################################################################################################################
  74. echo "** Generating site in $SITE_DIR".
  75. mvn site site:deploy -DsiteDirectory=file://${SITE_DIR}
  76. if [ "$?" -ne 0 ]
  77. then
  78. echo "mvn site generation failed"
  79. exit 1;
  80. fi
  81. ########################################################################################################################
  82. #
  83. # Patch the module site files to point to the root css files, change names of oversized menus,
  84. # remove dodgy standard maven text etc.
  85. #
  86. ########################################################################################################################
  87. pushd $RELEASE_DIR/site
  88. find . -name "*.html" -maxdepth 2 -mindepth 2 | xargs perl -i -p -e 's#\./css/#\.\./css/#;' \
  89. -e 's/Maven Surefire Report/Unit Tests/;' \
  90. -e 's/Cobertura Test Coverage/Test Coverage/;' \
  91. -e 's/A successful project.*greatly appreciated\.//;'
  92. popd
  93. ########################################################################################################################
  94. #
  95. # Assemble the required jar files, make sure there are the expected number and produce signatures.
  96. #
  97. ########################################################################################################################
  98. find . -name "*${RELEASE_VERSION}.jar" | grep -v WEB-INF | xargs -I % -n 1 cp % $RELEASE_DIR
  99. find . -name "*${RELEASE_VERSION}.war" | xargs -I % -n 1 cp % $RELEASE_DIR
  100. # Should be 9 archives - core, core-tiger, the adapters (cas, jboss, resin, jetty, catalina), tutorial and contacts wars.
  101. pushd $RELEASE_DIR
  102. NUM_JARS=`ls *.jar *.war | wc -l`
  103. if [ "$NUM_JARS" -ne 9 ]
  104. then
  105. echo "Expected 9 Jar files but found $NUM_JARS."
  106. exit 1
  107. fi
  108. # Create the signatures
  109. for jar in $(ls *.jar *.war); do
  110. openssl sha1 < $jar > $jar.sha1
  111. openssl md5 < $jar > $jar.md5
  112. done
  113. popd
  114. ########################################################################################################################
  115. #
  116. # Build the release zip archives.
  117. #
  118. ########################################################################################################################