releasebuild.sh 6.3 KB

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