Skip to content

Commit b39e528

Browse files
committed
Select napi-rs CLI by kernel major
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
1 parent f0d1862 commit b39e528

6 files changed

Lines changed: 1175 additions & 1566 deletions

File tree

KERNEL_REV

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0ecc09c9d0075c630df2adce1a6414051a16cc9e
1+
0d46716c466897148dfc1d2976ff03bdf097998c

bin/build-native.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
driver_repo=$(pwd)
6+
kernel_repo=${DATABRICKS_SQL_KERNEL_REPO:-../../databricks-sql-kernel}
7+
napi_dir="${kernel_repo}/napi"
8+
napi_major=$(sed -nE 's/^napi = \{ version = "([0-9]+).*/\1/p' "${napi_dir}/Cargo.toml")
9+
10+
# napi-rs v2 and v3 derive macros expect different CLI environment variables.
11+
case "${napi_major}" in
12+
2)
13+
cli=(npx --yes @napi-rs/cli@2.18.4)
14+
;;
15+
3)
16+
cli=(npx --yes --package @napi-rs/cli@3.8.2 napi)
17+
;;
18+
*)
19+
echo "Unsupported napi-rs major version: ${napi_major:-unknown}" >&2
20+
exit 1
21+
;;
22+
esac
23+
24+
cd "${napi_dir}"
25+
"${cli[@]}" build --platform "${BUILD_PROFILE:---release}"
26+
cp index.* "${driver_repo}/native/kernel/"

0 commit comments

Comments
 (0)