diff --git a/bin/generate-exports.py b/bin/generate-exports.py index 8ba3d02052..3d700d459f 100755 --- a/bin/generate-exports.py +++ b/bin/generate-exports.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -from collections import defaultdict -from itertools import ifilter from operator import attrgetter from optparse import OptionParser import re @@ -354,7 +352,8 @@ def main(argv): return_type = m.group('return_type') function = Function(name, object_literal, return_type, objects) objects[name] = function - requires.add(name) + # The require should only be for the namespace, not the function + requires.add('.'.join(name.split('.')[0:-1])) continue m = re.match(r'@exportSymbol\s+(?P\S+)(?:\s+(?P\S+))?\Z', line) if m: diff --git a/build.py b/build.py index 84a2c118c6..ca6130a78a 100755 --- a/build.py +++ b/build.py @@ -460,17 +460,23 @@ def build_check_requires_timestamp(t): self.children = {} def _build_re(self, key): - if len(self.children) == 1: + if key == '*': + assert len(self.children) == 0 + # We want to match `.doIt` but not `.SomeClass` or `.more.stuff` + return '(?=\\.[a-z]\\w*\\b(?!\\.))' + elif len(self.children) == 1: child_key, child = next(self.children.iteritems()) - child_re = '\\.' + child._build_re(child_key) + child_re = child._build_re(child_key) + if child_key != '*': + child_re = '\\.' + child_re if self.present: return key + '(' + child_re + ')?' else: return key + child_re elif self.children: - children_re = '(?:\\.(?:' + '|'.join( - self.children[k]._build_re(k) - for k in sorted(self.children.keys())) + '))' + children_re = '(?:' + '|'.join( + ('\\.' if k != '*' else '') + self.children[k]._build_re(k) + for k in sorted(self.children.keys())) + ')' if self.present: return key + children_re + '?' else: @@ -488,7 +494,14 @@ def build_check_requires_timestamp(t): if component not in node.children: node.children[component] = Node() node = node.children[component] - node.present = True + if component[0].islower(): + # We've arrived at a namespace provide like `ol.foo`. + # In this case, we want to match uses like `ol.foo.doIt()` but + # not match things like `new ol.foo.SomeClass()`. + # For this purpose, we use the special wildcard key for the child. + node.children['*'] = Node() + else: + node.present = True provide_res = [child.build_re(key) for key, child in root.children.iteritems()] missing_count = 0 diff --git a/examples/animation.js b/examples/animation.js index f6d8893b12..5b8d6d6d71 100644 --- a/examples/animation.js +++ b/examples/animation.js @@ -1,9 +1,7 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); -goog.require('ol.animation.bounce'); -goog.require('ol.animation.pan'); -goog.require('ol.animation.rotate'); +goog.require('ol.animation'); goog.require('ol.easing'); goog.require('ol.layer.TileLayer'); goog.require('ol.proj'); diff --git a/examples/custom-controls.js b/examples/custom-controls.js index c32fad8698..a8348f4578 100644 --- a/examples/custom-controls.js +++ b/examples/custom-controls.js @@ -2,8 +2,8 @@ goog.require('ol'); goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.Control'); -goog.require('ol.control.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.OSM'); diff --git a/examples/drag-rotate-and-zoom.js b/examples/drag-rotate-and-zoom.js index 6c594af871..bee87629eb 100644 --- a/examples/drag-rotate-and-zoom.js +++ b/examples/drag-rotate-and-zoom.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.interaction'); goog.require('ol.interaction.DragRotateAndZoom'); -goog.require('ol.interaction.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.MapQuestOpenAerial'); diff --git a/examples/epsg-4326.js b/examples/epsg-4326.js index 5de5b985f9..2602a778d1 100644 --- a/examples/epsg-4326.js +++ b/examples/epsg-4326.js @@ -1,9 +1,9 @@ goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.ScaleLine'); goog.require('ol.control.ScaleLineUnits'); -goog.require('ol.control.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.TiledWMS'); diff --git a/examples/full-screen-drag-rotate-and-zoom.js b/examples/full-screen-drag-rotate-and-zoom.js index f40cd6a116..74fd946b5f 100644 --- a/examples/full-screen-drag-rotate-and-zoom.js +++ b/examples/full-screen-drag-rotate-and-zoom.js @@ -1,10 +1,10 @@ goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.FullScreen'); -goog.require('ol.control.defaults'); +goog.require('ol.interaction'); goog.require('ol.interaction.DragRotateAndZoom'); -goog.require('ol.interaction.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.BingMaps'); diff --git a/examples/full-screen.js b/examples/full-screen.js index a500d21482..4d5c86259a 100644 --- a/examples/full-screen.js +++ b/examples/full-screen.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.FullScreen'); -goog.require('ol.control.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.BingMaps'); diff --git a/examples/mouse-position.js b/examples/mouse-position.js index 3819b08807..183bab47fd 100644 --- a/examples/mouse-position.js +++ b/examples/mouse-position.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.MousePosition'); -goog.require('ol.control.defaults'); goog.require('ol.coordinate'); goog.require('ol.dom.Input'); goog.require('ol.layer.TileLayer'); diff --git a/examples/navigation-controls.js b/examples/navigation-controls.js index 0c09d64507..a4ba76b347 100644 --- a/examples/navigation-controls.js +++ b/examples/navigation-controls.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.ZoomToExtent'); -goog.require('ol.control.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.OSM'); diff --git a/examples/scale-line.js b/examples/scale-line.js index 4013f3e59a..4b543e19c7 100644 --- a/examples/scale-line.js +++ b/examples/scale-line.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.ScaleLine'); -goog.require('ol.control.defaults'); goog.require('ol.dom.Input'); goog.require('ol.layer.TileLayer'); goog.require('ol.source.OSM'); diff --git a/examples/select-features.js b/examples/select-features.js index ab54750dbd..84d788986e 100644 --- a/examples/select-features.js +++ b/examples/select-features.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); +goog.require('ol.interaction'); goog.require('ol.interaction.Select'); -goog.require('ol.interaction.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.layer.Vector'); goog.require('ol.parser.ogc.GML_v3'); diff --git a/examples/style-rules.js b/examples/style-rules.js index 7a573935cf..f701fca3ec 100644 --- a/examples/style-rules.js +++ b/examples/style-rules.js @@ -1,7 +1,7 @@ goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); -goog.require('ol.control.defaults'); +goog.require('ol.control'); goog.require('ol.expr'); goog.require('ol.layer.Vector'); goog.require('ol.parser.GeoJSON'); diff --git a/examples/ten-thousand-points.js b/examples/ten-thousand-points.js index a3cd6527d6..47fe7be271 100644 --- a/examples/ten-thousand-points.js +++ b/examples/ten-thousand-points.js @@ -1,8 +1,8 @@ goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.MousePosition'); -goog.require('ol.control.defaults'); goog.require('ol.geom2.LineStringCollection'); goog.require('ol.geom2.PointCollection'); goog.require('ol.layer.TileLayer'); diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 7926d4ec7e..4c7524dcc2 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -2,9 +2,9 @@ goog.require('ol.Attribution'); goog.require('ol.Map'); goog.require('ol.RendererHints'); goog.require('ol.View2D'); +goog.require('ol.control'); goog.require('ol.control.ScaleLine'); goog.require('ol.control.ScaleLineUnits'); -goog.require('ol.control.defaults'); goog.require('ol.layer.TileLayer'); goog.require('ol.proj'); goog.require('ol.source.TiledWMS'); diff --git a/examples/wmts-capabilities.js b/examples/wmts-capabilities.js index 50373bde61..41cb7f921a 100644 --- a/examples/wmts-capabilities.js +++ b/examples/wmts-capabilities.js @@ -1,7 +1,7 @@ goog.require('ol.parser.ogc.WMTSCapabilities'); -goog.require('ol.proj.addCommonProjections'); +goog.require('ol.proj.common'); -ol.proj.addCommonProjections(); +ol.proj.common.add(); Proj4js.defs['EPSG:31256'] = '+proj=tmerc +lat_0=0 ' + '+lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel ' + '+towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 ' + diff --git a/src/ol/animation.js b/src/ol/animation.js index 1a17b97426..3d67b58af8 100644 --- a/src/ol/animation.js +++ b/src/ol/animation.js @@ -1,9 +1,6 @@ // FIXME works for View2D only -goog.provide('ol.animation.bounce'); -goog.provide('ol.animation.pan'); -goog.provide('ol.animation.rotate'); -goog.provide('ol.animation.zoom'); +goog.provide('ol.animation'); goog.require('ol.PreRenderFunction'); goog.require('ol.ViewHint'); diff --git a/src/ol/control/controldefaults.js b/src/ol/control/controldefaults.js index 02276c7f2f..77db5098c8 100644 --- a/src/ol/control/controldefaults.js +++ b/src/ol/control/controldefaults.js @@ -1,4 +1,4 @@ -goog.provide('ol.control.defaults'); +goog.provide('ol.control'); goog.require('ol.Collection'); goog.require('ol.control.Attribution'); diff --git a/src/ol/control/zoomcontrol.js b/src/ol/control/zoomcontrol.js index b1518aadce..1f97b321eb 100644 --- a/src/ol/control/zoomcontrol.js +++ b/src/ol/control/zoomcontrol.js @@ -6,7 +6,7 @@ goog.require('goog.dom'); goog.require('goog.dom.TagName'); goog.require('goog.events'); goog.require('goog.events.EventType'); -goog.require('ol.animation.zoom'); +goog.require('ol.animation'); goog.require('ol.control.Control'); goog.require('ol.css'); goog.require('ol.easing'); diff --git a/src/ol/control/zoomslidercontrol.js b/src/ol/control/zoomslidercontrol.js index a466606190..a258afc23e 100644 --- a/src/ol/control/zoomslidercontrol.js +++ b/src/ol/control/zoomslidercontrol.js @@ -15,7 +15,7 @@ goog.require('goog.fx.Dragger.EventType'); goog.require('goog.math'); goog.require('goog.math.Rect'); goog.require('goog.style'); -goog.require('ol.animation.zoom'); +goog.require('ol.animation'); goog.require('ol.control.Control'); goog.require('ol.css'); goog.require('ol.easing'); diff --git a/src/ol/geom/sharedvertices.js b/src/ol/geom/sharedvertices.js index b2b728c49c..e6c432997b 100644 --- a/src/ol/geom/sharedvertices.js +++ b/src/ol/geom/sharedvertices.js @@ -3,7 +3,6 @@ goog.provide('ol.geom.SharedVertices'); goog.require('goog.asserts'); goog.require('ol.Coordinate'); goog.require('ol.CoordinateArray'); -goog.require('ol.geom'); // TODO: remove this when #958 is addressed /** diff --git a/src/ol/interaction/interaction.js b/src/ol/interaction/interaction.js index b12b1f0abb..667a7a7e2f 100644 --- a/src/ol/interaction/interaction.js +++ b/src/ol/interaction/interaction.js @@ -3,9 +3,7 @@ goog.provide('ol.interaction.Interaction'); goog.require('ol.MapBrowserEvent'); -goog.require('ol.animation.pan'); -goog.require('ol.animation.rotate'); -goog.require('ol.animation.zoom'); +goog.require('ol.animation'); goog.require('ol.easing'); diff --git a/src/ol/interaction/interactiondefaults.js b/src/ol/interaction/interactiondefaults.js index 0fa4c3bc7f..ab0ecc0232 100644 --- a/src/ol/interaction/interactiondefaults.js +++ b/src/ol/interaction/interactiondefaults.js @@ -1,4 +1,4 @@ -goog.provide('ol.interaction.defaults'); +goog.provide('ol.interaction'); goog.require('ol.Collection'); goog.require('ol.Kinetic'); diff --git a/src/ol/kinetic.js b/src/ol/kinetic.js index 1838b56db7..17e1e27d9c 100644 --- a/src/ol/kinetic.js +++ b/src/ol/kinetic.js @@ -3,7 +3,7 @@ goog.provide('ol.Kinetic'); goog.require('ol.Coordinate'); goog.require('ol.PreRenderFunction'); -goog.require('ol.animation.pan'); +goog.require('ol.animation'); diff --git a/src/ol/map.js b/src/ol/map.js index bdd1332ff0..f5f190f253 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -50,13 +50,13 @@ goog.require('ol.TileQueue'); goog.require('ol.View'); goog.require('ol.View2D'); goog.require('ol.ViewHint'); -goog.require('ol.control.defaults'); +goog.require('ol.control'); goog.require('ol.extent'); -goog.require('ol.interaction.defaults'); +goog.require('ol.interaction'); goog.require('ol.layer.LayerBase'); goog.require('ol.layer.LayerGroup'); goog.require('ol.proj'); -goog.require('ol.proj.addCommonProjections'); +goog.require('ol.proj.common'); goog.require('ol.renderer.Map'); goog.require('ol.renderer.canvas.Map'); goog.require('ol.renderer.canvas.SUPPORTED'); @@ -1217,7 +1217,7 @@ ol.RendererHints.createFromQueryData = function(opt_queryData) { }; -ol.proj.addCommonProjections(); +ol.proj.common.add(); if (goog.DEBUG) { diff --git a/src/ol/proj.exports b/src/ol/proj.exports index 21c35d5652..6ad6796116 100644 --- a/src/ol/proj.exports +++ b/src/ol/proj.exports @@ -13,10 +13,11 @@ @exportProperty ol.ProjectionUnits.METERS @exportSymbol ol.proj.addProjection -@exportSymbol ol.proj.addCommonProjections @exportSymbol ol.proj.get @exportSymbol ol.proj.getTransform @exportSymbol ol.proj.getTransformFromProjections @exportSymbol ol.proj.transform @exportSymbol ol.proj.transformWithProjections @exportSymbol ol.proj.configureProj4jsProjection + +@exportSymbol ol.proj.common.add diff --git a/src/ol/proj/common.js b/src/ol/proj/common.js index a5e77cf62e..00965a28e6 100644 --- a/src/ol/proj/common.js +++ b/src/ol/proj/common.js @@ -1,4 +1,4 @@ -goog.provide('ol.proj.addCommonProjections'); +goog.provide('ol.proj.common'); goog.require('ol.proj'); goog.require('ol.proj.EPSG3857'); @@ -8,7 +8,7 @@ goog.require('ol.proj.EPSG4326'); /** * FIXME empty description for jsdoc */ -ol.proj.addCommonProjections = function() { +ol.proj.common.add = function() { // Add transformations that don't alter coordinates to convert within set of // projections with equal meaning. ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS); diff --git a/test/spec/ol/map.test.js b/test/spec/ol/map.test.js index e99d3ee857..d005b3e44b 100644 --- a/test/spec/ol/map.test.js +++ b/test/spec/ol/map.test.js @@ -127,6 +127,6 @@ goog.require('goog.dom'); goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.RendererHints'); +goog.require('ol.interaction'); goog.require('ol.interaction.DoubleClickZoom'); goog.require('ol.interaction.MouseWheelZoom'); -goog.require('ol.interaction.defaults');