From e10a8450582bb87674ff2be7e89b839def46d4a8 Mon Sep 17 00:00:00 2001 From: Petr Pridal Date: Fri, 22 Jun 2012 01:32:29 +0200 Subject: [PATCH] Advanced compilation of the API with 'bin/ol api' --- api.json | 43 +++++++++++++++++++++++++++++++++++++++++++ bin/build.xml | 11 ++++++++++- src/ol.export.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 api.json create mode 100644 src/ol.export.js diff --git a/api.json b/api.json new file mode 100644 index 0000000000..9b9d0a1ccf --- /dev/null +++ b/api.json @@ -0,0 +1,43 @@ +{ + "id": "api", + + "output-file": "api.js", + + "inputs": "src/ol.export.js", + "paths": [ + "src" + ], + + "define": { + // "goog.dom.ASSUME_STANDARDS_MODE": true, + // "goog.userAgent.ASSUME_MOBILE_WEBKIT": true, + "goog.DEBUG": false + }, + + "mode": "ADVANCED", + "level": "VERBOSE", + // "pretty-print": true, + // "debug": true, + + // "experimental-compiler-options": { + // "generateExports": true + // }, + + + "checks": { + // acceptable values are "ERROR", "WARNING", and "OFF" + "accessControls": "WARNING", + "visibility": "WARNING", + "checkTypes": "WARNING", + "checkRegExp": "WARNING", + "checkVars": "WARNING", + "deprecated": "WARNING", + "fileoverviewTags": "WARNING", + "invalidCasts": "WARNING", + "missingProperties": "WARNING", + "nonStandardJsDocs": "WARNING", + "undefinedVars": "WARNING" + }, + + "jsdoc-html-output-path": "jsdoc" +} diff --git a/bin/build.xml b/bin/build.xml index 0c22b4b74d..5cf52b6b16 100644 --- a/bin/build.xml +++ b/bin/build.xml @@ -8,12 +8,14 @@ + Available commands: serve - Run the library server + api - Builds the optimized file with public api doc - Build the reference docs @@ -33,6 +35,13 @@ + + + + + + + @@ -41,4 +50,4 @@ - \ No newline at end of file + diff --git a/src/ol.export.js b/src/ol.export.js new file mode 100644 index 0000000000..6e792a3ae2 --- /dev/null +++ b/src/ol.export.js @@ -0,0 +1,47 @@ +goog.require("ol.loc"); +goog.require("ol.feature"); +goog.require("ol.projection"); +goog.require('ol.bounds'); +goog.require("ol.map"); +goog.require("ol.layer.xyz"); +goog.require("ol.layer.osm"); + +// ol.map +goog.exportSymbol('ol.map', ol.map ); +goog.exportSymbol('ol.Map', ol.Map ); +goog.exportProperty( ol.Map.prototype, 'center', ol.Map.prototype.center ); +goog.exportProperty( ol.Map.prototype, 'projection', ol.Map.prototype.projection ); +goog.exportProperty( ol.Map.prototype, 'userProjection', ol.Map.prototype.userProjection ); +goog.exportProperty( ol.Map.prototype, 'zoom', ol.Map.prototype.zoom ); +goog.exportProperty( ol.Map.prototype, 'numZoomLevels', ol.Map.prototype.numZoomLevels ); +goog.exportProperty( ol.Map.prototype, 'resolutions', ol.Map.prototype.resolutions ); +goog.exportProperty( ol.Map.prototype, 'layers', ol.Map.prototype.layers ); +goog.exportProperty( ol.Map.prototype, 'controls', ol.Map.prototype.controls ); +goog.exportProperty( ol.Map.prototype, 'maxExtent', ol.Map.prototype.maxExtent ); +goog.exportProperty( ol.Map.prototype, 'maxRes', ol.Map.prototype.maxRes ); +goog.exportProperty( ol.Map.prototype, 'destroy', ol.Map.prototype.destroy ); + +// ol.loc +goog.exportSymbol('ol.loc', ol.loc ); +goog.exportSymbol('ol.Loc', ol.Loc ); // This is not required only for the tests with isInstanceOf +goog.exportProperty( ol.Loc.prototype, 'projection', ol.Loc.prototype.projection ); +goog.exportProperty( ol.Loc.prototype, 'x', ol.Loc.prototype.x ); +goog.exportProperty( ol.Loc.prototype, 'y', ol.Loc.prototype.y ); +goog.exportProperty( ol.Loc.prototype, 'z', ol.Loc.prototype.z ); +goog.exportProperty( ol.Loc.prototype, 'transform', ol.Loc.prototype.transform ); +goog.exportProperty( ol.Loc.prototype, 'destroy', ol.Loc.prototype.destroy ); + +// ol.projection +goog.exportSymbol('ol.projection', ol.projection ); +goog.exportSymbol('ol.Projection', ol.Projection ); +goog.exportProperty( ol.Projection.prototype, 'code', ol.Projection.prototype.code ); +goog.exportProperty( ol.Projection.prototype, 'units', ol.Projection.prototype.units ); + +// ol.bounds +goog.exportSymbol('ol.bounds', ol.bounds ); +goog.exportSymbol('ol.Bounds', ol.Bounds ); +goog.exportProperty( ol.Bounds.prototype, 'projection', ol.Bounds.prototype.projection ); +goog.exportProperty( ol.Bounds.prototype, 'minX', ol.Bounds.prototype.minX ); +goog.exportProperty( ol.Bounds.prototype, 'minY', ol.Bounds.prototype.minY ); +goog.exportProperty( ol.Bounds.prototype, 'maxX', ol.Bounds.prototype.maxX ); +goog.exportProperty( ol.Bounds.prototype, 'maxY', ol.Bounds.prototype.maxY );