releasebuild.sh 5.7 KB

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