Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ jobs:
- name: Build CLI (release)
run: cargo build -p weaveffi-cli --release

- name: Generate bindings from calculator IDL
- name: Generate bindings from calculator source
shell: bash
run: |
BIN=target/release/weaveffi
[ "${{ runner.os }}" = "Windows" ] && BIN="${BIN}.exe"
"$BIN" generate samples/calculator/calculator.yml -o generated
"$BIN" generate samples/calculator/src/lib.rs -o generated

- name: Build sample producer cdylibs (debug)
run: cargo build -p calculator -p contacts -p kvstore
Expand Down Expand Up @@ -186,8 +186,8 @@ jobs:
- name: Build calculator cdylib (debug)
run: cargo build -p calculator

- name: Generate bindings from calculator IDL
run: ./target/release/weaveffi.exe generate samples/calculator/calculator.yml -o generated
- name: Generate bindings from calculator source
run: ./target/release/weaveffi.exe generate samples/calculator/src/lib.rs -o generated

- name: Verify generated bindings
shell: pwsh
Expand Down Expand Up @@ -240,8 +240,8 @@ jobs:

- name: Generate Android + C bindings for contacts
run: |
target/release/weaveffi generate samples/contacts/contacts.yml -o generated --target c
target/release/weaveffi generate samples/contacts/contacts.yml -o generated --target android
target/release/weaveffi generate samples/contacts/src/lib.rs -o generated --target c
target/release/weaveffi generate samples/contacts/src/lib.rs -o generated --target android

- name: Compile JNI shim with NDK clang
env:
Expand Down
29 changes: 14 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ cargo test -p weaveffi-ir
## Adding a new generator

Each target language is implemented as its own crate (`weaveffi-gen-<lang>`)
that implements the `Generator` trait from `weaveffi_core::codegen`. Before
starting, read the [architecture overview](docs/src/architecture.md) for the
crate dependency graph, the IDL → IR → Validate → Resolve → Generate → Output
data flow, and the snapshot-test layout new generators must hook into.
that implements the `LanguageBackend` trait from `weaveffi_core::backend`.
Before starting, read the [architecture overview](docs/src/architecture.md)
for the crate dependency graph, the Parse → Validate → Configure → Generate →
Output data flow, and the snapshot-test layout new generators must hook into.

The short version:

Expand All @@ -91,17 +91,16 @@ The short version:
associated `Config` type, then `name`, `prefix` (if the config carries a
`c_prefix`), and `files`. For a single-pass layout, override the
`render_enum`/`render_struct`/`render_function` hooks and compose
`emit_members`; otherwise build the layout directly in `files`. Add
`weaveffi_core::impl_generator_via_backend!(<Generator>);` to bridge it to
`Generator`. Reuse `BindingModel` and the shared
`weaveffi_core::codegen::common` helpers instead of re-deriving traversal
or ABI classification.
3. Wire the generator into `crates/weaveffi-cli/src/main.rs` so the
`--targets` flag accepts it.
4. Add snapshot fixtures under
`crates/weaveffi-cli/tests/snapshots.rs` covering at minimum the
`calculator`, `contacts`, `inventory`, `async_demo`, and `events` sample
IDLs.
`emit_members`; otherwise build the layout directly in `files`. Reuse
`BindingModel`, `Ty::family()`, and `Ty::wire()` instead of re-deriving
traversal or ABI classification.
3. Add one line to the `cli_targets!` registry in
`crates/weaveffi-cli/src/config.rs`; that wires the `--target` token,
the `[generators.<lang>]` table in `weaveffi.toml`, and the orchestrator
registration at once.
4. Add the target to the `snapshot_tests!` invocation in
`crates/weaveffi-cli/tests/snapshots.rs` and to the determinism test in
`tests/determinism.rs`; every fixture in the corpus then runs against it.
5. Document the generator under `docs/src/generators/<lang>.md` and link it
from `docs/src/SUMMARY.md`.

Expand Down
Loading
Loading