Skip to content

Commit b87e0ba

Browse files
committed
chore: bump libsession-util and use own fork for now
1 parent 44479af commit b87e0ba

File tree

10 files changed

+102
-694
lines changed

10 files changed

+102
-694
lines changed

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
.github export-ignore
33
libsession-util/external/libsodium-internal/test export-ignore
44
libsession-util/external/zstd/doc export-ignore
5+
libsession-util/external/zstd/tests export-ignore
56
libsession-util/tests export-ignore
6-
libsession-util/external/oxen-encoding/tests export-ignore
7+
libsession-util/external/nlohmann-json/tests export-ignore
8+
libsession-util/external/nlohmann-json/docs export-ignore
9+
libsession-util/external/oxen-encoding/tests export-ignore

.github/workflows/test.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: libession-util-nodejs build test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
9+
concurrency:
10+
group: ${{ github.workflow }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [windows-2022, macos-11, ubuntu-20.04]
20+
env:
21+
SIGNAL_ENV: production
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
steps:
24+
- run: git config --global core.autocrlf false
25+
26+
- name: Checkout git repo
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: 'recursive'
30+
31+
32+
- name: Install node
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version-file: '.nvmrc'
36+
37+
- uses: actions/setup-python@v4
38+
with:
39+
python-version: '3.11'
40+
41+
- name: Add msbuild to PATH
42+
uses: microsoft/[email protected]
43+
if: runner.os == 'Windows'
44+
45+
- name: Setup node for windows
46+
if: runner.os == 'Windows'
47+
shell: bash
48+
run: |
49+
yarn global add node-gyp@latest
50+
51+
52+
- name: build libsession-util-nodejs for macos
53+
if: runner.os == 'macOS'
54+
shell: bash
55+
run: |
56+
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" && yarn install --frozen-lockfile --network-timeout 600000
57+
58+
- name: build libsession-util-nodejs for others
59+
shell: bash
60+
if: runner.os != 'macOS'
61+
run: yarn install --frozen-lockfile --network-timeout 600000

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "libsession-util"]
22
path = libsession-util
3-
url = https://github.com/oxen-io/libsession-util.git
3+
url = https://github.com/Bilb/libsession-util.git

BUILDING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Building instructions
22

3-
pnpm install
3+
yarn install
44

5-
For more advanced/customized builds, you may want to invoke `pnpm cmake-js ...` directly.
5+
For more advanced/customized builds, you may want to invoke `yarn cmake-js ...` directly.

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
cmake_minimum_required(VERSION 3.19)
22
cmake_policy(SET CMP0091 NEW)
33
cmake_policy(SET CMP0042 NEW)
4+
cmake_policy(SET CMP0069 NEW)
5+
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
6+
7+
set(VERBOSE ON)
8+
49
add_definitions(-DNAPI_VERSION=8)
10+
set(CMAKE_CONFIGURATION_TYPES Release)
11+
12+
13+
514

615
project(libsession_util_nodejs LANGUAGES CXX)
716

817
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
18+
SET(CMAKE_BUILD_TYPE Release)
19+
SET(WITH_TESTS OFF)
920

1021
set(CMAKE_CXX_STANDARD 17)
1122
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -15,6 +26,7 @@ file(GLOB SOURCE_FILES src/*.cpp)
1526

1627
add_subdirectory(libsession-util)
1728

29+
1830
if(MSVC)
1931
# Windows is horrible
2032
add_compile_definitions(NOMINMAX)

Readme.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This library is the wrappers around libsession-util for NodeJS. It is built using the [node-addon-api](https://github.com/nodejs/node-addon-api) and [cmake-js](https://github.com/cmake-js/cmake-js). The build and dev instructions are quite custom, so check them out below.
44

5-
### Issue with pnpm
5+
### Issue with yarn
66

77
The yarn package manager (used on session-desktop) does understand what is a git url in a dependency as part of a package.json file, but won't do a full clone including submodules when forking such a repository. For more details, see https://github.com/yarnpkg/yarn/issues/1488
88

@@ -20,16 +20,16 @@ git clone --recursive [email protected]:oxen-io/libsession-util-nodejs.git
2020
```
2121

2222
Always do your changes in `[FOLDER_NOT_IN_SESSION_DESKTOP]/libsession-util-nodejs`, never in the one under session-desktop's `node_modules` as you might override your local changes.
23-
Then, you can quickly compile a non-electron build by running `pnpm cmake-js` from that folder. This is a quick incremental build which can check for C++ compilation errors.
23+
Then, you can quickly compile a non-electron build by running `yarn cmake-js` from that folder. This is a quick incremental build which can check for C++ compilation errors.
2424
Once your changes are ready to be tested in the `session-desktop` you can compile an electron build using this command:
2525

2626
```
27-
cd [SESSION_DESKTOP_PATH]; rm -rf node_modules/libsession_util_nodejs; cp -R [THIS_PROJECT_PATH] node_modules/libsession_util_nodejs; cd node_modules/libsession_util_nodejs && rm -rf build && pnpm install && cd [SESSION_DESKTOP_PATH] && pnpm build:workers
27+
cd [SESSION_DESKTOP_PATH]; rm -rf node_modules/libsession_util_nodejs; cp -R [THIS_PROJECT_PATH] node_modules/libsession_util_nodejs; cd node_modules/libsession_util_nodejs && rm -rf build && yarn install && cd [SESSION_DESKTOP_PATH] && yarn build:workers
2828
```
2929

3030
Replace `[SESSION_DESKTOP_PATH]` with the full path to your `session-desktop` folder, replace `[THIS_PROJECT_PATH]` with the path to the root of this project folder.
3131

32-
Every part of this command is needed and might need to be updated using your paths. Also, the `worker:libsession` needs to be recompiled too to include the just created .node file in itself. This is done by the `pnpm build:workers` command.
32+
Every part of this command is needed and might need to be updated using your paths. Also, the `worker:libsession` needs to be recompiled too to include the just created .node file in itself. This is done by the `yarn build:workers` command.
3333

3434
Note: The `electron` property in the `config` object will need to be updated in the `package.json` every time we update `electron` package in [session-desktop](https://github.com/oxen-io/session-desktop/) so that the versions match. It is a node version, but not part of the official node docs. If you compiled the node module for an incorrect electron/node version you will get an error on `session-desktop` start.
3535

@@ -51,9 +51,12 @@ git commit
5151
git push upstream main
5252
# Make sure you do the steps above, otherwise the tag won't be on the right commit with the `gh release create`
5353
54+
virtualenv venv
55+
source venv/bin/activate
5456
pip install git-archive-all
5557
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
56-
git-archive-all libsession_util_nodejs-v$PACKAGE_VERSION.tar.gz
58+
echo $PACKAGE_VERSION
59+
python3 build_release_archive.py libsession_util_nodejs-v$PACKAGE_VERSION.tar.gz
5760
gh release create v$PACKAGE_VERSION -t v$PACKAGE_VERSION --latest --generate-notes
5861
gh release upload v$PACKAGE_VERSION libsession_util_nodejs-v$PACKAGE_VERSION.tar.gz
5962
```
@@ -62,15 +65,15 @@ And then upload the generated `libsession_util_nodejs-v$PACKAGE_VERSION.tar.gz`
6265
The git-archive-all relies on the `.gitattributes` to know what to include or exclude.
6366

6467
Once this is done, update the dependency on `session-desktop`.
65-
Make sure to remove the existing one first (with the include `pnpm remove` below) as you might have messed up your `node_modules` doing the dev instructions.
68+
Make sure to remove the existing one first (with the include `yarn remove` below) as you might have messed up your `node_modules` doing the dev instructions.
6669

6770
```
68-
pnpm remove libsession_util_nodejs && pnpm add https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.15/libsession_util_nodejs-v0.1.15.tar.gz
71+
yarn remove libsession_util_nodejs && yarn add https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.15/libsession_util_nodejs-v0.1.15.tar.gz
6972
```
7073

7174
Keep in mind that you need to update the two version numbers (e.g. `0.1.15`) to the just created release version of this project.
7275

73-
The cmake-js script will be run on the pnpm add and should recompile your latest release of the `libsession-util-nodejs` as part of the build process and as part of the github actions on `session-desktop`.
74-
You most likely need to recompile the workers to include those new changes: `pnpm worker:utils && pnpm worker:libsession`.
76+
The cmake-js script will be run on the yarn add and should recompile your latest release of the `libsession-util-nodejs` as part of the build process and as part of the github actions on `session-desktop`.
77+
You most likely need to recompile the workers to include those new changes: `yarn worker:utils && yarn worker:libsession`.
7578

7679
You should have your changes in the next release!

build_release_archive.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import sys
4+
from git_archive_all import main
5+
6+
sys.exit(main())
7+

libsession-util

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
"main": "index.js",
33
"name": "libsession_util_nodejs",
44
"description": "Wrappers for the Session Util Library",
5-
"version": "0.3.5",
5+
"version": "0.3.16",
66
"license": "GPL-3.0",
77
"author": {
88
"name": "Oxen Project",
99
"email": "[email protected]"
1010
},
11-
"config": {
12-
"electron": ""
13-
},
1411
"scripts": {
15-
"preinstall": "npx only-allow pnpm",
16-
"install": "cmake-js compile --runtime=electron --runtime-version=25.8.4 -p16"
12+
"install": "cmake-js compile --runtime=electron --runtime-version=25.8.4 -p16 --CDSUBMODULE_CHECK=OFF --CDLOCAL_MIRROR=https://oxen.rocks/deps --CDENABLE_ONIONREQ=OFF"
1713
},
1814
"devDependencies": {
1915
"clang-format": "^1.8.0"

0 commit comments

Comments
 (0)