This repository has been archived by the owner on Jul 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hana): env var pointing to dbcapi
hana-client + jest need to be persuaded
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// taken straight from | ||
// https://github.com/facebook/jest/issues/7480#issuecomment-492976544 | ||
// with some minor bugfixes added | ||
|
||
const os = require('os') | ||
const path = require('path') | ||
|
||
module.exports = async () => { | ||
const extensions = { | ||
darwin: 'dylib', | ||
linux: 'so', | ||
win32: 'dll', | ||
} | ||
|
||
// Look for prebuilt binary and DBCAPI based on platform | ||
let pb_subdir = null | ||
if (process.platform === 'linux') { | ||
if (process.arch === 'x64') { | ||
pb_subdir = 'linuxx86_64-gcc48' | ||
} else if (process.arch.toLowerCase().indexOf('ppc') != -1 && os.endianness() === 'LE') { | ||
pb_subdir = 'linuxppc64le-gcc48' | ||
} else { | ||
pb_subdir = 'linuxppc64-gcc48' | ||
} | ||
} else if (process.platform === 'win32') { | ||
pb_subdir = 'ntamd64-msvc2010' | ||
} else if (process.platform === 'darwin') { | ||
pb_subdir = 'darwinintel64-xcode7' | ||
} | ||
|
||
const modpath = path.dirname(require.resolve('@sap/hana-client/README.md')) | ||
const pb_path = path.join(modpath, 'prebuilt', pb_subdir) | ||
const dbcapi = process.env['DBCAPI_API_DLL'] || path.join(pb_path, 'libdbcapiHDB.' + extensions[process.platform]) | ||
|
||
process.env['DBCAPI_API_DLL'] = dbcapi | ||
} |