google closure compiler: experiment with compressing staff client javascript
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Nov 2009 08:19:44 +0000 (08:19 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Nov 2009 08:19:44 +0000 (08:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14918 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/Makefile.am

index cef6f87..d440c83 100644 (file)
@@ -5,6 +5,9 @@
 
 export STAFF_CLIENT_BUILD_ID = $$(/bin/cat build/BUILD_ID)
 
+# from http://closure-compiler.googlecode.com/files/compiler-latest.zip  FIXME: Autotools this?
+export CLOSURE_COMPILER_JAR = ~/closure-compiler/compiler.jar
+
 OPENSRF_JSLIBS = "$(OPENSRF_LIBS)/javascript"
 CHROME_LOCALES = $$(ls -1 chrome/locale)
 SKIN_CSS = $$(ls -1 server/skin/*css | sed -e "s/.css/_custom.css/")
@@ -96,3 +99,14 @@ server-xul: build
        @echo "Copying xul into $(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
        mkdir -p "$(WEBDIR)/xul/$(STAFF_CLIENT_BUILD_ID)"
        cp -R @top_srcdir@/Open-ILS/xul/staff_client/build/server "${WEBDIR}/xul/${STAFF_CLIENT_BUILD_ID}/"
+
+compress-javascript: build
+       @echo "Size of build/ before compression = " `du -sh build/`
+       @echo " * Running Google's Closure Compiler against javascript.  Errors in build/compression.err"
+       @external/closure_compiler.sh $(CLOSURE_COMPILER_JAR) 2>> build/compression.err
+       @echo `find build/ -name '*.js~' -size 0 -print | wc -l` compression failures
+       @find build/ -name '*.js~' -size 0 -exec rm {} \; # remove the output files for those that did not compile
+       @echo `find build/ -name '*.js~' -print | wc -l` compression successes
+       @find build/ -name '*.js~' -exec perl -e '$$a = "{}"; chop $$a; `mv $$a~ $$a`;' \;
+       @echo "Size of build/ (minus compression.err) after compression = " `du -sh --exclude compression.err build/`
+