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