[OpenLayers-Trac] [OpenLayers] #3008: Build: Integrate Closure
Compiler on OpenLayers
OpenLayers
trac-20090302 at openlayers.org
Thu Jan 6 07:20:08 EST 2011
#3008: Build: Integrate Closure Compiler on OpenLayers
---------------------+------------------------------------------------------
Reporter: jorix | Owner:
Type: feature | Status: new
Priority: minor | Milestone: 2.11 Release
Component: general | Version: 2.10
Keywords: | State:
---------------------+------------------------------------------------------
This patch allows the use of compiler integrated into OpenLayers.
Features:
* Use the configuration files as {{{build.py}}}, e.g. {{{compile.py
lite.cfg}}}
* Enable debugging of the source using compiled code (the compiler adds
OL license and generate the map. The resulting code can be used directly
in Firebug 1.5 + Closure Inspector)
* Allows the compiler to read the Natural Docs comments like jsDoc. This
allows check type information about JavaScript variables to provide
enhanced optimization and warnings. e.g. {{{compile.py -m jsDoc
library.cfg}}}
* By default the undefined variables are not allowed, cause compilation
errors. (with {{{compile.py --checks medium}}} (default) and {{{compile.py
--checks maximum}}})
* Allow the use of compiler flags ({{{--externs}}} and
{{{--compilation_level}}} directly and the rest as
"{{{--compiler_flags}}}" (in the same manner as in {{{closurebuilder.py}}}
from Closure Library)
Most of the patch are new files, there are only two changes on existing
files:
* {{{lib/OpenLayers/Events.js}}}: Comments for the compiler to ignore an
error.
* {{{tools/mergejs.js}}}:
* Enable two types of calls: return code (to jsmin) and return the
list of source file names (to compile)
* Enable use files above {{{../lib}}} in paragraphs {{{[first]}}}
and {{{[last]}}} of the configuration files e.g.
{{{../examples/example.js}}} (this feature is dispensable, I've used it
for testing with {{{complile.py –l ADVANCED_OPTIMIZATIONS lite.cfg}}},
'''51k and that works'''! but it requires adjustments in source code)
NOTE: All material is original and is written by me except:
* {{{build/closure-compiler/closure-
compiler/contrib/externs/google_maps_api_v2.js}}}
* {{{tools/closure-library/closure/bin/build/jscompiler.py}}}
* and the compiler, of course!
'''WARNING''': The compiler is the only material that '''is not in the
patch'''. "{{{compiler.jar}}}" must be downloaded from:
http://code.google.com/p/closure-compiler/downloads/detail?name=compiler-
latest.zip&can=2&q=
to the folder: "{{{tools/closure-compiler/bin/}}}"
This is a large patch, with many details. '''Try it'''. I can give any
necessary explanations.
--
Ticket URL: <http://trac.openlayers.org/ticket/3008>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list