Skip to content

Commit 3099ab5

Browse files
authored
Merge pull request #24 from Nic-dorman/feat/dart-bindings
feat: dart bindings
2 parents 026b050 + 262c45f commit 3099ab5

File tree

93 files changed

+20729
-0
lines changed

Some content is hidden

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

93 files changed

+20729
-0
lines changed

.github/workflows/dart.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Dart CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}-dart-build
14+
cancel-in-progress: true
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Dart
20+
uses: dart-lang/setup-dart@v1
21+
with:
22+
sdk: '3.2.0'
23+
24+
- name: Setup Rust toolchain
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Cache Cargo dependencies
28+
uses: Swatinem/rust-cache@v2
29+
with:
30+
workspaces: rust
31+
32+
- name: Build Rust FFI library
33+
run: cargo build --release
34+
working-directory: rust
35+
36+
- name: Generate C header
37+
run: |
38+
cargo run -p uniffi-bindgen-swift -- \
39+
--headers \
40+
target/release/libant_ffi.so \
41+
../dart/c_header \
42+
--module-name ant_ffiFFI
43+
working-directory: rust
44+
45+
- name: Install Dart dependencies
46+
run: dart pub get
47+
working-directory: dart/ant_ffi
48+
49+
- name: Generate FFI bindings
50+
run: dart run ffigen
51+
working-directory: dart/ant_ffi
52+
53+
- name: Analyze Dart code
54+
run: dart analyze
55+
working-directory: dart/ant_ffi
56+
57+
- name: Run tests
58+
run: dart test
59+
working-directory: dart/ant_ffi
60+
env:
61+
LD_LIBRARY_PATH: ${{ github.workspace }}/rust/target/release

.github/workflows/lua.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Lua CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}-lua-build
14+
cancel-in-progress: true
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup LuaJIT
20+
uses: leafo/gh-actions-lua@v10
21+
with:
22+
luaVersion: "luajit-2.1"
23+
24+
- name: Setup Rust toolchain
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Cache Cargo dependencies
28+
uses: Swatinem/rust-cache@v2
29+
with:
30+
workspaces: |
31+
rust
32+
lua/async_helper
33+
34+
- name: Build Rust FFI library
35+
run: cargo build --release
36+
working-directory: rust
37+
38+
- name: Build async_helper library
39+
run: cargo build --release
40+
working-directory: lua/async_helper
41+
42+
- name: Copy libraries to lua/ant_ffi
43+
run: |
44+
cp rust/target/release/libant_ffi.so lua/ant_ffi/
45+
cp lua/async_helper/target/release/libasync_helper.so lua/ant_ffi/
46+
ls -la lua/ant_ffi/
47+
48+
- name: Run self-encryption tests
49+
run: luajit test/test_self_encryption.lua
50+
working-directory: lua
51+
env:
52+
LD_LIBRARY_PATH: ${{ github.workspace }}/lua/ant_ffi
53+
54+
- name: Run key tests
55+
run: luajit test/test_keys.lua
56+
working-directory: lua
57+
env:
58+
LD_LIBRARY_PATH: ${{ github.workspace }}/lua/ant_ffi
59+
60+
- name: Run data type tests
61+
run: luajit test/test_data.lua
62+
working-directory: lua
63+
env:
64+
LD_LIBRARY_PATH: ${{ github.workspace }}/lua/ant_ffi
65+
66+
- name: Run all types tests
67+
run: luajit test/test_all_types.lua
68+
working-directory: lua
69+
env:
70+
LD_LIBRARY_PATH: ${{ github.workspace }}/lua/ant_ffi
71+
72+
- name: Run async helper tests
73+
run: luajit test/test_async_helper.lua
74+
working-directory: lua
75+
env:
76+
LD_LIBRARY_PATH: ${{ github.workspace }}/lua/ant_ffi

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ xcuserdata/
7979
# macOS Ignores
8080
.DS_Store
8181

82+
# Claude Code local settings
83+
.claude/
84+
8285
# Android (cargo-ndk outputs; they end up in the Android source tree)
8386
*.so
8487

@@ -88,3 +91,18 @@ xcuserdata/
8891
**/TestResults/
8992
*.user
9093
*.suo
94+
95+
# Lua FFI bindings
96+
lua/ant_ffi/*.dll
97+
lua/ant_ffi/*.so
98+
lua/ant_ffi/*.dylib
99+
lua/async_helper/target/
100+
101+
# Dart FFI bindings
102+
dart/ant_ffi/.dart_tool/
103+
dart/ant_ffi/.packages
104+
dart/ant_ffi/pubspec.lock
105+
dart/ant_ffi/*.dll
106+
dart/ant_ffi/*.so
107+
dart/ant_ffi/*.dylib
108+
dart/c_header/

0 commit comments

Comments
 (0)