From 4447d3c8db6adc3ae25d18836c57b33a00e5cd13 Mon Sep 17 00:00:00 2001 From: Xavier Mamano Date: Tue, 20 Sep 2011 23:13:57 -0400 Subject: [PATCH] Modify build script to support minimizing with jsmin before passing to closure webservice for closure_ws. (Closes #3422) --- build/build.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build/build.py b/build/build.py index d91878146f..d688a31e35 100755 --- a/build/build.py +++ b/build/build.py @@ -55,7 +55,20 @@ def build(config_file = None, output_file = None, options = None): elif use_compressor == "minimize": minimized = minimize.minimize(merged) elif use_compressor == "closure_ws": - minimized = closure_ws.minimize(merged) + if len(merged) > 1000000: # The maximum file size for this web service is 1000 KB. + print "\nPre-compressing using jsmin" + merged = jsmin.jsmin(merged) + print "\nIs being compressed using Closure Compiler Service." + try: + minimized = closure_ws.minimize(merged) + except Exception, E: + print "\nAbnormal termination." + sys.exit("ERROR: Closure Compilation using Web service failed!\n%s" % E) + if len(minimized) <= 2: + print "\nAbnormal termination due to compilation errors." + sys.exit("ERROR: Closure Compilation using Web service failed!") + else: + print '\nClosure Compilation using Web service has completed successfully.' elif use_compressor == "closure": minimized = closure.minimize(merged) else: # fallback