diff options
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | gyp/version.gypi | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | platform/node/CHANGELOG.md | 5 | ||||
-rw-r--r-- | platform/node/test/js/map.test.js | 2 | ||||
-rw-r--r-- | platform/node/test/render.test.js | 2 | ||||
-rwxr-xr-x | scripts/build-version.py | 43 | ||||
-rw-r--r-- | scripts/main.mk | 6 |
8 files changed, 50 insertions, 23 deletions
@@ -15,8 +15,15 @@ function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } function info { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } function warn { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } -# Install mason -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" +if [ -d "`pwd`/.git" ]; then + info "This build is within a git repository" + export MASON_DIR="`pwd`/.mason" + export PATH="${MASON_DIR}:${PATH}" +else + info "This build is NOT within a git repository" + which mason || abort "You must install mason to build mapbox-gl-native (https://github.com/mapbox/mason)" + export MASON_DIR="$(dirname $(readlink $(which mason)))" +fi # You can override the function for a particular set of flags by defining a # print_XXX_flags function in your dependencies.sh file diff --git a/gyp/version.gypi b/gyp/version.gypi index 1cc2eb351f..4efdd079a8 100644 --- a/gyp/version.gypi +++ b/gyp/version.gypi @@ -13,7 +13,7 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', ], - 'action': ['<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)', '<!@(git describe --tags --always --abbrev=0)', '<!@(git rev-parse HEAD)'], + 'action': ['<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)'], } ], 'direct_dependent_settings': { diff --git a/package.json b/package.json index ca0d03d50d..f6aa5d9ce0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapbox-gl-native", - "version": "2.0.0-pre.11", + "version": "2.0.0-pre.13", "description": "Renders map tiles with Mapbox GL", "keywords": [ "mapbox", diff --git a/platform/node/CHANGELOG.md b/platform/node/CHANGELOG.md index 8916efd498..d8f71fc292 100644 --- a/platform/node/CHANGELOG.md +++ b/platform/node/CHANGELOG.md @@ -14,11 +14,10 @@ render options. ([`a8d9b92`](https://github.com/mapbox/mapbox-gl-native/commit/a8d9b921d71a91d7f8eff82e5a584aaab8b7d1c6), [#1799](https://github.com/mapbox/mapbox-gl-native/pull/1799)) - `map.render` now returns a raw image buffer instead of an object with `width`, `height` and `pixels` properties. ([#2262](https://github.com/mapbox/mapbox-gl-native/pull/2262)) -- Adds support for rendering v8 styles. +- Adds support for rendering [mapbox-gl-style-spec](https://github.com/mapbox/mapbox-gl-style-spec) v8 styles. - No longer loads resources before a render request is made. ([`55d25a8`](https://github.com/mapbox/mapbox-gl-native/commit/55d25a80a77c06ef5e66acc0d8518867b03fe8a4)) -- Adds io.js v3.x support. ([#2261](https://github.com/mapbox/mapbox-gl-native/pull/2261)) +- Adds Node.js v4.x and io.js v3.x support. ([#2261](https://github.com/mapbox/mapbox-gl-native/pull/2261)) - Fixes a bug which prevented raster tiles that `404`'ed from rendering ([#2458](https://github.com/mapbox/mapbox-gl-native/pull/2458)) -- Adds Node.js v4.1.x support. - Fade transitions are now ignored to prevent half faded labels. ([#942](https://github.com/mapbox/mapbox-gl-native/pull/942)) - Adds option `pitch` ([#2702](https://github.com/mapbox/mapbox-gl-native/pull/2702)) diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index dd55df02d5..a87f4aac1a 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -1,7 +1,7 @@ 'use strict'; var test = require('tape'); -var mbgl = require('../../../..'); +var mbgl = require('../../../../lib/mapbox-gl-native'); var fs = require('fs'); var path = require('path'); var style = require('../fixtures/style.json'); diff --git a/platform/node/test/render.test.js b/platform/node/test/render.test.js index 5dd0c5ee10..4809019809 100644 --- a/platform/node/test/render.test.js +++ b/platform/node/test/render.test.js @@ -1,6 +1,6 @@ 'use strict'; -var mbgl = require('../../..'); +var mbgl = require('../../../lib/mapbox-gl-native'); var suite = require('mapbox-gl-test-suite').render; var request = require('request'); diff --git a/scripts/build-version.py b/scripts/build-version.py index 0110e6a2e1..1a01f6cd2b 100755 --- a/scripts/build-version.py +++ b/scripts/build-version.py @@ -1,22 +1,22 @@ #!/usr/bin/env python -import sys, os, errno, re +import sys, os, errno, re, subprocess +DEFAULT_TAG = [0, 0, 0] +DEFAULT_REV = 'unknown' -output_dir = sys.argv[1] +def is_git_repo(): + try: + subprocess.check_output("git rev-parse", shell=True) + return True + except subprocess.CalledProcessError as exc: + return False -if len(sys.argv) <= 3: - tag = [0, 0, 0] - rev = sys.argv[2][0:8] -else: - # When they're identical, the git describe can't find a tag and reports the rev instead. - if sys.argv[2] == sys.argv[3]: - tag = [0, 0, 0] - else: - ver = re.sub("[^0-9.]", "", sys.argv[2]) - tag = map(int, ver.split('.')) - rev = sys.argv[3][0:8] +def parse_tag(raw_tag): + return map(int, re.sub("[^0-9.]", "", raw_tag).split('.')) +def parse_rev(raw_rev): + return raw_rev[0:8] def mkdir_p(path): try: @@ -26,6 +26,22 @@ def mkdir_p(path): pass else: raise +output_dir = sys.argv[1] + +if is_git_repo(): + raw_tag = subprocess.check_output("git describe --tags --always --abbrev=0", shell=True) + raw_rev = subprocess.check_output("git rev-parse HEAD", shell=True) + + # When they're identical, the "git describe" can't find a tag and reports the rev instead. + if raw_tag == raw_rev: + tag = DEFAULT_TAG + rev = parse_rev(raw_rev) + else: + tag = parse_tag(raw_tag) + rev = parse_rev(raw_rev) +else: + tag = DEFAULT_TAG + rev = DEFAULT_REV header = """// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #ifndef MBGL_UTIL_VERSION @@ -60,4 +76,3 @@ extern const unsigned int number; header_path = os.path.join(output_dir, 'include/mbgl/util/version.hpp') mkdir_p(os.path.dirname(header_path)) with open(header_path, 'w') as f: f.write(header) - diff --git a/scripts/main.mk b/scripts/main.mk index 15e3484e01..b4a5f9894e 100644 --- a/scripts/main.mk +++ b/scripts/main.mk @@ -16,6 +16,10 @@ HOST_VERSION ?= $(BUILD_VERSION) export MASON_PLATFORM=$(HOST) export MASON_PLATFORM_VERSION=$(HOST_VERSION) +ifneq (,$(wildcard scripts/$(HOST)/$(HOST_VERSION)/configure.sh)) + CONFIGURE_FILES += scripts/$(HOST)/$(HOST_VERSION)/configure.sh +endif + HOST_SLUG = $(HOST)-$(HOST_VERSION) CONFIGURE_FILES = scripts/$(HOST)/configure.sh ifneq (,$(wildcard scripts/$(HOST)/$(HOST_VERSION)/configure.sh)) @@ -39,6 +43,7 @@ default: ; #### Dependencies ############################################################## +ifneq (,$(wildcard .git/.)) SUBMODULES += .mason/mason.sh .mason/mason.sh: ./scripts/flock.py .git/Submodule.lock git submodule update --init .mason @@ -52,6 +57,7 @@ SUBMODULES += test/ios/KIF/KIF.xcodeproj test/ios/KIF/KIF.xcodeproj: ./scripts/flock.py .git/Submodule.lock git submodule update --init test/ios/KIF endif +endif # Wildcard targets get removed after build by default, but we want to preserve the config. .PRECIOUS: config/%.gypi |