[483] | 1 | #!/bin/bash |
---|
| 2 | # |
---|
| 3 | # After the build completes, you can run this script to remove all unnecessary cruft. |
---|
| 4 | # |
---|
| 5 | # WARNING: There are a lot of 'rm -f' commands in here, mostly checked, but know: |
---|
| 6 | # Use at your own risk! |
---|
| 7 | # |
---|
| 8 | # NOTE: This is a fairly difinitive example of what is not needed (except in testing) ... |
---|
| 9 | |
---|
| 10 | releaseDir=$1; |
---|
| 11 | if [ "$releaseDir" = "" ]; then |
---|
| 12 | releaseDir = ../../release |
---|
| 13 | fi |
---|
| 14 | |
---|
| 15 | buildName=$2; |
---|
| 16 | if [ "$buildName" = "" ]; then |
---|
| 17 | buildName = dojo |
---|
| 18 | fi |
---|
| 19 | |
---|
| 20 | rm_dojo_files () |
---|
| 21 | { |
---|
| 22 | for d in "$@" |
---|
| 23 | do |
---|
| 24 | if [ -e "$buildName/$d" ]; then |
---|
| 25 | # echo "Removing: $d"; |
---|
| 26 | rm -rf "$buildName/$d" |
---|
| 27 | fi |
---|
| 28 | done |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | # FIXME: refs #6616 - could be able to set a global copyright file and null out build_release.txt |
---|
| 32 | #mv build_notice.txt _build_notice.txt |
---|
| 33 | #touch build_notice.txt |
---|
| 34 | |
---|
| 35 | if [ -d $releaseDir ]; then |
---|
| 36 | |
---|
| 37 | cd $releaseDir |
---|
| 38 | |
---|
| 39 | # remove dojox tests and demos - they all follow this convention |
---|
| 40 | for i in $buildName/dojox/* |
---|
| 41 | do |
---|
| 42 | if [ -d $i ]; then |
---|
| 43 | rm -rf $i/tests/ |
---|
| 44 | rm -rf $i/demos/ |
---|
| 45 | fi |
---|
| 46 | done |
---|
| 47 | |
---|
| 48 | # removed dijit tests |
---|
| 49 | rm_dojo_files "dijit/tests" "dijit/demos" "dijit/bench" "dojo/tests" "dojo/tests.js" "util" |
---|
| 50 | |
---|
| 51 | # cleanup dijit/themes/ selectively |
---|
| 52 | if [ -d $buildName/dijit/themes ]; then |
---|
| 53 | |
---|
| 54 | # noir isn't worth including yet |
---|
| 55 | if [ -d $buildName/dijit/themes/noir ]; then |
---|
| 56 | rm -rf $buildName/dijit/themes/noir/ |
---|
| 57 | fi |
---|
| 58 | |
---|
| 59 | # so the themes are there, lets assume that, piggyback on noir: FIXME later |
---|
| 60 | find ./$buildName/dijit/themes/ -name *.html -exec rm '{}' ';' |
---|
| 61 | |
---|
| 62 | # remove themeTester from minified build. |
---|
| 63 | rm -f $buildName/dijit/themes/templateThemeTest.html |
---|
| 64 | rm -f $buildName/dijit/themes/themeTester*.html |
---|
| 65 | rm -rf $buildName/dijit/themes/themeTesterImages/ |
---|
| 66 | |
---|
| 67 | fi |
---|
| 68 | |
---|
| 69 | # remove uncompressed .js files (leave for official release) |
---|
| 70 | # find . -name *.uncompressed.js -exec rm '{}' ';' |
---|
| 71 | |
---|
| 72 | # WARNING: templates have been inlined into the .js -- if you are using dynamic templates, |
---|
| 73 | # or other build trickery, these lines might not work! |
---|
| 74 | rm_dojo_files "dijit/templates" "dijit/form/templates" "dijit/layout/templates" |
---|
| 75 | |
---|
| 76 | # NOTE: we're not doing this in DojoX because the resources/ folder (to me) is deemed |
---|
| 77 | # ambigious, and should be treated on a per-project basis |
---|
| 78 | |
---|
| 79 | # NOTE: if you aren't using anything in DojoX, uncomment this line: |
---|
| 80 | # rm -rf dojo/dojox/ |
---|
| 81 | # OR get creative and only populate dojox/ folder with the projects you need, and leave alone. |
---|
| 82 | # .. assume you didn't, and clean up all the README's (leaving LICENSE, mind you) |
---|
| 83 | # find ./$buildName/dojox/ -name README -exec rm '{}' ';' |
---|
| 84 | |
---|
| 85 | # WARNING: if you care about _base existing (and not _always_ just dojo.js providing it) then comment this line: |
---|
| 86 | # rm_dojo_files "dojo/_base" "dojo/_base.js" |
---|
| 87 | |
---|
| 88 | # NOTE: we're not doing the above to dijit/_base/ because I secretly use dijit/_base functions |
---|
| 89 | # when only using dojo.js (place.js and sniff.js in particular), and mini would break stuff ... |
---|
| 90 | |
---|
| 91 | # last but not least |
---|
| 92 | # rm_dojo_files "dojo/build.txt" |
---|
| 93 | |
---|
| 94 | cd ../util/buildscripts/ |
---|
| 95 | |
---|
| 96 | fi |
---|
| 97 | |
---|
| 98 | # cleanup from above, refs #6616 |
---|
| 99 | #mv _build_notice.txt build_notice.txt |
---|