summaryrefslogtreecommitdiff
path: root/misc/openlayers/build
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/build
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/build')
-rw-r--r--misc/openlayers/build/README.txt46
-rwxr-xr-xmisc/openlayers/build/build.py158
-rwxr-xr-xmisc/openlayers/build/buildUncompressed.py25
-rw-r--r--misc/openlayers/build/closure-compiler/Externs.js50
-rw-r--r--misc/openlayers/build/full.cfg14
-rw-r--r--misc/openlayers/build/license.txt57
-rw-r--r--misc/openlayers/build/light.cfg32
-rw-r--r--misc/openlayers/build/lite.cfg17
-rw-r--r--misc/openlayers/build/mobile.cfg36
-rw-r--r--misc/openlayers/build/tests.cfg11
10 files changed, 446 insertions, 0 deletions
diff --git a/misc/openlayers/build/README.txt b/misc/openlayers/build/README.txt
new file mode 100644
index 0000000..50798db
--- /dev/null
+++ b/misc/openlayers/build/README.txt
@@ -0,0 +1,46 @@
+The OpenLayers build tool supports several different
+forms of compressing your javascript code, and a method
+of describing build profiles to create customized
+OpenLayers builds with only the components you need.
+
+When building a file, you can choose to build with several
+different compression options to the Python-based build.py
+script. The following is an example script:
+
+python build.py -c closure full OpenLayers-closure.js
+
+This script selects the 'closure' compression mechanism,
+uses a config file called 'full.cfg', and writes the output
+to OpenLayers-closure.js.
+
+The options available for compression are:
+
+ * closure
+ This requires you to have a closure-compiler.jar in your
+ tools directory. You can do this by fetching the compiler
+ from:
+
+ http://closure-compiler.googlecode.com/files/compiler-latest.zip
+
+ Then unzipping that file, and placing compiler.jar into tools
+ and renaming it closure-compiler.jar.
+
+ * closure_ws
+ This uses the closure compiler webservice. This will only work
+ for files source Javascript files which are under 1MB. (Note that
+ the default OpenLayers full build is not under 1MB.)
+
+ * jsmin
+ jsmin is the default compiler, and uses the Python-based
+ jsmin script to compress the Javascript.
+
+ * minimize
+ This is a simple whitespace removing Python script, designed
+ to fill in when other tools are unavailable.
+
+ * none
+ None will leave the Javascript uncompressed.
+
+
+For more information on the build script and custom build profiles,
+see http://docs.openlayers.org/library/deploying.html
diff --git a/misc/openlayers/build/build.py b/misc/openlayers/build/build.py
new file mode 100755
index 0000000..fd0f6e9
--- /dev/null
+++ b/misc/openlayers/build/build.py
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+
+import sys
+import os
+sys.path.append("../tools")
+import mergejs
+import optparse
+
+def build(config_file = None, output_file = None, options = None):
+ have_compressor = []
+ try:
+ import jsmin
+ have_compressor.append("jsmin")
+ except ImportError:
+ print "No jsmin"
+ try:
+ # tools/closure_library_jscompiler.py from:
+ # http://code.google.com/p/closure-library/source/browse/trunk/closure/bin/build/jscompiler.py
+ import closure_library_jscompiler as closureCompiler
+ have_compressor.append("closure")
+ except Exception, E:
+ print "No closure (%s)" % E
+ try:
+ import closure_ws
+ have_compressor.append("closure_ws")
+ except ImportError:
+ print "No closure_ws"
+
+ try:
+ import minimize
+ have_compressor.append("minimize")
+ except ImportError:
+ print "No minimize"
+
+ try:
+ import uglify_js
+ uglify_js.check_available()
+ have_compressor.append("uglify-js")
+ except Exception, E:
+ print "No uglify-js (%s)" % E
+
+ use_compressor = None
+ if options.compressor and options.compressor in have_compressor:
+ use_compressor = options.compressor
+
+ sourceDirectory = "../lib"
+ configFilename = "full.cfg"
+ outputFilename = "OpenLayers.js"
+
+ if config_file:
+ configFilename = config_file
+ extension = configFilename[-4:]
+
+ if extension != ".cfg":
+ configFilename = config_file + ".cfg"
+
+ if output_file:
+ outputFilename = output_file
+
+ print "Merging libraries."
+ try:
+ if use_compressor == "closure" or use_compressor == 'uglify-js':
+ sourceFiles = mergejs.getNames(sourceDirectory, configFilename)
+ else:
+ merged = mergejs.run(sourceDirectory, None, configFilename)
+ except mergejs.MissingImport, E:
+ print "\nAbnormal termination."
+ sys.exit("ERROR: %s" % E)
+
+ if options.amdname:
+ options.amdname = "'" + options.amdname + "',"
+ else:
+ options.amdname = ""
+
+ if options.amd == 'pre':
+ print "\nAdding AMD function."
+ merged = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, merged)
+
+ print "Compressing using %s" % use_compressor
+ if use_compressor == "jsmin":
+ minimized = jsmin.jsmin(merged)
+ elif use_compressor == "minimize":
+ minimized = minimize.minimize(merged)
+ elif use_compressor == "closure_ws":
+ 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 "Closure Compilation using Web service has completed successfully."
+ elif use_compressor == "closure":
+ jscompilerJar = "../tools/closure-compiler.jar"
+ if not os.path.isfile(jscompilerJar):
+ print "\nNo closure-compiler.jar; read README.txt!"
+ sys.exit("ERROR: Closure Compiler \"%s\" does not exist! Read README.txt" % jscompilerJar)
+ minimized = closureCompiler.Compile(
+ jscompilerJar,
+ sourceFiles, [
+ "--externs", "closure-compiler/Externs.js",
+ "--jscomp_warning", "checkVars", # To enable "undefinedVars"
+ "--jscomp_error", "checkRegExp", # Also necessary to enable "undefinedVars"
+ "--jscomp_error", "undefinedVars"
+ ]
+ )
+ if minimized is None:
+ print "\nAbnormal termination due to compilation errors."
+ sys.exit("ERROR: Closure Compilation failed! See compilation errors.")
+ print "Closure Compilation has completed successfully."
+ elif use_compressor == "uglify-js":
+ minimized = uglify_js.compile(sourceFiles)
+ if minimized is None:
+ print "\nAbnormal termination due to compilation errors."
+ sys.exit("ERROR: Uglify JS compilation failed! See compilation errors.")
+
+ print "Uglify JS compilation has completed successfully."
+
+ else: # fallback
+ minimized = merged
+
+ if options.amd == 'post':
+ print "\nAdding AMD function."
+ minimized = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, minimized)
+
+ if options.status:
+ print "\nAdding status file."
+ minimized = "// status: " + file(options.status).read() + minimized
+
+ print "\nAdding license file."
+ minimized = file("license.txt").read() + minimized
+
+ print "Writing to %s." % outputFilename
+ file(outputFilename, "w").write(minimized)
+
+ print "Done."
+
+if __name__ == '__main__':
+ opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'")
+ opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin' (default), 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin")
+ opt.add_option("-s", "--status", dest="status", help="name of a file whose contents will be added as a comment at the front of the output file. For example, when building from a git repo, you can save the output of 'git describe --tags' in this file. Default is no file.", default=False)
+ opt.add_option("--amd", dest="amd", help="output should be AMD module; wrap merged files in define function; can be either 'pre' (before compilation) or 'post' (after compilation). Wrapping the OpenLayers var in a function means the filesize can be reduced by the closure compiler using 'pre', but be aware that a few functions depend on the OpenLayers variable being present. Either option can be used with jsmin or minimize compression. Default false, not AMD.", default=False)
+ opt.add_option("--amdname", dest="amdname", help="only useful with amd option. Name of AMD module. Default no name, anonymous module.", default=False)
+ (options, args) = opt.parse_args()
+ if not len(args):
+ build(options=options)
+ elif len(args) == 1:
+ build(args[0], options=options)
+ elif len(args) == 2:
+ build(args[0], args[1], options=options)
+ else:
+ print "Wrong number of arguments" \ No newline at end of file
diff --git a/misc/openlayers/build/buildUncompressed.py b/misc/openlayers/build/buildUncompressed.py
new file mode 100755
index 0000000..fd38aa7
--- /dev/null
+++ b/misc/openlayers/build/buildUncompressed.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import sys
+sys.path.append("../tools")
+
+import jsmin, mergejs
+
+sourceDirectory = "../lib"
+configFilename = "full.cfg"
+outputFilename = "OpenLayers.js"
+
+if len(sys.argv) > 1:
+ configFilename = sys.argv[1] + ".cfg"
+if len(sys.argv) > 2:
+ outputFilename = sys.argv[2]
+
+print "Merging libraries."
+merged = mergejs.run(sourceDirectory, None, configFilename)
+print "Adding license file."
+merged = file("license.txt").read() + merged
+
+print "Writing to %s." % outputFilename
+file(outputFilename, "w").write(merged)
+
+print "Done."
diff --git a/misc/openlayers/build/closure-compiler/Externs.js b/misc/openlayers/build/closure-compiler/Externs.js
new file mode 100644
index 0000000..3bb9464
--- /dev/null
+++ b/misc/openlayers/build/closure-compiler/Externs.js
@@ -0,0 +1,50 @@
+// ********************************************
+// This source file serves *ONLY* to avoid some compilation errors when the
+// compiler uses the flag:
+// --jscomp_error undefinedVars
+//
+// In this source are declared all variables from other programs that use
+// OpenLayers. This avoids the error of undefined variable for these names.
+//
+// NOTE: The compiler does not include externs files like this in the
+// compilation result.
+// ********************************************
+
+// Used in lib/Firebug/firebug.js when gecko_dom
+ var frames;
+
+// Check the console when using Firebug Lite
+ var console;
+
+// Proj4js
+ var Proj4js = {Proj: function(){}};
+
+// Check JSON in lib/OpenLayers/Format/JSON.js
+ var JSON = {};
+
+// Google Maps
+ var GMap2;
+ var G_NORMAL_MAP;
+ var GEvent;
+ var GLatLngBounds = function(){};
+ var GSize = function(x, y){};
+ var GPoint = function(x, y){};
+ var GLatLng = function(lat, lon){};
+
+// Multimap
+ var MultimapViewer = function(div){};
+ var MMLatLon = function(lat, lon){};
+ var MMPoint = function(x, y){};
+
+//VirtualEarth
+ var VEMap = function(name){};
+ var VEPixel = function(x, y){};
+ var VELatLong = function(lat, lon){};
+ var Msn = {VE:{}};
+
+// Yahoo
+ var YMap = function(div, type, size){};
+ var YGeoPoint = function(lat, lon){};
+ var YCoordPoint = function(x, y){};
+ var YSize = function(w, h){};
+
diff --git a/misc/openlayers/build/full.cfg b/misc/openlayers/build/full.cfg
new file mode 100644
index 0000000..91c817a
--- /dev/null
+++ b/misc/openlayers/build/full.cfg
@@ -0,0 +1,14 @@
+# This is the full build with all files: this includes the vector-related files
+# like Renderers and Formats.
+
+[first]
+
+[last]
+
+[include]
+
+[exclude]
+Firebug
+OpenLayers.js
+OpenLayers/Lang
+deprecated.js
diff --git a/misc/openlayers/build/license.txt b/misc/openlayers/build/license.txt
new file mode 100644
index 0000000..7ea36ac
--- /dev/null
+++ b/misc/openlayers/build/license.txt
@@ -0,0 +1,57 @@
+/*
+
+ OpenLayers.js -- OpenLayers Map Viewer Library
+
+ Copyright (c) 2006-2013 by OpenLayers Contributors
+ Published under the 2-clause BSD license.
+ See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
+
+ Includes compressed code under the following licenses:
+
+ (For uncompressed versions of the code used, please see the
+ OpenLayers Github repository: <https://github.com/openlayers/openlayers>)
+
+*/
+
+/**
+ * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
+ * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+/**
+ * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
+ * Copyright (c) 2006, Yahoo! Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use of this software in source and binary forms, with or
+ * without modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission of Yahoo! Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
diff --git a/misc/openlayers/build/light.cfg b/misc/openlayers/build/light.cfg
new file mode 100644
index 0000000..b5d7392
--- /dev/null
+++ b/misc/openlayers/build/light.cfg
@@ -0,0 +1,32 @@
+[first]
+
+[last]
+
+[include]
+OpenLayers/Map.js
+OpenLayers/Kinetic.js
+OpenLayers/Projection.js
+OpenLayers/Layer/Vector.js
+OpenLayers/Layer/OSM.js
+OpenLayers/Layer/Bing.js
+OpenLayers/Layer/WMS.js
+OpenLayers/Layer/Google/v3.js
+OpenLayers/Popup/FramedCloud.js
+OpenLayers/Control/Navigation.js
+OpenLayers/Control/Zoom.js
+OpenLayers/Control/Attribution.js
+OpenLayers/Control/SelectFeature.js
+OpenLayers/Control/Panel.js
+OpenLayers/Control/LayerSwitcher.js
+OpenLayers/Renderer/SVG.js
+OpenLayers/Renderer/VML.js
+OpenLayers/Format/GeoJSON.js
+OpenLayers/Protocol/HTTP.js
+OpenLayers/Strategy/Fixed.js
+OpenLayers/Strategy/BBOX.js
+OpenLayers/StyleMap.js
+OpenLayers/Rule.js
+OpenLayers/Filter/Comparison.js
+OpenLayers/Filter/Logical.js
+
+[exclude]
diff --git a/misc/openlayers/build/lite.cfg b/misc/openlayers/build/lite.cfg
new file mode 100644
index 0000000..d274e27
--- /dev/null
+++ b/misc/openlayers/build/lite.cfg
@@ -0,0 +1,17 @@
+# This file includes a small subset of OpenLayers code, designed to be
+# integrated into another application. It includes only the Layer types
+# neccesary to create tiled or untiled WMS, and does not include any Controls.
+# This is the result of what was at the time called "Webmap.js" at the FOSS4G
+# Web Mapping BOF.
+
+[first]
+
+[last]
+
+[include]
+OpenLayers/Map.js
+OpenLayers/Layer/WMS.js
+
+[exclude]
+
+
diff --git a/misc/openlayers/build/mobile.cfg b/misc/openlayers/build/mobile.cfg
new file mode 100644
index 0000000..b41f0bd
--- /dev/null
+++ b/misc/openlayers/build/mobile.cfg
@@ -0,0 +1,36 @@
+[first]
+
+[last]
+
+[include]
+OpenLayers/Map.js
+OpenLayers/Kinetic.js
+OpenLayers/Projection.js
+OpenLayers/Layer/OSM.js
+OpenLayers/Layer/Bing.js
+OpenLayers/Layer/WMS.js
+OpenLayers/Control/TouchNavigation.js
+OpenLayers/Control/Geolocate.js
+OpenLayers/Control/Zoom.js
+OpenLayers/Control/Attribution.js
+OpenLayers/Control/SelectFeature.js
+OpenLayers/Control/DrawFeature.js
+OpenLayers/Control/ModifyFeature.js
+OpenLayers/Control/Panel.js
+OpenLayers/Handler/Point.js
+OpenLayers/Handler/Path.js
+OpenLayers/Handler/Polygon.js
+OpenLayers/Layer/Vector.js
+OpenLayers/Renderer/SVG.js
+OpenLayers/Renderer/Canvas.js
+OpenLayers/Format/GeoJSON.js
+OpenLayers/Format/KML.js
+OpenLayers/Protocol/HTTP.js
+OpenLayers/Protocol/WFS.js
+OpenLayers/Protocol/WFS/v1_0_0.js
+OpenLayers/Strategy/Fixed.js
+OpenLayers/TileManager.js
+
+[exclude]
+
+
diff --git a/misc/openlayers/build/tests.cfg b/misc/openlayers/build/tests.cfg
new file mode 100644
index 0000000..557b16b
--- /dev/null
+++ b/misc/openlayers/build/tests.cfg
@@ -0,0 +1,11 @@
+# This build config is supposed to be used for the units tests with "mode=build"
+
+[first]
+
+[last]
+
+[include]
+
+[exclude]
+Firebug
+OpenLayers.js