Skip to content

Commit

Permalink
Add tooling for listing unwraped API functions
Browse files Browse the repository at this point in the history
  • Loading branch information
davisp committed Mar 19, 2024
1 parent 85ee351 commit a5b0804
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tiledb/sys/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
generated.rs
generated-functions.txt
covered-functions.txt
todo.txt
15 changes: 13 additions & 2 deletions tiledb/sys/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@

# You might have to `cargo install bindgen-cli` for this to work
bindings:
all: todo

generated.rs:
bindgen \
-o generated.rs \
--allowlist-function '^tiledb_.*' \
--allowlist-var '^TILEDB_.*' \
wrapper.h \
-- -I/opt/tiledb/include

generated-functions.txt: generated.rs
rg -o --no-line-number --no-filename '\bfn\s+tiledb_[^(]+' generated.rs | sort > generated-functions.txt

covered-functions.txt:
rg -o --no-line-number --no-filename '\bfn\s+tiledb_[^(]+' src/*.rs | sort > covered-functions.txt

todo: generated-functions.txt covered-functions.txt
comm -23 generated-functions.txt covered-functions.txt > todo.txt
cat todo.txt
26 changes: 26 additions & 0 deletions tiledb/sys/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
tiledb-sys
===

This crate contains the raw wrapped function definitions that are then used
by the `tiledb/api` crate to provide a usable Rust API to TileDB. Nothing in
this crate is intended for use by anything other than `tiledb/api`.

Listing Unwrapped APIs
===

If you're looking to contribute to this repository, the easiest approach to
looking for things to wrap is to change directories into the directory
containing this file and run `make`. This will dump a list of unwrapped
functions.

Requirements
---

To generate the todo list of functions to wrap, you need to have installed
both bindgen and ripgrep. On macOS, the easiest way to acquire these
is to run the following:

```bash
$ cargo install bindgen-cli
$ brew install ripgrep
```

0 comments on commit a5b0804

Please sign in to comment.