Repository navigation
Make the C# package README user-facing #1764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
35adf04
Make the C# package README user-facing
chavic 5ee1d94
Compile the README examples as samples
chavic 1449059
Rename DEVELOPMENT.md to CONTRIBUTING.md
chavic 284017a
Make the commented integration test the usage reference
chavic 3fd2ec4
Apply review clarifications to the walkthrough
chavic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # Contributing to the Payjoin C# Bindings | ||
|
|
||
| C# bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/), generated from | ||
| `payjoin-ffi` with UniFFI. This document covers building the bindings from | ||
| source, running the tests, and producing the NuGet package. For using the | ||
| published package, see [`README.md`](./README.md). | ||
|
|
||
| ## Development | ||
|
|
||
| With nix, the C# development shell provides the Rust toolchain and .NET 10 SDK: | ||
|
|
||
| ```shell | ||
| nix develop .#csharp -c bash payjoin-ffi/csharp/contrib/test.sh | ||
| ``` | ||
|
|
||
| Without nix, a Rust toolchain (MSRV: 1.85.0 for this repository) and the .NET 10 | ||
| SDK are required: | ||
|
|
||
| ```shell | ||
| git clone https://github.com/payjoin/rust-payjoin.git | ||
| cd rust-payjoin/payjoin-ffi/csharp | ||
|
|
||
| bash ./scripts/generate_bindings.sh | ||
| dotnet build Payjoin.Tests.csproj | ||
| dotnet test Payjoin.Tests.csproj | ||
| ``` | ||
|
|
||
| ### Windows | ||
|
|
||
| ```powershell | ||
| git clone https://github.com/payjoin/rust-payjoin.git | ||
| cd rust-payjoin/payjoin-ffi/csharp | ||
|
|
||
| powershell -ExecutionPolicy Bypass -File .\scripts\generate_bindings.ps1 | ||
| dotnet build Payjoin.Tests.csproj | ||
| dotnet test Payjoin.Tests.csproj | ||
| ``` | ||
|
|
||
| Generation uses the Cargo-managed C# generator pinned in `payjoin-ffi/Cargo.toml`. | ||
| By default, development generation enables `_test-utils` to keep parity with the | ||
| test suite. For production bindings, set `PAYJOIN_FFI_FEATURES` to an empty value | ||
| (bash) or pass `-ProductionBindings` (PowerShell — Windows cannot represent an | ||
| empty environment variable, so the switch is the only reliable signal there). | ||
|
|
||
| ## Packaging | ||
|
|
||
| Build the release native asset for the current host RID (production features are | ||
| the default when `PAYJOIN_FFI_FEATURES` is not set; this step does not regenerate | ||
| the C# bindings): | ||
|
|
||
| ```shell | ||
| bash ./scripts/build_nuget_native.sh | ||
| ``` | ||
|
|
||
| Any supported RID can also be cross-compiled from a Linux host, which is how CI | ||
| builds every native asset (`pip install -r scripts/cross-requirements.txt` for | ||
| the version- and hash-pinned toolchain CI uses, and `rustup target add` the | ||
| matching triple first): | ||
|
|
||
| ```shell | ||
| PAYJOIN_FFI_CROSS=1 PAYJOIN_FFI_RID=osx-arm64 bash ./scripts/build_nuget_native.sh | ||
| ``` | ||
|
|
||
| On Windows: | ||
|
|
||
| ```powershell | ||
| powershell -ExecutionPolicy Bypass -File .\scripts\build_nuget_native.ps1 | ||
| ``` | ||
|
|
||
| To pack, gather every supported RID under `artifacts/runtimes/{rid}/native/`, | ||
| generate production bindings, and run: | ||
|
|
||
| ```shell | ||
| PAYJOIN_FFI_FEATURES= PAYJOIN_FFI_PROFILE=release bash ./scripts/generate_bindings.sh | ||
| dotnet pack Payjoin.csproj --configuration Release --output artifacts/packages | ||
| ``` | ||
|
|
||
| On Windows: | ||
|
|
||
| ```powershell | ||
| $env:PAYJOIN_FFI_PROFILE = "release" | ||
| powershell -ExecutionPolicy Bypass -File .\scripts\generate_bindings.ps1 -ProductionBindings | ||
| dotnet pack Payjoin.csproj --configuration Release --output artifacts/packages | ||
| ``` | ||
|
|
||
| Validate the package in a clean sample app (`auto` derives the version from the | ||
| packed artifact; an explicit version is also accepted): | ||
|
|
||
| ```shell | ||
| bash ./scripts/smoke_nuget_package.sh artifacts/packages auto linux-x64 | ||
| ``` | ||
|
|
||
| CI performs the package build from release native assets and runs the smoke test | ||
| on each supported RID before publishing should be considered. The maintainer | ||
| release and publish workflow is documented in | ||
| [`RELEASING.md`](https://github.com/payjoin/rust-payjoin/blob/master/payjoin-ffi/csharp/RELEASING.md). |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using the name CONTRIBUTING.md since that is already a pattern in this repo:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I originally liked DEVELOPMENT.md for what this is, especially to make it distinct from policy, but it is probably better to stay consistent and then consider appling a wholesale change CONTRIBUTING -> DEVELOPMENT as a separate matter / commit / pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with all of this.
Not relevant here but another pattern that reinforces the contributing verbiage are the
contribfolders that hold the testing and linting scripts for each crate/ffi bindings.