Skip to content

Commit d30125b

Browse files
committed
reorganize repo folders (#74)
This is meant to reduce some of the clutter in the repo's root folder. This also allows installing the python binding from repo root, instead of specifying the path to the python binding source.
1 parent 697199a commit d30125b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+60
-55
lines changed

.github/workflows/bump_version.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def main():
115115
Updater.new_version,
116116
"--no-git-tag-version",
117117
],
118-
cwd="node-binding",
118+
cwd="bindings/node",
119119
check=True,
120120
)
121-
subprocess.run(["napi", "version"], cwd="node-binding", check=True)
122-
print("Updated version in node-binding/**package.json")
121+
subprocess.run(["napi", "version"], cwd="bindings/node", check=True)
122+
print("Updated version in bindings/node/**package.json")
123123

124124
subprocess.run(
125125
[

.github/workflows/node-js-packaging.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- cpp-linter/Cargo.toml
1515
- Cargo.toml
1616
- Cargo.lock
17-
- node-binding/**
17+
- bindings/node/**
1818
- package.json
1919
- yarn.lock
2020
- .github/workflows/node-js-packaging.yml
@@ -27,7 +27,7 @@ on:
2727
- cpp-linter/Cargo.toml
2828
- Cargo.toml
2929
- Cargo.lock
30-
- node-binding/**
30+
- bindings/node/**
3131
- package.json
3232
- yarn.lock
3333
- .github/workflows/node-js-packaging.yml
@@ -83,12 +83,12 @@ jobs:
8383
if: ${{ matrix.settings.setup }}
8484
shell: bash
8585
- name: Setup node x86
86-
working-directory: node-binding
86+
working-directory: bindings/node
8787
if: matrix.settings.target == 'i686-pc-windows-msvc'
8888
run: yarn config set supportedArchitectures.cpu "ia32"
8989
shell: bash
9090
- name: Install dependencies
91-
working-directory: node-binding
91+
working-directory: bindings/node
9292
run: yarn install
9393
- name: Setup node x86
9494
uses: actions/setup-node@v4
@@ -113,13 +113,13 @@ jobs:
113113
- name: Build
114114
run: ${{ matrix.settings.build }}
115115
if: ${{ !matrix.settings.docker }}
116-
working-directory: node-binding
116+
working-directory: bindings/node
117117
shell: bash
118118
- name: Upload artifact
119119
uses: actions/upload-artifact@v4
120120
with:
121121
name: bindings-${{ matrix.settings.target }}
122-
path: node-binding/${{ env.APP_NAME }}.*.node
122+
path: bindings/node/${{ env.APP_NAME }}.*.node
123123
if-no-files-found: error
124124
test-macOS-windows-binding:
125125
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
@@ -151,10 +151,10 @@ jobs:
151151
uses: actions/download-artifact@v4
152152
with:
153153
name: bindings-${{ matrix.settings.target }}
154-
path: node-binding
154+
path: bindings/node
155155
- name: List packages
156156
run: ls -R .
157-
working-directory: node-binding
157+
working-directory: bindings/node
158158
shell: bash
159159
- name: Test bindings
160160
run: yarn test
@@ -182,10 +182,10 @@ jobs:
182182
uses: actions/download-artifact@v4
183183
with:
184184
name: bindings-x86_64-unknown-linux-gnu
185-
path: node-binding
185+
path: bindings/node
186186
- name: List packages
187187
run: ls -R .
188-
working-directory: node-binding
188+
working-directory: bindings/node
189189
shell: bash
190190
- name: Test bindings
191191
run: >-
@@ -213,16 +213,16 @@ jobs:
213213
- name: Download all artifacts
214214
uses: actions/download-artifact@v4
215215
with:
216-
path: node-binding/artifacts
216+
path: bindings/node/artifacts
217217
- name: Move artifacts
218-
working-directory: node-binding
218+
working-directory: bindings/node
219219
run: yarn artifacts
220220
- name: List packages
221221
run: ls -R ./npm
222-
working-directory: node-binding
222+
working-directory: bindings/node
223223
shell: bash
224224
- name: Publish
225-
working-directory: node-binding
225+
working-directory: bindings/node
226226
run: |
227227
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
228228
npm publish --access public --provenance true ${{ contains(github.ref_name, '-rc') && '--tag next' || '' }}

.github/workflows/pre-commit-hooks.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@ jobs:
3939
node-version: 20
4040
cache: yarn
4141
- run: yarn install
42-
- run: yarn run eslint
43-
working-directory: node-binding
42+
- run: yarn lint

.github/workflows/python-packaging.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ on:
1717
branches: [main]
1818
paths:
1919
- cpp-linter/**.{rs,toml}
20-
- py-binding/**
20+
- bindings/python/**
2121
- Cargo.{toml,lock}
2222
- .github/workflows/python-packaging.yml
23+
- pyproject.toml
2324
tags:
2425
- '*'
2526
pull_request:
2627
branches: [main]
2728
paths:
2829
- cpp-linter/**.{rs,toml}
29-
- py-binding/**
30+
- bindings/python/**
3031
- Cargo.{toml,lock}
3132
- .github/workflows/python-packaging.yml
33+
- pyproject.toml
3234

3335
permissions:
3436
contents: read
@@ -75,7 +77,7 @@ jobs:
7577
uses: PyO3/maturin-action@v1
7678
with:
7779
target: ${{ matrix.platform.target }}
78-
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml ${{ steps.is-openssl-vendored.outputs.enabled }}
80+
args: --release --out dist --find-interpreter ${{ steps.is-openssl-vendored.outputs.enabled }}
7981
# sccache: 'true'
8082
manylinux: auto
8183
before-script-linux: |
@@ -116,7 +118,7 @@ jobs:
116118
uses: PyO3/maturin-action@v1
117119
with:
118120
target: ${{ matrix.platform.target }}
119-
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml
121+
args: --release --out dist --find-interpreter
120122
sccache: 'true'
121123
- name: Upload wheels
122124
uses: actions/upload-artifact@v4
@@ -143,7 +145,7 @@ jobs:
143145
uses: PyO3/maturin-action@v1
144146
with:
145147
target: ${{ matrix.platform.target }}
146-
args: --release --out dist --find-interpreter --manifest-path py-binding/Cargo.toml --features openssl-vendored
148+
args: --release --out dist --find-interpreter --features openssl-vendored
147149
sccache: 'true'
148150
- name: Upload wheels
149151
uses: actions/upload-artifact@v4
@@ -162,7 +164,7 @@ jobs:
162164
uses: PyO3/maturin-action@v1
163165
with:
164166
command: sdist
165-
args: --manifest-path py-binding/Cargo.toml --out dist
167+
args: --out dist
166168
- name: Upload sdist
167169
uses: actions/upload-artifact@v4
168170
with:

.github/workflows/run-dev-tests.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080

8181
- name: Install clang v7
8282
if: runner.os == 'Linux'
83-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
83+
uses: ./.github/install-clang-action
8484
with:
8585
version: '7'
8686

@@ -92,7 +92,7 @@ jobs:
9292

9393
- name: Install clang v8
9494
if: runner.os == 'Linux'
95-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
95+
uses: ./.github/install-clang-action
9696
with:
9797
version: '8'
9898

@@ -103,7 +103,7 @@ jobs:
103103
run: just test ci
104104

105105
- name: Install clang v9
106-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
106+
uses: ./.github/install-clang-action
107107
with:
108108
version: '9'
109109

@@ -113,7 +113,7 @@ jobs:
113113
run: just test ci
114114

115115
- name: Install clang v10
116-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
116+
uses: ./.github/install-clang-action
117117
with:
118118
version: '10'
119119

@@ -123,7 +123,7 @@ jobs:
123123
run: just test ci
124124

125125
- name: Install clang 11
126-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
126+
uses: ./.github/install-clang-action
127127
with:
128128
version: '11'
129129

@@ -133,7 +133,7 @@ jobs:
133133
run: just test ci
134134

135135
- name: Install clang 12
136-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
136+
uses: ./.github/install-clang-action
137137
with:
138138
version: '12'
139139

@@ -143,7 +143,7 @@ jobs:
143143
run: just test ci
144144

145145
- name: Install clang 13
146-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
146+
uses: ./.github/install-clang-action
147147
with:
148148
version: '13'
149149

@@ -153,7 +153,7 @@ jobs:
153153
run: just test ci
154154

155155
- name: Install clang 14
156-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
156+
uses: ./.github/install-clang-action
157157
with:
158158
version: '14'
159159

@@ -163,7 +163,7 @@ jobs:
163163
run: just test ci
164164

165165
- name: Install clang 15
166-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
166+
uses: ./.github/install-clang-action
167167
with:
168168
version: '15'
169169

@@ -173,7 +173,7 @@ jobs:
173173
run: just test ci
174174

175175
- name: Install clang 16
176-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
176+
uses: ./.github/install-clang-action
177177
with:
178178
version: '16'
179179

@@ -183,7 +183,7 @@ jobs:
183183
run: just test ci
184184

185185
- name: Install clang 17
186-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
186+
uses: ./.github/install-clang-action
187187
with:
188188
version: '17'
189189

@@ -193,7 +193,7 @@ jobs:
193193
run: just test ci
194194

195195
- name: Install clang 18
196-
uses: cpp-linter/cpp-linter-rs/install-clang-action@main
196+
uses: ./.github/install-clang-action
197197
with:
198198
version: '18'
199199

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: trailing-whitespace
66
exclude: cpp-linter/tests/.*\.(?:patch|diff)
77
- id: end-of-file-fixer
8-
exclude: node-binding/.*package\.json
8+
exclude: bindings/node/.*package\.json
99
- id: check-docstring-first
1010
- id: check-added-large-files
1111
args: [--maxkb=9000]

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
22

33
[workspace]
4-
members = ["cpp-linter", "py-binding", "node-binding", "docs"]
4+
members = ["cpp-linter", "bindings/python", "bindings/node", "docs"]
55
resolver = "2"
66

77
[workspace.package]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

node-binding/Cargo.toml renamed to bindings/node/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ crate-type = ["cdylib"]
1818
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
1919
napi = { version = "2.16.13", default-features = false, features = ["napi4", "async"] }
2020
napi-derive = "2.12.2"
21-
cpp-linter = { path = "../cpp-linter" }
21+
cpp-linter = { path = "../../cpp-linter" }
2222
anyhow = "1.0.93"
2323

2424
[features]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

py-binding/Cargo.toml renamed to bindings/python/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ crate-type = ["cdylib"]
1717

1818
[dependencies]
1919
pyo3 = { version = "0.23.1", features = ["extension-module"] }
20-
cpp-linter = { path = "../cpp-linter" }
20+
cpp-linter = { path = "../../cpp-linter" }
2121
tokio = "1.41.1"
2222

2323
[features]

py-binding/README.md renamed to bindings/python/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ For the description of supported Command Line Interface options, see
3030

3131
## Development
3232

33-
Build the binding with [maturin]:
33+
Build the binding with [maturin] (from repository root folder):
3434

3535
```text
36-
maturin dev --manifest-path py-binding/Cargo.toml
36+
maturin dev
3737
```
3838

3939
Then invoke the executable script as a normal CLI app:
@@ -49,7 +49,7 @@ cpp-linter -help
4949
| `cpp_linter` | The pure python sources that wrap the rust binding. Typing information is located here. |
5050
| `src` | The location for all rust sources related to binding the cpp-linter library. |
5151
| `Cargo.toml` | Metadata about the binding's rust package (which _is not_ intended to be published to crates.io). |
52-
| `pyproject.toml` | Metadata about the python package. |
52+
| `../../pyproject.toml` | Metadata about the python package (located in repo root). |
5353
| `requirements-dev.txt` | The dependencies used in development (not needed for runtime/production). |
5454

5555
Hidden files and folders are not described in the table above.
File renamed without changes.
File renamed without changes.

cpp-linter/src/run.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ fn probe_ssl_certs() {
3030
/// This is the backend entry point for console applications.
3131
///
3232
/// The idea here is that all functionality is implemented in Rust. However, passing
33-
/// command line arguments is done differently in Python or Rust.
33+
/// command line arguments is done differently in Python, node.js, or Rust.
3434
///
35-
/// - In python, the ``sys.argv`` list is passed from the ``cpp_linter.entry_point.main()``
36-
/// function to rust via the ``cpp_linter.run.main()`` binding (which wraps [`run_main()`]).
35+
/// - In python, the `sys.argv` list is passed from the `cpp_linter.main()`
36+
/// function to rust via the `cpp_linter.main()` binding (which wraps [`run_main()`]).
37+
/// - In node.js, the `process.argv` array is passed from `cli.js` module to
38+
/// rust via `index.node` module's `main()` (which wraps([`run_main()`])).
3739
/// - In rust, the [`std::env::args`] is passed to [`run_main()`] in the binary
3840
/// source `main.rs`.
3941
///

docs/docs/node.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Node.js Binding
22

33
{%
4-
include "../../node-binding/README.md"
4+
include "../../bindings/node/README.md"
55
start="<!-- start -->"
66
%}

docs/docs/python.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Python Binding
22

33
{%
4-
include "../../py-binding/README.md"
4+
include "../../bindings/python/README.md"
55
start="<!-- start -->"
66
%}

0 commit comments

Comments
 (0)