releasebuild.sh 6.8 KB

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