This is an automated email from the ASF dual-hosted git repository.
baodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git
The following commit(s) were added to refs/heads/master by this push:
new 768e76f Fix error when falling back to local build (#302)
768e76f is described below
commit 768e76f6dc0e03f9b5aa330ffde449f67ade52a2
Author: Masahiro Sakamoto <[email protected]>
AuthorDate: Sun Mar 5 11:34:03 2023 +0900
Fix error when falling back to local build (#302)
---
.github/workflows/ci-pr-validation.yml | 65 ++++++++++++++++++++++++++++++++++
binding.gyp | 46 +++++++++++++++++-------
2 files changed, 99 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/ci-pr-validation.yml
b/.github/workflows/ci-pr-validation.yml
index c966d02..db1c8bc 100644
--- a/.github/workflows/ci-pr-validation.yml
+++ b/.github/workflows/ci-pr-validation.yml
@@ -231,3 +231,68 @@ jobs:
- name: Package Node binaries lib
run: |
npx node-pre-gyp package --target_arch=${{ env.TARGET }}
+
+ macos-napi-homebrew:
+ name: Build NAPI macos with CPP lib installed by Homebrew
+ runs-on: macos-latest
+ timeout-minutes: 3000
+ strategy:
+ fail-fast: false
+ steps:
+ - uses: actions/checkout@v3
+ - name: Use Node.js 18
+ uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: 'npm'
+ - name: Install CPP lib
+ run: |
+ brew install libpulsar
+ - name: Build Node binaries lib
+ run: |
+ npm install --ignore-scripts
+ npx node-pre-gyp configure
+ npx node-pre-gyp build
+ - name: Test loading Node binaries lib
+ run: |
+ node pkg/load_test.js
+ - name: Package Node binaries lib
+ run: |
+ npx node-pre-gyp package
+
+ linux-napi-apt:
+ name: Build NAPI linux with CPP lib installed by APT
+ runs-on: ubuntu-22.04
+ timeout-minutes: 3000
+ strategy:
+ fail-fast: false
+ steps:
+ - uses: actions/checkout@v3
+ - name: Use Node.js 18
+ uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: 'npm'
+ - name: Install CPP lib
+ run: |
+ source pulsar-client-cpp.txt
+ UNAME_ARCH=$(uname -m)
+ if [ $UNAME_ARCH == 'aarch64' ]; then
+ PLATFORM='arm64'
+ else
+ PLATFORM='x86_64'
+ fi
+ curl -s -L -O
${CPP_CLIENT_BASE_URL}/deb-${PLATFORM}/apache-pulsar-client.deb
+ curl -s -L -O
${CPP_CLIENT_BASE_URL}/deb-${PLATFORM}/apache-pulsar-client-dev.deb
+ sudo -E apt -y install ./apache-pulsar-client.deb
./apache-pulsar-client-dev.deb
+ - name: Build Node binaries lib
+ run: |
+ npm install --ignore-scripts
+ npx node-pre-gyp configure
+ npx node-pre-gyp build
+ - name: Test loading Node binaries lib
+ run: |
+ node pkg/load_test.js
+ - name: Package Node binaries lib
+ run: |
+ npx node-pre-gyp package
diff --git a/binding.gyp b/binding.gyp
index 5a412bd..a79602f 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -57,11 +57,25 @@
"dependencies": [
"<!@(node -p \"require('node-addon-api').gyp\")"
],
- "include_dirs": [
- "pkg/mac/build-pulsar/install/include"
- ],
- "libraries": [
- "../pkg/mac/build-pulsar/install/lib/libpulsarwithdeps.a"
+ "conditions": [
+ ['"<!(test -e <(module_root_dir)/pkg/mac/build-pulsar/install &&
echo true || echo false)"=="true"', {
+ "include_dirs": [
+ "<(module_root_dir)/pkg/mac/build-pulsar/install/include"
+ ],
+ "libraries": [
+
"<(module_root_dir)/pkg/mac/build-pulsar/install/lib/libpulsarwithdeps.a"
+ ]
+ }, {
+ "include_dirs": [
+ "<!(brew --prefix)/include"
+ ],
+ "library_dirs": [
+ "<!(brew --prefix)/lib"
+ ],
+ "libraries": [
+ "-lpulsar"
+ ]
+ }]
],
}],
['OS=="win"', {
@@ -75,10 +89,10 @@
},
},
"include_dirs": [
- "pkg\\windows\\pulsar-cpp\\include",
+ "<(module_root_dir)\\pkg\\windows\\pulsar-cpp\\include"
],
"libraries": [
- "..\\pkg\\windows\\pulsar-cpp\\lib\\pulsarWithDeps.lib"
+
"<(module_root_dir)\\pkg\\windows\\pulsar-cpp\\lib\\pulsarWithDeps.lib"
],
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
@@ -88,11 +102,19 @@
"dependencies": [
"<!@(node -p \"require('node-addon-api').gyp\")"
],
- "include_dirs": [
- "pkg/linux/pulsar-cpp/include"
- ],
- "libraries": [
- "../pkg/linux/pulsar-cpp/lib/libpulsarwithdeps.a"
+ "conditions": [
+ ['"<!(test -e <(module_root_dir)/pkg/linux/pulsar-cpp && echo true
|| echo false)"=="true"', {
+ "include_dirs": [
+ "<(module_root_dir)/pkg/linux/pulsar-cpp/include"
+ ],
+ "libraries": [
+
"<(module_root_dir)/pkg/linux/pulsar-cpp/lib/libpulsarwithdeps.a"
+ ]
+ }, {
+ "libraries": [
+ "-lpulsar"
+ ]
+ }]
],
}]
]