Skip to content

Commit

Permalink
Fix node14 compilation issues (#5918)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
alinmindroc and danpat authored Dec 19, 2020
1 parent b0a4ad9 commit 33b2a19
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 77 deletions.
68 changes: 62 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,17 @@ matrix:

- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-8"
compiler: "mason-osx-release-node-12"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="8"
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12"
after_success:
- ./scripts/travis/publish.sh

- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-14"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14"
after_success:
- ./scripts/travis/publish.sh

Expand All @@ -195,12 +203,60 @@ matrix:
# Node build jobs. These skip running the tests.
- os: linux
sudo: false
compiler: "node-8-mason-linux-release"
compiler: "node-14-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh

- os: linux
sudo: false
compiler: "node-14-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/publish.sh

- os: linux
sudo: false
compiler: "node-12-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
install:
- pushd ${OSRM_BUILD_DIR}
- |
Expand All @@ -219,12 +275,12 @@ matrix:

- os: linux
sudo: false
compiler: "node-8-mason-linux-debug"
compiler: "node-12-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="8"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
install:
- pushd ${OSRM_BUILD_DIR}
- |
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Unreleased
- Changes from 5.23.0
- Features:
- ADDED: Add node bindings support for Node 12, 14, and publish binaries [#5918](https://github.com/Project-OSRM/osrm-backend/pull/5918)
- 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)
- Misc:
- 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)
- Infrastructure
Expand Down
4 changes: 2 additions & 2 deletions include/nodejs/json_v8_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct V8Renderer
{
v8::Local<v8::Value> child;
mapbox::util::apply_visitor(V8Renderer(child), keyValue.second);
obj->Set(Nan::New(keyValue.first).ToLocalChecked(), child);
Nan::Set(obj, Nan::New(keyValue.first).ToLocalChecked(), child);
}
out = obj;
}
Expand All @@ -43,7 +43,7 @@ struct V8Renderer
{
v8::Local<v8::Value> child;
mapbox::util::apply_visitor(V8Renderer(child), array.values[i]);
a->Set(i, child);
Nan::Set(a, i, child);
}
out = a;
}
Expand Down
Loading

0 comments on commit 33b2a19

Please sign in to comment.