[483] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # version should be something like 0.9.0beta or 0.9.0 |
---|
| 4 | version=$1 |
---|
| 5 | |
---|
| 6 | # svnUserName is the name you use to connect to Dojo's subversion. |
---|
| 7 | svnUserName=$2 |
---|
| 8 | |
---|
| 9 | # The svn revision number to use for tag. Should be a number, like 11203 |
---|
| 10 | svnRevision=$3 |
---|
| 11 | |
---|
| 12 | # If no svnRevision number, get the latest one from he repo. |
---|
| 13 | if [ "$svnRevision" = "" ]; then |
---|
| 14 | svnRevision=`svn info http://svn.dojotoolkit.org/src/branches/1.9/util/buildscripts/build_release.sh | grep Revision | sed 's/Revision: //'` |
---|
| 15 | fi |
---|
| 16 | |
---|
| 17 | tagName=release-$version |
---|
| 18 | buildName=dojo-$tagName |
---|
| 19 | |
---|
| 20 | echo "This is a RELEASE build for Dojo, you probably meant to run build.sh" |
---|
| 21 | read -p "If you mean to create a tag for Dojo $version from r$svnRevision ... press a key to continue." |
---|
| 22 | |
---|
| 23 | # Make the SVN tag. |
---|
| 24 | svn mkdir -m "Using r$svnRevision to create a tag for the $version release." https://svn.dojotoolkit.org/src/tags/$tagName |
---|
| 25 | svn copy -r $svnRevision https://svn.dojotoolkit.org/src/branches/1.9/dojo https://svn.dojotoolkit.org/src/tags/$tagName/dojo -m "Using r$svnRevision to create a tag for the $version release." |
---|
| 26 | svn copy -r $svnRevision https://svn.dojotoolkit.org/src/branches/1.9/dijit https://svn.dojotoolkit.org/src/tags/$tagName/dijit -m "Using r$svnRevision to create a tag for the $version release." |
---|
| 27 | svn copy -r $svnRevision https://svn.dojotoolkit.org/src/branches/1.9/dojox https://svn.dojotoolkit.org/src/tags/$tagName/dojox -m "Using r$svnRevision to create a tag for the $version release." |
---|
| 28 | svn copy -r $svnRevision https://svn.dojotoolkit.org/src/branches/1.9/util https://svn.dojotoolkit.org/src/tags/$tagName/util -m "Using r$svnRevision to create a tag for the $version release." |
---|
| 29 | svn copy -r $svnRevision https://svn.dojotoolkit.org/src/branches/1.9/demos https://svn.dojotoolkit.org/src/tags/$tagName/demos -m "Using r$svnRevision to create a tag for the $version release." |
---|
| 30 | |
---|
| 31 | # Check out the tag |
---|
| 32 | mkdir ../../build |
---|
| 33 | cd ../../build |
---|
| 34 | svn co https://svn.dojotoolkit.org/src/tags/$tagName $buildName |
---|
| 35 | cd $buildName/util/buildscripts |
---|
| 36 | |
---|
| 37 | # Update the dojo version in the tag |
---|
| 38 | java -jar ../shrinksafe/js.jar changeVersion.js $version $svnRevision ../../dojo/_base/kernel.js |
---|
| 39 | java -jar ../shrinksafe/js.jar changeVersion.js $version $svnRevision ../../dojo/package.json |
---|
| 40 | java -jar ../shrinksafe/js.jar changeVersion.js $version $svnRevision ../../dijit/package.json |
---|
| 41 | java -jar ../shrinksafe/js.jar changeVersion.js $version $svnRevision ../../dojox/package.json |
---|
| 42 | cd ../../dojo |
---|
| 43 | svn commit -m "Updating dojo version for the tag. \!strict" package.json _base/kernel.js |
---|
| 44 | cd ../dijit |
---|
| 45 | svn commit -m "Updating dijit version for the tag. \!strict" package.json |
---|
| 46 | cd ../dojox |
---|
| 47 | svn commit -m "Updating dojox version for the tag. \!strict" package.json |
---|
| 48 | |
---|
| 49 | # Erase the SVN dir and replace with an exported SVN contents. |
---|
| 50 | cd ../.. |
---|
| 51 | rm -rf ./$buildName/ |
---|
| 52 | svn export http://svn.dojotoolkit.org/src/tags/$tagName $buildName |
---|
| 53 | |
---|
| 54 | # clobber cruft that we don't want in builds |
---|
| 55 | rm -rf ./$buildName/dijit/themes/noir |
---|
| 56 | rm -rf ./$buildName/dijit/bench |
---|
| 57 | |
---|
| 58 | # Make a shrinksafe bundle |
---|
| 59 | shrinksafeName=$buildName-shrinksafe |
---|
| 60 | cp -r $buildName/util/shrinksafe $buildName/util/$shrinksafeName |
---|
| 61 | cd $buildName/util |
---|
| 62 | zip -rq $shrinksafeName.zip $shrinksafeName/ |
---|
| 63 | tar -zcf $shrinksafeName.tar.gz $shrinksafeName/ |
---|
| 64 | mv $shrinksafeName.zip ../../ |
---|
| 65 | mv $shrinksafeName.tar.gz ../../ |
---|
| 66 | cd ../.. |
---|
| 67 | rm -rf $buildName/util/$shrinksafeName |
---|
| 68 | |
---|
| 69 | # Make a -demos bundle (note, this is before build. Build profile=demos-all if you want to release them) |
---|
| 70 | # the -demos archives are meant to be extracted from the same folder -src or release archives, and have |
---|
| 71 | # a matching prefixed folder in the archive |
---|
| 72 | demoName=$buildName-demos |
---|
| 73 | zip -rq $demoName.zip $buildName/demos/ |
---|
| 74 | tar -zcf $demoName.tar.gz $buildName/demos/ |
---|
| 75 | # prevent demos/ from appearing in the -src build |
---|
| 76 | rm -rf $buildName/demos |
---|
| 77 | |
---|
| 78 | # Make a src bundle |
---|
| 79 | srcName=$buildName-src |
---|
| 80 | mv $buildName $srcName |
---|
| 81 | zip -rq $srcName.zip $srcName/ |
---|
| 82 | tar -zcf $srcName.tar.gz $srcName/ |
---|
| 83 | mv $srcName $buildName |
---|
| 84 | |
---|
| 85 | # Run the build. |
---|
| 86 | cd $buildName/util/buildscripts/ |
---|
| 87 | chmod +x ./build.sh |
---|
| 88 | ./build.sh profile=standard version=$1 releaseName=$buildName cssOptimize=comments.keepLines optimize=shrinksafe.keepLines action=release insertAbsMids=1 |
---|
| 89 | # remove tests and demos, but only for the actual release: |
---|
| 90 | chmod +x ./clean_release.sh |
---|
| 91 | ./clean_release.sh ../../release $buildName |
---|
| 92 | cd ../../release/ |
---|
| 93 | |
---|
| 94 | # Pause to allow manual process of packing Dojo. |
---|
| 95 | currDir=`pwd` |
---|
| 96 | echo "You can find dojo in $currDir/$buildName/dojo/dojo.js" |
---|
| 97 | read -p "Build Done. If you want to pack Dojo manually, do it now, then press Enter to continue build packaging..." |
---|
| 98 | |
---|
| 99 | # Continuing with packaging up the release. |
---|
| 100 | zip -rq $buildName.zip $buildName/ |
---|
| 101 | tar -zcf $buildName.tar.gz $buildName/ |
---|
| 102 | mv $buildName.zip ../../ |
---|
| 103 | mv $buildName.tar.gz ../../ |
---|
| 104 | |
---|
| 105 | # copy compressed and uncompressed Dojo to the root |
---|
| 106 | cp $buildName/dojo/dojo.js* ../../ |
---|
| 107 | |
---|
| 108 | # remove the testless release build, and unpack a -src archive to rebuild from |
---|
| 109 | cd ../../ |
---|
| 110 | rm -rf $buildName/ |
---|
| 111 | tar -xzvf $srcName.tar.gz |
---|
| 112 | cd $srcName/util/buildscripts/ |
---|
| 113 | |
---|
| 114 | # build the version that will be extracted and live on downloads.dojotoolkit.org (with tests) |
---|
| 115 | ./build.sh action=release version=$1 profile=standard cssOptimize=comments.keepLines releaseName=$buildName copyTests=true mini=false insertAbsMids=1 |
---|
| 116 | |
---|
| 117 | # cleanup the -src extraction, moving the newly built tree into place. |
---|
| 118 | cd ../../release |
---|
| 119 | mv $buildName ../../ |
---|
| 120 | cd .. |
---|
| 121 | rm -rf release/ |
---|
| 122 | |
---|
| 123 | cd ../../ |
---|
| 124 | |
---|
| 125 | # make a folder structure appropriate for directly extracting on downloads.dojotoolkit.org |
---|
| 126 | mv build release-$1 |
---|
| 127 | rm -rf release-$1/$srcName/ |
---|
| 128 | cd release-$1 |
---|
| 129 | |
---|
| 130 | # md5sum the release files -- OSX doesn't have md5sum, foundation servers don't have md5 |
---|
| 131 | md5=`which md5` |
---|
| 132 | if [[ -n $md5 && -x $md5 ]]; then |
---|
| 133 | echo "Found $md5"; |
---|
| 134 | else |
---|
| 135 | md5=`which md5sum` |
---|
| 136 | fi |
---|
| 137 | |
---|
| 138 | if [[ -n $md5 && -x $md5 ]]; then |
---|
| 139 | for i in *.zip; do $md5 $i > $i.md5; done |
---|
| 140 | for i in *.gz; do $md5 $i > $i.md5; done |
---|
| 141 | for i in *.js; do $md5 $i > $i.md5; done |
---|
| 142 | else |
---|
| 143 | echo "ERROR: Failed to generate md5 checksums" |
---|
| 144 | fi |
---|
| 145 | |
---|
| 146 | # pack up the whole thing for easy copying |
---|
| 147 | cd .. |
---|
| 148 | tar -czvf dj-$1-dtk.tar.gz release-$1 |
---|
| 149 | |
---|
| 150 | # Finished. |
---|
| 151 | outDirName=`pwd` |
---|
| 152 | echo "Build complete. Files are in: $outDirName" |
---|
| 153 | echo "A copy/paste command to push files to download.dojotoolkit.org with permission:" |
---|
| 154 | echo "scp dj-$1-dtk.tar.gz download.dojotoolkit.org:/srv/www/vhosts.d/download.dojotoolkit.org" |
---|
| 155 | echo "... then extract in place and rm dj-$1-dtk.tar.gz" |
---|