summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--binding.gyp (renamed from platform/node/binding.gyp)28
-rw-r--r--package.json (renamed from platform/node/package.json)6
-rw-r--r--platform/node/test/fixtures/style.json6
-rw-r--r--platform/node/test/fixtures/tiles.tilejson13
-rw-r--r--platform/node/test/js/consecutive.test.js2
-rw-r--r--platform/node/test/js/gzip.test.js9
-rw-r--r--platform/node/test/js/map.test.js14
-rw-r--r--platform/node/test/render.test.js2
-rw-r--r--scripts/main.mk16
10 files changed, 40 insertions, 59 deletions
diff --git a/.gitignore b/.gitignore
index 7613490aa5..4ee833bcf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
/mason_packages
/config/*.gypi
/build
+/lib
/macosx/build
/linux/build
/ios/build
@@ -28,8 +29,6 @@
/src/shader/shaders_gl.cpp
/src/shader/shaders_gles2.cpp
/bin/style.bin.js
-/platform/*.mk
-/platform/*.Makefile
*~
/ios/benchmark/assets/tiles/mapbox.mapbox-streets-v6/
diff --git a/platform/node/binding.gyp b/binding.gyp
index 88ad5ed599..374ae1afd0 100644
--- a/platform/node/binding.gyp
+++ b/binding.gyp
@@ -1,28 +1,28 @@
{
'includes': [
- '../../gyp/common.gypi',
+ 'gyp/common.gypi',
],
'targets': [
{ 'target_name': '<(module_name)',
'dependencies': [
- '../../mbgl.gyp:core',
- '../../mbgl.gyp:platform-<(platform_lib)',
- '../../mbgl.gyp:headless-<(headless_lib)',
+ 'mbgl.gyp:core',
+ 'mbgl.gyp:platform-<(platform_lib)',
+ 'mbgl.gyp:headless-<(headless_lib)',
],
'include_dirs': [ "<!(node -e \"require('nan')\")" ],
'sources': [
- 'src/node_mapbox_gl_native.cpp',
- 'src/node_log.hpp',
- 'src/node_log.cpp',
- 'src/node_file_source.hpp',
- 'src/node_file_source.cpp',
- 'src/node_map.hpp',
- 'src/node_map.cpp',
- 'src/node_request.hpp',
- 'src/node_request.cpp',
- 'src/util/async_queue.hpp',
+ 'platform/node/src/node_mapbox_gl_native.cpp',
+ 'platform/node/src/node_log.hpp',
+ 'platform/node/src/node_log.cpp',
+ 'platform/node/src/node_file_source.hpp',
+ 'platform/node/src/node_file_source.cpp',
+ 'platform/node/src/node_map.hpp',
+ 'platform/node/src/node_map.cpp',
+ 'platform/node/src/node_request.hpp',
+ 'platform/node/src/node_request.cpp',
+ 'platform/node/src/util/async_queue.hpp',
],
'conditions': [
diff --git a/platform/node/package.json b/package.json
index fb8663d9ae..0063cc9898 100644
--- a/platform/node/package.json
+++ b/package.json
@@ -33,9 +33,9 @@
"tape": "^4.2.0"
},
"scripts": {
- "install": "node-pre-gyp install || make node -C ../../",
- "test": "tape test/js/**/*.test.js",
- "test-suite": "tape test/render.test.js"
+ "install": "node-pre-gyp install --fallback-to-build=false || make node",
+ "test": "tape platform/node/test/js/**/*.test.js",
+ "test-suite": "tape platform/node/test/render.test.js"
},
"gypfile": true,
"binary": {
diff --git a/platform/node/test/fixtures/style.json b/platform/node/test/fixtures/style.json
index 55442c879d..222ac82bf8 100644
--- a/platform/node/test/fixtures/style.json
+++ b/platform/node/test/fixtures/style.json
@@ -4,8 +4,10 @@
"sources": {
"mapbox": {
"type": "vector",
- "url": "./fixtures/tiles.tilejson",
- "maxzoom": 15
+ "maxzoom": 15,
+ "tiles": [
+ "./fixtures/tiles/{z}-{x}-{y}.vector.pbf"
+ ]
}
},
"layers": [
diff --git a/platform/node/test/fixtures/tiles.tilejson b/platform/node/test/fixtures/tiles.tilejson
deleted file mode 100644
index 320c17500e..0000000000
--- a/platform/node/test/fixtures/tiles.tilejson
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "bounds": [ -180, -85.0511, 180, 85.0511 ],
- "center": [ 0, 0, 0 ],
- "format": "pbf",
- "id": "mapbox.mapbox-streets-v6-dev",
- "maskLevel": 8,
- "maxzoom": 15,
- "minzoom": 0,
- "name": "Mapbox Streets V6",
- "scheme": "xyz",
- "tilejson": "2.0.0",
- "tiles": [ "./fixtures/tiles/{z}-{x}-{y}.vector.pbf" ]
-}
diff --git a/platform/node/test/js/consecutive.test.js b/platform/node/test/js/consecutive.test.js
index ec4b2968bd..928ca1d837 100644
--- a/platform/node/test/js/consecutive.test.js
+++ b/platform/node/test/js/consecutive.test.js
@@ -3,7 +3,7 @@
/* jshint node:true */
var test = require('tape');
-var mbgl = require('../..');
+var mbgl = require('../../../..');
var fs = require('fs');
var path = require('path');
diff --git a/platform/node/test/js/gzip.test.js b/platform/node/test/js/gzip.test.js
index 9e899604ae..4545a18cf5 100644
--- a/platform/node/test/js/gzip.test.js
+++ b/platform/node/test/js/gzip.test.js
@@ -3,24 +3,23 @@
/* jshint node: true */
var test = require('tape').test;
-var mbgl = require('../..');
+var mbgl = require('../../../..');
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var http = require('http');
var request = require('request');
var st = require('st');
-var style = require('../../test/fixtures/style.json');
+var style = require('../fixtures/style.json');
var PNG = require('pngjs').PNG;
var compare = require('../compare.js');
-var dirPath = path.join(path.dirname(require.resolve('../../package.json')), 'test');
-var server = http.createServer(st({ path: dirPath }));
+var server = http.createServer(st({ path: path.join(__dirname, '..') }));
server.listen(0);
function filePath(name) {
return ['expected', 'actual', 'diff'].reduce(function(prev, key) {
- var dir = path.join('test', key, 'gzip');
+ var dir = path.join(__dirname, '..', key, 'gzip');
mkdirp.sync(dir);
prev[key] = path.join(dir, name);
return prev;
diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js
index d4a8a77960..09870abaaa 100644
--- a/platform/node/test/js/map.test.js
+++ b/platform/node/test/js/map.test.js
@@ -3,7 +3,7 @@
/* jshint node: true */
var test = require('tape');
-var mbgl = require('../..');
+var mbgl = require('../../../..');
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
@@ -13,7 +13,7 @@ var compare = require('../compare.js');
function filePath(name) {
return ['expected', 'actual', 'diff'].reduce(function(prev, key) {
- var dir = path.join('test', key, 'map');
+ var dir = path.join(__dirname, '..', key, 'map');
mkdirp.sync(dir);
prev[key] = path.join(dir, name);
return prev;
@@ -145,13 +145,7 @@ test('Map', function(t) {
t.test('does not immediately trigger any tile loads', function(t) {
var map = new mbgl.Map({
request: function(req) {
- if (req.url === './fixtures/tiles.tilejson') {
- fs.readFile(path.join('test', req.url), function (err, data) {
- req.respond(err, {data: data});
- });
- } else {
- t.fail('unexpected request ' + req.url);
- }
+ t.fail('unexpected request ' + req.url);
},
ratio: 1
});
@@ -168,7 +162,7 @@ test('Map', function(t) {
t.test('.render', function(t) {
var options = {
request: function(req) {
- fs.readFile(path.join('test', req.url), function(err, data) {
+ fs.readFile(path.join(__dirname, '..', req.url), function(err, data) {
req.respond(err, { data: data });
});
},
diff --git a/platform/node/test/render.test.js b/platform/node/test/render.test.js
index e14f294eb2..10a7afcb52 100644
--- a/platform/node/test/render.test.js
+++ b/platform/node/test/render.test.js
@@ -3,7 +3,7 @@
/* jshint node:true */
var test = require('tape');
-var mbgl = require('..');
+var mbgl = require('../../..');
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
diff --git a/scripts/main.mk b/scripts/main.mk
index 120b13c3c7..c5319cf3d1 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -70,6 +70,7 @@ config/%.gypi: $(SUBMODULES) configure $(CONFIGURE_FILES)
#### Build files ###############################################################
GYP_FLAGS += -Dhost=$(HOST)
+GYP_FLAGS += -Iconfig/$(HOST_SLUG).gypi
GYP_FLAGS += -Dplatform_lib=$(PLATFORM)
GYP_FLAGS += -Dhttp_lib=$(HTTP)
GYP_FLAGS += -Dasset_lib=$(ASSET)
@@ -85,26 +86,25 @@ GYP_FLAGS += --generator-output=./build/$(HOST_SLUG)
Makefile/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
$(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \
- -Iconfig/$(HOST_SLUG).gypi -f make$(GYP_FLAVOR_SUFFIX)
+ -f make$(GYP_FLAVOR_SUFFIX)
.PHONY: Xcode/__project__
Xcode/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
$(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \
- -Iconfig/$(HOST_SLUG).gypi -f xcode$(GYP_FLAVOR_SUFFIX)
+ -f xcode$(GYP_FLAVOR_SUFFIX)
#### Build individual targets ##################################################
-NODE_PRE_GYP = $(shell cd platform/node > /dev/null && npm bin)/node-pre-gyp
+NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp
node/configure:
- cd platform/node && $(NODE_PRE_GYP) configure --clang -- \
- $(GYP_FLAGS) -I../../config/$(HOST_SLUG).gypi \
- -Dlibuv_ldflags= -Dlibuv_static_libs=
+ $(QUIET)$(ENV) $(NODE_PRE_GYP) configure --clang -- \
+ $(GYP_FLAGS) -Dlibuv_ldflags= -Dlibuv_static_libs=
Makefile/node: Makefile/__project__ node/configure
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target node...$(FORMAT_END)\n"
- cd platform/node && $(NODE_PRE_GYP) build --clang -- \
- -j$(JOBS)
+ $(QUIET)$(ENV) $(NODE_PRE_GYP) build --clang -- \
+ -j$(JOBS)
Makefile/%: Makefile/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n"