Skip to content

Commit

Permalink
Merge pull request #488 from openlayers/npm_instead_of_submodules
Browse files Browse the repository at this point in the history
Depend on OpenLayers and Cesium through npm
  • Loading branch information
gberaudo authored Sep 1, 2017
2 parents c6f266c + 26681f9 commit 44e7471
Show file tree
Hide file tree
Showing 24 changed files with 52 additions and 93 deletions.
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ cache:
directories:
- node_modules

git:
submodules: false

before_install:
- git submodule update --init ol

script:
- NO_CESIUM=1 make dist
- NO_CESIUM=1 make check
- NO_CESIUM=1 make dist-examples
- make dist
- make check
- make dist-examples
- ./build/goog-count.sh
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

* Changes
* Update OpenLayers to v4.3.1 to fix https://github.com/openlayers/ol-cesium/issues/479
* Get OpenLayers and Cesium dependencies through npm instead of git
submodules. On old clones you must remove manually the unused "ol" and
"cesium" directories.
* Switch to @camptocamp/closure-util fork to allow using goog.modules.
* Switch to @camptocamp/cesium to allow examples based on vector tiles and
advanced performance optimizations.

# v 1.30 - 2017-08-03

Expand Down
51 changes: 8 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ help:
npm-install: .build/node_modules.timestamp

.PHONY: serve
serve: npm-install cesium/Build/Cesium/Cesium.js
serve: npm-install
node build/serve.js

.PHONY: dist
Expand Down Expand Up @@ -62,11 +62,6 @@ check: lint dist .build/geojsonhint.timestamp
.PHONY: clean
clean:
rm -f dist/olcesium.js
rm -f ol/build/ol.js
rm -f ol/build/ol-debug.js
rm -f ol/build/ol.css
rm -rf cesium/Build/Cesium
rm -rf cesium/Build/CesiumUnminified
rm -rf dist/ol
rm -rf dist/examples
rm -rf dist/Cesium
Expand All @@ -85,59 +80,29 @@ cleanall: clean
./node_modules/.bin/eslint --ignore-pattern examples/Jugl.js --ignore-pattern examples/example-list.js $^
touch $@

.build/dist-examples.timestamp: cesium/Build/Cesium/Cesium.js cesium/Build/CesiumUnminified/Cesium.js dist/olcesium.js $(EXAMPLES_JS_FILES) $(EXAMPLES_HTML_FILES)
.build/dist-examples.timestamp: dist/olcesium.js $(EXAMPLES_JS_FILES) $(EXAMPLES_HTML_FILES)
node build/parse-examples.js
mkdir -p $(dir $@)
cp -R cesium/Build/Cesium dist/
cp -R cesium/Build/CesiumUnminified dist/
cp -R node_modules/@camptocamp/cesium/Build/Cesium dist/
cp -R node_modules/@camptocamp/cesium/Build/CesiumUnminified dist/
cp -R examples dist/
cp ol/css/ol.css dist/
cp node_modules/openlayers/css/ol.css dist/
$(SEDI) 'sYDIST = falseYDIST = trueY' dist/examples/inject_ol_cesium.js
$(SEDI) '[email protected]' dist/examples/inject_ol_cesium.js
$(SEDI) 'sY../cesium/Build/Y../Y' dist/examples/inject_ol_cesium.js
for f in dist/examples/*.html; do $(SEDI) 'sY../ol/css/ol.cssY../ol.cssY' $$f; done
$(SEDI) 'sY../node_modules/@camptocamp/cesium/Build/Y../Y' dist/examples/inject_ol_cesium.js
for f in dist/examples/*.html; do $(SEDI) 'sY../node_modules/openlayers/css/ol.cssY../ol.cssY' $$f; done
touch $@

dist/olcesium-debug.js: build/olcesium-debug.json $(SRC_JS_FILES) Cesium.externs.js build/build.js npm-install
mkdir -p $(dir $@)
node build/build.js $< $@


ol/node_modules/rbush/package.json: ol/package.json
(cd ol && npm install --production)

ol/build/ol.ext/rbush.js: ol/node_modules/rbush/package.json
(cd ol && node tasks/build-ext.js)


# A sourcemap is prepared, the source is exected to be deployed in 'source' directory
dist/olcesium.js: build/olcesium.json $(SRC_JS_FILES) Cesium.externs.js build/build.js npm-install ol/build/ol.ext/rbush.js
dist/olcesium.js: build/olcesium.json $(SRC_JS_FILES) Cesium.externs.js build/build.js npm-install
mkdir -p $(dir $@)
node build/build.js $< $@
$(SEDI) 's!$(shell pwd)/dist!source!g' dist/olcesium.js.map
$(SEDI) 's!$(shell pwd)!source!g' dist/olcesium.js.map
# echo '//# sourceMappingURL=olcesium.js.map' >> dist/olcesium.js
# -ln -s .. dist/source

cesium/node_modules/.bin/gulp: cesium/package.json
cd cesium && npm install

# Only generated when cesium/Build/Cesium/Cesium.js does not exist
# or CHANGES.md changed
ifndef NO_CESIUM
cesium/Build/Cesium/Cesium.js: cesium/CHANGES.md cesium/node_modules/.bin/gulp
(cd cesium && node_modules/.bin/gulp $(CESIUM_COMPILE_TARGET))
else
cesium/Build/Cesium/Cesium.js:
mkdir -p cesium/Build/Cesium/
endif

# Only generated when cesium/Build/CesiumUnminified/Cesium.js does not exist
# or CHANGES.md changed
ifndef NO_CESIUM
cesium/Build/CesiumUnminified/Cesium.js: cesium/CHANGES.md cesium/node_modules/.bin/gulp
(cd cesium && node_modules/.bin/gulp combine)
else
cesium/Build/CesiumUnminified/Cesium.js:
mkdir -p cesium/Build/CesiumUnminified/
endif
4 changes: 2 additions & 2 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var path = require('path');

var async = require('async');
var closure = require('closure-util');
var closure = require('@camptocamp/closure-util');
var fs = require('fs-extra');
var nomnom = require('nomnom');
var exec = require('child_process').exec;
Expand Down Expand Up @@ -168,7 +168,7 @@ function build(config, paths, callback) {
concatenate(paths, callback);
} else {
log.info('ol-cesium', 'Compiling ' + paths.length + ' sources');
paths = paths.concat('ol/src/ol/typedefs.js');
paths = paths.concat('node_modules/openlayers/src/ol/typedefs.js');
options.compile.js = paths.concat(options.compile.js || []);
closure.compile(options, callback);
}
Expand Down
2 changes: 1 addition & 1 deletion build/generate-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var fse = require('fs-extra');
var walk = require('walk').walk;
var isWindows = process.platform.indexOf('win') === 0;

var sourceDirOL = path.join(__dirname, '..', 'ol', 'src');
var sourceDirOL = path.join(__dirname, '..', 'node_modules', 'openlayers', 'src');
var sourceDirSelf = path.join(__dirname, '..', 'src');
var sourceDirs = [sourceDirOL, sourceDirSelf];
var infoPath = path.join(__dirname, '..', '.build', 'info.json');
Expand Down
4 changes: 2 additions & 2 deletions build/olcesium-debug.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"src": [
"src/**/*.js",
"ol/src/**/*.js",
"ol/build/ol.ext/*.js"
"node_modules/openlayers/src/**/*.js",
"node_modules/openlayers/build/ol.ext/*.js"
],
"exports": ["*"]
}
24 changes: 12 additions & 12 deletions build/olcesium.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"exports": ["*"],
"src": [
"src/**/*.js",
"ol/src/**/*.js",
"ol/build/ol.ext/*.js"
"node_modules/openlayers/src/**/*.js",
"node_modules/openlayers/build/ol.ext/*.js"
],
"compile": {
"externs": [
"externs/olcsx.js",
"ol/externs/oli.js",
"ol/externs/olx.js",
"ol/externs/cartodb.js",
"ol/externs/proj4js.js",
"ol/externs/tilejson.js",
"ol/externs/topojson.js",
"ol/externs/esrijson.js",
"ol/externs/geojson.js",
"ol/externs/bingmaps.js",
"ol/externs/closure-compiler.js",
"node_modules/openlayers/externs/oli.js",
"node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/cartodb.js",
"node_modules/openlayers/externs/proj4js.js",
"node_modules/openlayers/externs/tilejson.js",
"node_modules/openlayers/externs/topojson.js",
"node_modules/openlayers/externs/esrijson.js",
"node_modules/openlayers/externs/geojson.js",
"node_modules/openlayers/externs/bingmaps.js",
"node_modules/openlayers/externs/closure-compiler.js",
"Cesium.externs.js"
],
"js": [
Expand Down
6 changes: 3 additions & 3 deletions build/serve.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var path = require('path');
var url = require('url');

var closure = require('closure-util');
var closure = require('@camptocamp/closure-util');
var nomnom = require('nomnom');

var log = closure.log;
Expand Down Expand Up @@ -31,8 +31,8 @@ var manager = new closure.Manager({
closure: true, // use the bundled Closure Library
lib: [
'src/**/*.js',
'ol/src/**/*.js',
'ol/build/ol.ext/*.js'
'node_modules/openlayers/src/**/*.js',
'node_modules/openlayers/build/ol.ext/*.js'
]
});
manager.on('error', function(e) {
Expand Down
1 change: 0 additions & 1 deletion cesium
Submodule cesium deleted from 6d6339
2 changes: 1 addition & 1 deletion examples/exports.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium exported methods example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div id="map" style="width:600px;height:400px;float:left;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/inject_ol_cesium.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const ol = (DIST && isDev) ? 'olcesium-debug.js' : '@loader';

if (!window.LAZY_CESIUM) {
document.write(`${'<scr' + 'ipt type="text/javascript" src="../cesium/Build/'}${cs}"></scr` + 'ipt>');
document.write(`${'<scr' + 'ipt type="text/javascript" src="../node_modules/@camptocamp/cesium/Build/'}${cs}"></scr` + 'ipt>');
}
document.write(`${'<scr' + 'ipt type="text/javascript" src="../'}${ol}"></scr` + 'ipt>');

Expand Down
2 changes: 1 addition & 1 deletion examples/kml.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium kml example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div id="map" style="width:600px;height:400px;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/lazy.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium lazy initialization</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div>Delay downloading the Cesium script and initializing the 3D globe.</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div id="map" style="width:600px;height:400px;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/rastersync.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium raster layer synchronization example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
<style>
fieldset {display:inline-block;float:left;}
label {display:block;}
Expand Down
2 changes: 1 addition & 1 deletion examples/rotate.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium animated rotation example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css"></link>
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css"></link>
<style>.cesium-credit-textContainer { display: inline-block; font-size: 50%; line-height: 100%;}</style>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium selection example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css"></link>
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css"></link>
</head>
<body>
<div id="map2d" style="width:600px;height:400px;float:left;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/sidebyside.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium side-by-side example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div id="map2d" style="width:600px;height:400px;float:left;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/synthvectors_batch.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium synthetic vector layer example using several layers</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css">
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css">
</head>
<body>
<div id="map2d" style="width:600px;height:400px;float:left;"></div>
Expand Down
2 changes: 1 addition & 1 deletion examples/tracking.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium tracking example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css"></link>
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css"></link>
<style>.cesium-credit-textContainer { display: inline-block; font-size: 50%; line-height: 100%;}</style>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/vectors.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, all" />
<title>olcesium vectors example</title>
<link rel="stylesheet" href="../ol/css/ol.css" type="text/css"></link>
<link rel="stylesheet" href="../node_modules/openlayers/css/ol.css" type="text/css"></link>
<style>.cesium-credit-textContainer { display: inline-block; font-size: 50%; line-height: 100%;}</style>
</head>
<body>
Expand Down
1 change: 0 additions & 1 deletion ol
Submodule ol deleted from d218c4
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"htmlparser2": "3.9.2"
},
"devDependencies": {
"closure-util": "1.22.0",
"@camptocamp/closure-util": "1.23.0",
"openlayers": "4.3.1",
"@camptocamp/cesium": "1.36.0",
"@mapbox/geojsonhint": "2.0.1",
"fs-extra": "3.0.1",
"jsdoc": "~3.4.0",
Expand Down

0 comments on commit 44e7471

Please sign in to comment.