Skip to content

Commit 33b2a19

Browse files
alinmindrocdanpat
andauthored
Fix node14 compilation issues (#5918)
* Use Nan:: getters and setters for node 12/14 compatibility * Drop support for publishing node 8 bindings, add publishing support for node 12, 14 Co-authored-by: Daniel Patterson <[email protected]>
1 parent b0a4ad9 commit 33b2a19

File tree

4 files changed

+180
-77
lines changed

4 files changed

+180
-77
lines changed

.travis.yml

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,17 @@ matrix:
177177

178178
- os: osx
179179
osx_image: xcode9.2
180-
compiler: "mason-osx-release-node-8"
180+
compiler: "mason-osx-release-node-12"
181181
# we use the xcode provides clang and don't install our own
182-
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8"
182+
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12"
183+
after_success:
184+
- ./scripts/travis/publish.sh
185+
186+
- os: osx
187+
osx_image: xcode9.2
188+
compiler: "mason-osx-release-node-14"
189+
# we use the xcode provides clang and don't install our own
190+
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14"
183191
after_success:
184192
- ./scripts/travis/publish.sh
185193

@@ -195,12 +203,60 @@ matrix:
195203
# Node build jobs. These skip running the tests.
196204
- os: linux
197205
sudo: false
198-
compiler: "node-8-mason-linux-release"
206+
compiler: "node-14-mason-linux-release"
207+
addons:
208+
apt:
209+
sources: ['ubuntu-toolchain-r-test']
210+
packages: ['libstdc++-4.9-dev']
211+
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
212+
install:
213+
- pushd ${OSRM_BUILD_DIR}
214+
- |
215+
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
216+
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
217+
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
218+
-DENABLE_CCACHE=ON \
219+
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
220+
-DENABLE_GLIBC_WORKAROUND=ON
221+
- make --jobs=${JOBS}
222+
- popd
223+
script:
224+
- npm run nodejs-tests
225+
after_success:
226+
- ./scripts/travis/publish.sh
227+
228+
- os: linux
229+
sudo: false
230+
compiler: "node-14-mason-linux-debug"
231+
addons:
232+
apt:
233+
sources: ['ubuntu-toolchain-r-test']
234+
packages: ['libstdc++-4.9-dev']
235+
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
236+
install:
237+
- pushd ${OSRM_BUILD_DIR}
238+
- |
239+
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
240+
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
241+
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
242+
-DENABLE_CCACHE=ON \
243+
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
244+
-DENABLE_GLIBC_WORKAROUND=ON
245+
- make --jobs=${JOBS}
246+
- popd
247+
script:
248+
- npm run nodejs-tests
249+
after_success:
250+
- ./scripts/travis/publish.sh
251+
252+
- os: linux
253+
sudo: false
254+
compiler: "node-12-mason-linux-release"
199255
addons:
200256
apt:
201257
sources: ['ubuntu-toolchain-r-test']
202258
packages: ['libstdc++-4.9-dev']
203-
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
259+
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
204260
install:
205261
- pushd ${OSRM_BUILD_DIR}
206262
- |
@@ -219,12 +275,12 @@ matrix:
219275

220276
- os: linux
221277
sudo: false
222-
compiler: "node-8-mason-linux-debug"
278+
compiler: "node-12-mason-linux-debug"
223279
addons:
224280
apt:
225281
sources: ['ubuntu-toolchain-r-test']
226282
packages: ['libstdc++-4.9-dev']
227-
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
283+
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
228284
install:
229285
- pushd ${OSRM_BUILD_DIR}
230286
- |

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Unreleased
22
- Changes from 5.23.0
3+
- Features:
4+
- ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
5+
- REMOVED: we no longer publish Node 8 binary modules (they are still buildable from source) [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
36
- Misc:
47
- CHANGED: Unify `.osrm.turn_penalites_index` dump processing same with `.osrm.turn_weight_penalties` and `.osrm.turn_duration_penalties` [#5868](https://github.com/Project-OSRM/osrm-backend/pull/5868)
58
- Infrastructure

include/nodejs/json_v8_renderer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct V8Renderer
3131
{
3232
v8::Local<v8::Value> child;
3333
mapbox::util::apply_visitor(V8Renderer(child), keyValue.second);
34-
obj->Set(Nan::New(keyValue.first).ToLocalChecked(), child);
34+
Nan::Set(obj, Nan::New(keyValue.first).ToLocalChecked(), child);
3535
}
3636
out = obj;
3737
}
@@ -43,7 +43,7 @@ struct V8Renderer
4343
{
4444
v8::Local<v8::Value> child;
4545
mapbox::util::apply_visitor(V8Renderer(child), array.values[i]);
46-
a->Set(i, child);
46+
Nan::Set(a, i, child);
4747
}
4848
out = a;
4949
}

0 commit comments

Comments
 (0)