releasebuild.sh 7.1 KB

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