Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
497 changes: 431 additions & 66 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ lto = "thin"
[workspace]
resolver = "2"
members = [
"examples/rust",
"libs/gl-client",
"libs/gl-client-py",
"libs/gl-plugin",
"libs/gl-signerproxy",
"libs/gl-cli",
"libs/gl-util",
"examples/rust",
"libs/gl-client",
"libs/gl-client-py",
"libs/gl-plugin",
"libs/gl-signerproxy",
"libs/gl-cli",
"libs/gl-util",
"libs/gl-bindings",
]

[workspace.dependencies]
Expand Down
7 changes: 7 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ includes:
taskfile: "libs/gl-signerproxy/.tasks.yml"
dir: "."

bindings:
taskfile: "libs/gl-bindings/Taskfile.yml"

msggen:
taskfile: "libs/gl-msggen/.taskfile.yml"
dir: "libs/gl-msggen/"

tasks:
ci-check:
deps:
Expand Down
1 change: 1 addition & 0 deletions libs/gl-bindings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python
14 changes: 14 additions & 0 deletions libs/gl-bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "gl-bindings"
version = "0.1.0"
edition = "2021"

[dependencies]
uniffi = "0.28.3"

[build-dependencies]
uniffi = { version = "0.28.3", features = ["build"] }

[lib]
crate-type = ["cdylib"]
name = "glbindings"
13 changes: 13 additions & 0 deletions libs/gl-bindings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `gl-bindings`

Automatically generated bindings for a variety of programming
languages. These use `uniffi` to give host languages access to the
Rust core, which includes the authentication and client-side logic.

## Building

To compile from the repository root:

```bash
task bindings:all
```
39 changes: 39 additions & 0 deletions libs/gl-bindings/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '3'

env:
CARGO_TARGET_DIR: /tmp/target
GL_BINDING_LIB: $CARGO_TARGET_DIR/release/libglbindings.so
BINDGEN_BIN:

tasks:
bindgen:
dir: '.'
cmds:
- cargo build --release

build:
dir: '.'
deps:
- build-python

build-python:
cmds:
- task: bindgen
- pwd
- cd ../tools/uniffi-bindgen/; cargo build --release
- mkdir -p python/glclient
- cp "$CARGO_TARGET_DIR/release/libglbindings.so" python/glclient
# Run the `uniffi-bindgen` with `uv` so it has access to `yapf`
# and other tooling that is managed by `uv`
- uv run $CARGO_TARGET_DIR/release/uniffi-bindgen generate --language python --out-dir python/glclient --library "python/glclient/libglbindings.so"
- echo 'from .glclient import *' > python/glclient/__init__.py

test-python:
deps:
- build-python
cmds:
- PYTHONPATH=python python3 -c 'import glclient;n=glclient.Node();print(n);'

all:
deps:
- test-python
3 changes: 3 additions & 0 deletions libs/gl-bindings/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
uniffi::generate_scaffolding("src/glclient.udl").unwrap();
}
Loading
Loading