From 9897773e996e01aa0c1377116f01d3a890692010 Mon Sep 17 00:00:00 2001 From: phamt Date: Thu, 17 Feb 2011 15:23:58 +0000 Subject: [PATCH] Integrated Google compiler into xCAT-UI build. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8885 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- makeuirpm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/makeuirpm b/makeuirpm index 5d3595031..cf927646c 100755 --- a/makeuirpm +++ b/makeuirpm @@ -28,6 +28,28 @@ else else pkg="packages" fi + + # Minify Javascript files using Google Compiler + JAVA='/opt/ibm/java-ppc64-60/jre/bin/java' + JAR='/xcat2/build/tools/compiler.jar' + UI='xCAT-UI/js' + + declare -a FILES + IFS=' + ' + + # Find all Javascript files + FILES=(`find ${UI} -name '*.js'`) + for i in ${FILES[*]}; do + # Ignore Javascripts that are already minified + if [[ ! $i =~ '.*\.min\.js$' ]]; then + `${JAVA} -jar ${JAR} --warning_level=QUIET --js=$i --js_output_file=$i.min` + + # Remove old Javascript and replace it with minified version + rm -rf $i + mv $i.min $i + fi + done set -x tar --exclude=.svn -czf /usr/src/$pkg/SOURCES/xCAT-UI-$VER.tar.gz xCAT-UI