Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Compile OL3 and OL3-Cesium together
Browse files Browse the repository at this point in the history
Required following openlayers/ol-cesium#289.


As a side note, the total size of app + ol3 + ol3-cesium is now
around 15K lighter (before gzip).
  • Loading branch information
gberaudo committed Nov 19, 2015
1 parent 1065191 commit 2246209
Show file tree
Hide file tree
Showing 6 changed files with 107,409 additions and 94,190 deletions.
62 changes: 29 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DEPLOY_ROOT_DIR := /var/www/vhosts/mf-geoadmin3/private/branch
DEPLOY_TARGET ?= 'dev'
LAST_DEPLOY_TARGET := $(shell if [ -f .build-artefacts/last-deploy-target ]; then cat .build-artefacts/last-deploy-target 2> /dev/null; else echo '-none-'; fi)
OL3_VERSION ?= 627abaf1a71d48627163eb00ea6a0b6fb8dede14
OL3_CESIUM_VERSION ?= c68901adc91bbc019d6cc70056c51c00aa2fe99f
OL3_CESIUM_VERSION ?= dbbc31dd2ec4751aab9e1892d78fdc1e7b55f7eb
CESIUM_VERSION ?= 3e3cf938786ee48b4b376ed932904541d798671d
DEFAULT_TOPIC_ID ?= ech
TRANSLATION_FALLBACK_CODE ?= de
Expand Down Expand Up @@ -129,7 +129,7 @@ deploydev:
./scripts/deploydev.sh -s; \
else \
./scripts/deploydev.sh; \
fi
fi

.PHONY: deploydemo
deploydemo: guard-SNAPSHOT
Expand Down Expand Up @@ -167,32 +167,25 @@ deploybranchdemo: deploybranch
.PHONY: preparebranch
preparebranch: rc_branch scripts/00-$(GIT_BRANCH).conf

.PHONY: ol
ol: OL_JS = ol.js ol-debug.js
ol: scripts/ol-geoadmin.json .build-artefacts/ol3
cd .build-artefacts/ol3; \
git reset HEAD --hard; \
git fetch -a; \
git checkout $(OL3_VERSION); \
git show; \
cat ../../scripts/ga-ol3-style.exports >> src/ol/style/style.js; \
cat ../../scripts/ga-ol3-tilegrid.exports >> src/ol/tilegrid/tilegrid.js; \
cat ../../scripts/ga-ol3-tilerange.exports >> src/ol/tilerange.js; \
cat ../../scripts/ga-ol3-view.exports >> src/ol/view.js; \
npm install; \
node tasks/build.js config/ol-debug.json build/ol-debug.js; \
node tasks/build.js ../../scripts/ol-geoadmin.json build/ol.js; \
cd ../../; \
cp $(addprefix .build-artefacts/ol3/build/,$(OL_JS)) src/lib/;

.PHONY: ol3cesium
ol3cesium: ol .build-artefacts/ol3-cesium
ol3cesium: .build-artefacts/ol3-cesium
cd .build-artefacts/ol3-cesium; \
git reset HEAD --hard; \
git fetch --all; \
git checkout $(OL3_CESIUM_VERSION); \
git submodule update --recursive --init --force; \
cd cesium; \
cd ol3; \
git reset HEAD --hard; \
git fetch --all; \
git checkout $(OL3_VERSION); \
git show; \
cat ../../../scripts/ga-ol3-style.exports >> src/ol/style/style.js; \
cat ../../../scripts/ga-ol3-tilegrid.exports >> src/ol/tilegrid/tilegrid.js; \
cat ../../../scripts/ga-ol3-tilerange.exports >> src/ol/tilerange.js; \
cat ../../../scripts/ga-ol3-view.exports >> src/ol/view.js; \
npm install --production; \
node tasks/build-ext.js; \
cd ../cesium; \
git remote | grep c2c || git remote add c2c git://github.com/camptocamp/cesium; \
git fetch --all; \
git checkout $(CESIUM_VERSION); \
Expand All @@ -201,13 +194,16 @@ ol3cesium: ol .build-artefacts/ol3-cesium
ln -T -f -s ../../../../ol3-cesium-plugin/ src/plugins/geoadmin; \
( cd cesium; [ -f node_modules/.bin/gulp ] || npm install ); \
( cd cesium; if [ -f "Build/Cesium/Cesium.js" ] ; then echo 'Skipping Cesium minified build'; else node_modules/.bin/gulp minifyRelease; fi ); \
NO_CESIUM=1 make dist; \
( cd cesium; if [ -f "Build/CesiumUnminified/Cesium.js" ] ; then echo 'Skipping Cesium debug build'; else node_modules/.bin/gulp generateStubs combine; fi ); \
node build/build.js ../../scripts/ol3cesium-debug-geoadmin.json dist/ol3cesium-debug.js; \
npm install; \
node build/generate-exports.js dist/exports.js; \
node build/build.js build/ol3cesium-debug.json dist/ol3cesium-debug.js; \
node build/build.js ../../scripts/ol3cesium-geoadmin.json dist/ol3cesium.js; \
cp dist/ol3cesium-debug.js ../../src/lib/; \
cat cesium/Build/Cesium/Cesium.js dist/ol3cesium.js > ../../src/lib/ol3cesium.js; \
cp dist/ol3cesium.js ../../src/lib/ol3cesium.js; \
rm -rf ../../src/lib/Cesium/*; \
cp -r cesium/Build/CesiumUnminified/* ../../src/lib/Cesium;
cp -r cesium/Build/CesiumUnminified/* ../../src/lib/Cesium; \
cp -R cesium/Build/Cesium/Cesium.js ../../src/lib/;

.PHONY: fastclick
fastclick: .build-artefacts/fastclick .build-artefacts/closure-compiler/compiler.jar
Expand Down Expand Up @@ -239,8 +235,8 @@ datepicker: .build-artefacts/datepicker
translate:
${PYTHON_CMD} scripts/translation2json.py \
--files $(TRANSLATE_CSV_FILES) \
--languages "$(LANGUAGES)" \
--empty-json-file $(TRANSLATE_EMPTY_JSON) \
--languages "$(LANGUAGES)" \
--empty-json-file $(TRANSLATE_EMPTY_JSON) \
--output-folder $(TRANSLATE_OUTPUT)

.PHONY: fixrights
Expand Down Expand Up @@ -277,13 +273,16 @@ prd/lib/build.js: src/lib/jquery-2.0.3.min.js \
src/lib/EPSG2056.js \
src/lib/EPSG32631.js \
src/lib/EPSG32632.js \
src/lib/ol.js \
src/lib/angular-translate.min.js \
src/lib/angular-translate-loader-static-files.min.js \
src/lib/fastclick.min.js \
src/lib/localforage.min.js \
src/lib/filesaver.min.js \
.build-artefacts/app.js
.build-artefacts/app.js \
src/lib/ol3cesium.js
# src/lib/ol3cesium.js is placed last to avoid the "ga" object to be
# overwritten by angular. The issue was "ga.GaRasterSynchronizer" beeing
# undefined in the production build.
mkdir -p $(dir $@)
cat $^ | sed 's/^\/\/[#,@] sourceMappingURL=.*//' > $@

Expand Down Expand Up @@ -581,9 +580,6 @@ scripts/00-$(GIT_BRANCH).conf: scripts/00-branch.mako-dot-conf \
test $(DEPLOY_TARGET) != $(LAST_DEPLOY_TARGET) && \
echo $(DEPLOY_TARGET) > .build-artefacts/last-deploy-target || :

.build-artefacts/ol3:
git clone https://github.com/openlayers/ol3.git $@

.build-artefacts/ol3-cesium:
git clone --recursive https://github.com/openlayers/ol3-cesium.git $@

Expand Down
186 changes: 186 additions & 0 deletions scripts/ol3cesium-geoadmin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"src": [
"src/**/*.js",
"ol3/src/**/*.js",
"ol3/build/ol.ext/*.js"
],
"exports": [
"olcs.*",
"ga.GaRasterSynchronizer*",
"ol.Collection",
"ol.Collection#*",
"ol.DeviceOrientation",
"ol.DeviceOrientation#*",
"ol.Feature",
"ol.Feature#*",
"ol.Geolocation",
"ol.Geolocation#*",
"ol.ImageTile#getImage",
"ol.Map",
"ol.Map#*",
"ol.MapBrowserEvent#*",
"ol.Observable.unByKey",
"ol.Overlay",
"ol.Overlay#*",
"ol.View",
"ol.View#*",
"ol.animation.bounce",
"ol.animation.pan",
"ol.animation.rotate",
"ol.animation.zoom",
"ol.color.asArray",
"ol.color.asString",
"ol.control.MousePosition",
"ol.control.MousePosition#*",
"ol.control.ScaleLine",
"ol.control.ScaleLine#*",
"ol.control.ZoomToExtent",
"ol.control.ZoomToExtent#*",
"ol.control.defaults",
"ol.coordinate.format",
"ol.coordinate.toStringHDMS",
"ol.coordinate.toStringXY",
"ol.easing.easeOut",
"ol.easing.linear",
"ol.extent.buffer",
"ol.extent.containsCoordinate",
"ol.extent.containsXY",
"ol.extent.getCenter",
"ol.extent.getHeight",
"ol.extent.getWidth",
"ol.extent.intersects",
"ol.format.GeoJSON",
"ol.format.GeoJSON#*",
"ol.format.KML",
"ol.format.KML#*",
"ol.format.WMSCapabilities",
"ol.format.WMSCapabilities#*",
"ol.geom.Circle",
"ol.geom.Circle#*",
"ol.geom.GeometryCollection",
"ol.geom.GeometryCollection#*",
"ol.geom.LinearRing",
"ol.geom.LinearRing#*",
"ol.geom.LineString",
"ol.geom.LineString#*",
"ol.geom.MultiLineString",
"ol.geom.MultiLineString#*",
"ol.geom.MultiPoint",
"ol.geom.MultiPoint#*",
"ol.geom.MultiPolygon",
"ol.geom.MultiPolygon#*",
"ol.geom.Point",
"ol.geom.Point#*",
"ol.geom.Polygon",
"ol.geom.Polygon#*",
"ol.geom.SimpleGeometry",
"ol.geom.SimpleGeometry#*",
"ol.has.DEVICE_ORIENTATION",
"ol.has.DEVICE_PIXEL_RATIO",
"ol.interaction.DragBox",
"ol.interaction.DragBox#*",
"ol.interaction.DragZoom",
"ol.interaction.DragZoom#*",
"ol.interaction.Draw",
"ol.interaction.Draw#*",
"ol.interaction.KeyboardPan",
"ol.interaction.KeyboardPan#*",
"ol.interaction.KeyboardZoom",
"ol.interaction.KeyboardZoom#*",
"ol.interaction.Modify",
"ol.interaction.Modify#*",
"ol.interaction.Select",
"ol.interaction.Select#*",
"ol.interaction.Snap",
"ol.interaction.Snap#*",
"ol.interaction.defaults",
"ol.layer.Group",
"ol.layer.Group#*",
"ol.layer.Image",
"ol.layer.Image#*",
"ol.layer.Layer",
"ol.layer.Layer#*",
"ol.layer.Tile",
"ol.layer.Tile#*",
"ol.layer.Vector",
"ol.layer.Vector#*",
"ol.proj.Projection",
"ol.proj.Projection#*",
"ol.proj.get",
"ol.proj.getTransform",
"ol.proj.transform",
"ol.proj.transformExtent",
"ol.style.Circle",
"ol.style.Circle#*",
"ol.style.Fill",
"ol.style.Fill#*",
"ol.style.Icon",
"ol.style.Icon#*",
"ol.style.Image",
"ol.style.Image#*",
"ol.style.RegularShape",
"ol.style.RegularShape#*",
"ol.style.Stroke",
"ol.style.Stroke#*",
"ol.style.Style",
"ol.style.Style#*",
"ol.style.Text",
"ol.style.Text#*",
"ol.source.ImageVector",
"ol.source.ImageVector#*",
"ol.source.ImageWMS",
"ol.source.ImageWMS#*",
"ol.source.TileImage",
"ol.source.TileImage#*",
"ol.source.TileWMS",
"ol.source.TileWMS#*",
"ol.source.Vector",
"ol.source.Vector#*",
"ol.source.WMTS",
"ol.source.WMTS#*",
"ol.tilegrid.TileGrid",
"ol.tilegrid.TileGrid#*",
"ol.tilegrid.WMTS",
"ol.tilegrid.WMTS#*"
],
"umd": true,
"compile": {
"externs": [
"externs/olcsx.js",
"Cesium.externs.js",
"ol3/externs/bingmaps.js",
"ol3/externs/closure-compiler.js",
"ol3/externs/geojson.js",
"ol3/externs/oli.js",
"ol3/externs/olx.js",
"ol3/externs/proj4js.js",
"ol3/externs/tilejson.js",
"ol3/externs/topojson.js"
],
"define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false",
"ol.ENABLE_DOM=false",
"ol.ENABLE_WEBGL=false"
],
"jscomp_error": [
"*"
],
"jscomp_off": [
"useOfGoogBase",
"unnecessaryCasts",
"lintChecks"
],
"extra_annotation_name": [
"api", "observable"
],
"compilation_level": "ADVANCED",
"warning_level": "VERBOSE",
"use_types_for_optimization": true,
"manage_closure_dependencies": true,
"create_source_map": "dist/ol3cesium.js.map",
"source_map_format": "V3"
}
}
4 changes: 2 additions & 2 deletions src/js/GaCesium.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ goog.provide('ga_cesium');
var GaCesium = function(map, gaPermalink, gaLayers, gaGlobalOptions,
gaBrowserSniffer, $q, $translate) {
// Url of ol3cesium library
var ol3CesiumLibUrl = gaGlobalOptions.resourceUrl + 'lib/ol3cesium.js';
var ol3CesiumLibUrl = gaGlobalOptions.resourceUrl + 'lib/Cesium/Cesium.js';
var cesiumLoaded = $q.defer();
var cesiumClients = $q.defer();
var ol3d = undefined;
Expand Down Expand Up @@ -180,7 +180,7 @@ var GaCesium = function(map, gaPermalink, gaLayers, gaGlobalOptions,
return function(activate) {
// Check if cesium library is already loaded
toActivate = activate;
if (!window.olcs) {
if (!window.Cesium) {
loading = true;
$.getScript(ol3CesiumLibUrl, function() {
cesiumLoaded.resolve(toActivate);
Expand Down
Loading

0 comments on commit 2246209

Please sign in to comment.