OpenLayers OpenLayers

Ticket #490 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

build system: automatically include files using @requires

Reported by: bartvde Assigned to:
Priority: minor Milestone: 2.4 Release
Component: general Version: 2.3 RC2
Keywords: Cc:
State:

Description

It would be nice if the build system would automatically include dependencies using the @requires tag. See following e-mail discussion:

Does the @requires tag still work? I always seem to get a key error:

Traceback (most recent call last): File "build.py", line 18, in ? merged = mergejs.run(sourceDirectory, None, configFilename) File "../tools/mergejs.py", line 193, in run if max([order.index(rfp) for rfp in files[fp].requires] + KeyError: 'OpenLayers/Control.js'

I started by copying lite.cfg and adding only PanZoom.js:

[first] OpenLayers/SingleFile.js OpenLayers.js OpenLayers/BaseTypes.js OpenLayers/Util.js

[last]

[include] OpenLayers/Events.js OpenLayers/Map.js OpenLayers/Layer.js OpenLayers/Layer/Grid.js OpenLayers/Layer/HTTPRequest.js OpenLayers/Layer/WMS.js OpenLayers/Layer/WMS/Untiled.js OpenLayers/Tile.js OpenLayers/Tile/Image.js OpenLayers/Control/PanZoom.js

[exclude]

If I add in OpenLayers/Control.js before I include PanZoom.js all is fine, i.e. if I resolve the dependencies in the build file myself.

The dependancy resolution still requires you to include the files yourself, it simply resoles the order they end up in the build. So, if you want to build something which depends on Controls, you need to include OpenLayers/Control.js -- however, it can be at the end of the include list. Changing this behavior is an obvious feature request once you look at it, but I'd simply never thought about it: patches graciously accepted.

Attachments

buildtools.patch (3.3 kB) - added by crschmidt on 02/18/07 10:48:32.

Change History

02/18/07 10:48:32 changed by crschmidt

  • attachment buildtools.patch added.

02/18/07 10:49:53 changed by crschmidt

  • keywords set to review.
  • milestone set to 2.4 Release.

The attached patch changes mergejs.py to loop over the dependencies until they are all met, rather than just assuming that they are. The output looks like this:

disciplina:~/openlayers/build crschmidt$ python build.py lite2
Merging libraries.
Importing: OpenLayers.js
Importing: OpenLayers/BaseTypes.js
Importing: OpenLayers/Map.js
Importing: OpenLayers/SingleFile.js
Importing: OpenLayers/Util.js
Importing: OpenLayers/Layer/KaMap.js
Importing: OpenLayers/Layer/WMS.js

Resolution pass 1... 
Importing: OpenLayers/Events.js
Importing: OpenLayers/Layer/Grid.js

Resolution pass 2... 
Importing: OpenLayers/Layer/HTTPRequest.js

Resolution pass 3... 
Importing: OpenLayers/Layer.js

Re-ordering files...

Exporting:  OpenLayers/SingleFile.js
Exporting:  OpenLayers.js
Exporting:  OpenLayers/BaseTypes.js
Exporting:  OpenLayers/Util.js
Exporting:  OpenLayers/Events.js
Exporting:  OpenLayers/Layer.js
Exporting:  OpenLayers/Layer/HTTPRequest.js
Exporting:  OpenLayers/Map.js
Exporting:  OpenLayers/Layer/Grid.js
Exporting:  OpenLayers/Layer/KaMap.js
Exporting:  OpenLayers/Layer/WMS.js

Total files merged: 11 
Compressing.
Adding license file.
Writing to OpenLayers.js.
Done.

03/08/07 15:21:12 changed by sderle

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

Applied as r2542.