Skip to content

Commit

Permalink
feat: use ZooKeeper C Client v3.8.2 (#330)
Browse files Browse the repository at this point in the history
* wip: use zookeeper-c-client v3.8.2

* fix: eslint import order

* fix(ci): skip CMake on CI

* Add prebuild for Windows and C Client v3.8.2

* fix(windows): build with extra CMAKE flags

* fix(windows): apply patches is still needed

* remove unused client version env

* fix(patch): not needed

* feat(mac os x): add prebuild for node 18 and C Client v3.8.2

* docs(prebuildify): update node version

* feat(mac os x M1): add prebuild for node 18 and C Client v3.8.2

* bump version to 6.0.0

* docs: add changelog
  • Loading branch information
DavidVujic authored Aug 7, 2023
1 parent 58382fd commit 838b2e4
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 30 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
run-on-windows:
executor: win/default
steps:
- run: choco install cmake -y --installargs 'ADD_CMAKE_TO_PATH=System'
- checkout
- nvminstall
- deps
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### v 6.0.0 (2023-08-07)
* feat: use ZooKeeper C Client v3.8.2 and add prebuilds for Node.js v.18 (Mac OS X intel and M1, and Windows)

Drop support for Node.js 16 prebuilds.

Pull request [330](https://github.com/yfinkelstein/node-zookeeper/pull/330) by @davidvujic

#### v 5.6.0 (2022-11-03)
* feat: add prebuilds for Node.js v.18 (Mac OS X intel and M1, and Windows)

Expand Down
11 changes: 6 additions & 5 deletions deps/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
### Developer: updating the ZooKeeper Client C source code

This guide is extracted from the [official docs](https://github.com/apache/zookeeper/blob/master/zookeeper-client/zookeeper-client-c/README)
and the as of today unresolved issue about outdated docs: https://issues.apache.org/jira/browse/ZOOKEEPER-4621

1 Download the source code
2 Navigate to the `zookeeper-jute` folder and run `mvn compile`
3 Navigate to the zookeeper-client-c folder: run autoreconf -if
4 compress the entire zookeeper-client-c folder and name it `zookeeper-client-c.tar.gz`
1. Download the source code
2. Navigate to the `zookeeper-jute` folder and run `mvn compile`
3. Navigate to the zookeeper-client-c folder: run autoreconf -if
4. compress the entire zookeeper-client-c folder and name it `zookeeper-client-c.tar.gz`
* On Mac OS X: `COPYFILE_DISABLE=1 tar -czvf zookeeper-client-c.tar.gz zookeeper-client-c`
5 replace the existing compressed file in the deps folder
5. replace the existing compressed file in the deps folder
9 changes: 0 additions & 9 deletions deps/no-fipsmode.patch

This file was deleted.

Binary file modified deps/zookeeper-client-c.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/zookeeper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// needed to not break the interface
/* eslint-disable camelcase */
const { apply, waterfall } = require('async');
const util = require('util');
const { EventEmitter } = require('events');
const { join, posix } = require('path');
const util = require('util');
const { apply, waterfall } = require('async');
const NativeZk = require('node-gyp-build')(join(__dirname, '..')).ZooKeeper;
const { isString, isFunction } = require('./helper');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zookeeper",
"description": "apache zookeeper client (zookeeper async API v3.5.x - v3.8.x)",
"version": "5.6.0",
"version": "6.0.0",
"author": "Yuri Finkelstein <[email protected]>",
"license": "MIT",
"contributors": [
Expand Down
6 changes: 3 additions & 3 deletions prebuilds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Each platform has prebuilds for Node.js 12 and 14.
Create prebuilds for Mac OS X:

```bash
npx prebuildify --arch x64 --platform darwin --target 16.17.0
npx prebuildify --arch x64 --platform darwin --target 18.17.0
```

Prebuilds for Mac OS X with the M1 processor:
```bash
npx prebuildify --arch arm64 --platform darwin --target 16.17.0
npx prebuildify --arch arm64 --platform darwin --target 18.17.0
```

Create prebuilds for Windows 10:

```bash
npx prebuildify --arch x64 --platform win32 --target 16.17.0
npx prebuildify --arch x64 --platform win32 --target 18.17.0
```
Binary file modified prebuilds/darwin-arm64/node.abi108.node
Binary file not shown.
Binary file removed prebuilds/darwin-arm64/node.abi93.node
Binary file not shown.
Binary file modified prebuilds/darwin-x64/node.abi108.node
Binary file not shown.
Binary file removed prebuilds/darwin-x64/node.abi93.node
Binary file not shown.
Binary file modified prebuilds/win32-x64/node.abi108.node
Binary file not shown.
Binary file removed prebuilds/win32-x64/node.abi93.node
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ shell.cd(`${env.sourceFolder}`);

if (env.isWindows) {
const output = env.isVerbose ? '' : ' > NUL';
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .${output}`);
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .${output} -DWITH_OPENSSL=OFF -DWITH_CYRUS_SASL=OFF`);
exec(`cmake --build .${output}`);
} else {
const flags = '-w';
Expand Down
2 changes: 0 additions & 2 deletions scripts/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ function checkIfAlreadyBuilt(env) {
const isWindows = process.platform.toLowerCase().includes('win32');
const rootFolder = setRoot({ isWindows });

const zookeeperVersion = '3.5.8';
const downloadedFolderName = 'zookeeper-client-c';
const downloadedFileName = 'zookeeper-client-c.tar.gz';

const variables = {
rootFolder,
workFolder: `${rootFolder}/deps`,
buildFolder: `${rootFolder}/build/zk`,
zookeeperVersion,
downloadedFolderName,
sourceFolder: `${rootFolder}/deps/zookeeper-client-c`,
downloadedFileName,
Expand Down
4 changes: 0 additions & 4 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ function applyPatches() {
shell.sed('-i', '#include "zookeeper_log.h"', '#include "zookeeper_log.h"\n#include "winport.h"\n', `${destination}/zk_log.c`);
shell.sed('-i', '#include "zookeeper.h"', '#include "winport.h"\n#include "zookeeper.h"\n', `${destination}/zk_adaptor.h`);
shell.sed('-i', '#include "zk_adaptor.h"', '#include "zk_adaptor.h"\n#include "winport.h"\n', `${destination}/zookeeper.c`);
shell.sed('-i', /(FIPS_mode\(\) == 0)/, '0 == 0', `${destination}/zookeeper.c`);
shell.sed('-i', /(FIPS mode is OFF)/, 'Disabled the FIPS check', `${destination}/zookeeper.c`);
} else {
shell.exec(`patch -d ${env.rootFolder} -p0 --forward < ${env.workFolder}/no-fipsmode.patch`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/zookeeper/exportedconstantstest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require('ava');
const { join } = require('path');
const test = require('ava');
const NativeZk = require('node-gyp-build')(join(__dirname, '../../../')).ZooKeeper;
const constants = require('../../../lib/constants');
const ZooKeeper = require('../../../lib/zookeeper');
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/zookeeper/nativeobjecttest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require('ava');
const { join } = require('path');
const test = require('ava');
const NativeZk = require('node-gyp-build')(join(__dirname, '../../../')).ZooKeeper;
const ZooKeeper = require('../../../lib/zookeeper');

Expand Down

0 comments on commit 838b2e4

Please sign in to comment.