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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .github/scripts/codegen-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
#
# CI artifact — not part of the SDK.
#
# Renders the .trix/client-lib codegen plugin against the shared transfer
# Renders tx3c's built-in `rust-client` template against the shared transfer
# fixture and verifies the result:
# - the expected public surface is generated, and
# - the rendered crate compiles.
#
# The template tracks the `tx3-sdk` in this repo, which may be ahead of the
# crate published on crates.io — a PR lands the SDK and the template changes
# together, before the release. So the rendered crate is compiled against the
# in-repo `sdk/` crate via a `[patch.crates-io]` override: this verifies the
# template and the SDK in the same checkout stay consistent. The generated
# `Cargo.toml` still carries the real version requirement; only the source is
# redirected.
# The template ships inside tx3c and pins a published `tx3-sdk` range. The
# rendered crate is compiled against the in-repo `sdk/` crate via a
# `[patch.crates-io]` override, so an SDK change that would break the clients
# the current tx3c generates fails here, before the SDK is released. The
# generated `Cargo.toml` still carries the real version requirement; only the
# source is redirected.
#
# Requires `tx3c` and `cargo` on PATH.
# Requires `tx3c` (0.24.0 or later, which ships the built-in templates) and `cargo` on PATH.
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
Expand All @@ -25,7 +24,7 @@ trap 'rm -rf "$gen" "$gen_complex"' EXIT

tx3c codegen \
--tii "$repo_root/sdk/tests/fixtures/transfer.tii" \
--template "$repo_root/.trix/client-lib" \
--template rust-client \
--output "$gen"

for f in lib.rs Cargo.toml; do
Expand Down Expand Up @@ -67,8 +66,8 @@ for forbidden in \
fi
done

# Compile against the SDK in this checkout — the template may require a
# `tx3-sdk` version not yet published to crates.io.
# Compile against the SDK in this checkout, so an unreleased SDK change is
# checked against the client the current tx3c generates.
cat >> "$gen/Cargo.toml" <<EOF

[patch.crates-io]
Expand All @@ -84,7 +83,7 @@ cargo check --manifest-path "$gen/Cargo.toml"
# the two things a transfer-only check cannot see.
tx3c codegen \
--tii "$repo_root/sdk/tests/fixtures/complex.tii" \
--template "$repo_root/.trix/client-lib" \
--template rust-client \
--output "$gen_complex"

# Local component refs must survive into the generated source. A raw string
Expand Down
14 changes: 0 additions & 14 deletions .trix/client-lib/Cargo.toml.hbs

This file was deleted.

31 changes: 0 additions & 31 deletions .trix/client-lib/README.md.hbs

This file was deleted.

175 changes: 0 additions & 175 deletions .trix/client-lib/lib.rs.hbs

This file was deleted.

Loading