From d6afca38c2c9fd8a136d5ae1abf6737576bc090c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 10 Oct 2014 17:49:42 +0200 Subject: [PATCH 1/2] Use oli/x.js as input files when compiling examples --- build.py | 15 +++++++-------- config/examples-all.json | 11 ++++++++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/build.py b/build.py index 6b07c125a5..cca49a90a8 100755 --- a/build.py +++ b/build.py @@ -251,15 +251,16 @@ def build_examples_all_js(t): @rule(r'\Abuild/examples/(?P.*).json\Z') def examples_star_json(name, match): def action(t): - # It would make more sense to use olx.js as an input file here. We use - # it as an externs file instead to prevent "Cannot read property '*' of - # undefined" error when running examples in "raw" or "whitespace" mode. - # Note that we use the proper way in config/examples-all.json, which - # is only used to check the examples code using the compiler. content = json.dumps({ "exports": [], - "src": ["src/**/*.js", "examples/%(id)s.js" % match.groupdict()], + "src": [ + "src/**/*.js", + "examples/%(id)s.js" % match.groupdict()], "compile": { + "js": [ + "externs/olx.js", + "externs/oli.js", + ], "externs": [ "externs/bingmaps.js", "externs/bootstrap.js", @@ -267,8 +268,6 @@ def examples_star_json(name, match): "externs/example.js", "externs/geojson.js", "externs/jquery-1.9.js", - "externs/oli.js", - "externs/olx.js", "externs/proj4js.js", "externs/tilejson.js", "externs/topojson.js", diff --git a/config/examples-all.json b/config/examples-all.json index 72cf8d4e31..b3983b9673 100644 --- a/config/examples-all.json +++ b/config/examples-all.json @@ -1,7 +1,14 @@ { "exports": [], - "src": ["src/**/*.js", "build/examples/all.js"], + "src": [ + "src/**/*.js", + "build/examples/all.js" + ], "compile": { + "js": [ + "externs/olx.js", + "externs/oli.js" + ], "externs": [ "externs/bingmaps.js", "externs/bootstrap.js", @@ -9,8 +16,6 @@ "externs/example.js", "externs/geojson.js", "externs/jquery-1.9.js", - "externs/oli.js", - "externs/olx.js", "externs/proj4js.js", "externs/tilejson.js", "externs/topojson.js", From 6cf5f204c5f759672c2ab88cd3465f961a0cb31a Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Sat, 11 Oct 2014 10:35:20 +0200 Subject: [PATCH 2/2] Add explanation on using externs as input --- build.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.py b/build.py index cca49a90a8..d55a6edef1 100755 --- a/build.py +++ b/build.py @@ -258,6 +258,10 @@ def examples_star_json(name, match): "examples/%(id)s.js" % match.groupdict()], "compile": { "js": [ + # When compling the examples, the OpenLayers 'externs' can be used + # as inputs directly. By passing them directly to the compiler, + # they are handled like source code (as manage_closure_dependencies + # prevents them from being ignored by the compiler). "externs/olx.js", "externs/oli.js", ],