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
16 changes: 14 additions & 2 deletions .github/workflows/release-dart-ffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: ./.github/workflows/release-ffi.yml
with:
language: dart
# The raw bindings are checked in under dart/moq_ffi, so none here.
# The package job generates the raw bindings itself: they are not checked in.
bindings: false
targets: >-
[
Expand Down Expand Up @@ -97,8 +97,15 @@ jobs:

- uses: ./.github/actions/just

- uses: ./.github/actions/nix

- uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d # v1.8.1

# dart/moq_ffi/lib/src is not in git. The package must carry the generated
# bindings, since a consumer installing from pub.dev has no generator.
- name: Generate bindings
run: nix develop --command just dart generate

- name: Stage and check package
env:
BUILD_VERSION: ${{ needs.ffi.outputs.version }}
Expand All @@ -110,7 +117,12 @@ jobs:
cd "release-out/moq_ffi-$BUILD_VERSION"
dart pub get --enforce-lockfile
dart analyze
dart pub publish --dry-run
# pipefail keeps a failed dry run failing the step, and the log stays
# outside the package directory, which is uploaded and published.
set -o pipefail
dart pub publish --dry-run 2>&1 | tee "$RUNNER_TEMP/publish.log"
grep -q -- '── moq.dart (' "$RUNNER_TEMP/publish.log"
grep -q -- '── uniffi_runtime.dart (' "$RUNNER_TEMP/publish.log"

- name: Upload pub package
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release-dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ jobs:

- uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d # v1.8.1

# The dry-run resolves moq_ffi from this checkout, whose generated
# bindings are not in git. A tag stages against the published moq_ffi.
- uses: ./.github/actions/nix
if: github.event_name != 'push'

- name: Generate bindings
if: github.event_name != 'push'
run: nix develop --command just dart generate

- name: Resolve version
id: version
env:
Expand Down
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ versions stay independent per package, including Rust: release-plz has no

`kio`, `kio-macros`, `qmux`, and npm `@moq/qmux` keep their own version lines;
`@moq/signals` joins the shared minor. New experiments start at `0.0.x`.
Dart's `moq` wrapper keeps its own 0.x version too, since Dart is
experimental: no interop client runs it and nobody has loaded it on iOS. An
interop client or a passing iOS run ends the exemption. `moq_ffi` stays on the
shared minor, as the artifact of `rs/moq-ffi`.
A published library's normal or build dependency on an experimental package
in the same ecosystem promotes that package into the shared minor, including
optional and target-specific dependencies. Dev dependencies and binary-only
Expand Down
4 changes: 4 additions & 0 deletions dart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@

# Extracted by sh/dart/check.sh.
moq/test/docs/samples.dart

# Generated by sh/dart/generate.sh (`just dart generate`), never committed.
moq_ffi/lib/src/moq.dart
moq_ffi/lib/src/uniffi_runtime.dart
31 changes: 20 additions & 11 deletions dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ This directory contains two packages:
- `moq_ffi` is the generated UniFFI layer. Its version tracks `rs/moq-ffi`.
- `moq` is the independently-versioned ergonomic API applications should use.

Dart is experimental: the API may change in any release. `moq` keeps its own
0.x version instead of the shared minor (`version.json`), until a Dart client
joins the interop suite or the iOS library has run in an iOS app.

The generated layer, `moq_ffi/lib/src/moq.dart` and `uniffi_runtime.dart`, is
not in git. `just dart generate` writes it; run that before a bare
`dart analyze` or `dart test` in a fresh checkout, and again after changing
`rs/moq-ffi` or switching revisions, since the hook rebuilds the native library
but not the bindings. `just dart check` always regenerates.

Run `just dart check` from the repository root. The check rebuilds
`moq-ffi` in the dev profile, verifies the generated source,
analyzes and tests both packages, and validates their publish layout.
`moq-ffi` in the dev profile, generates the bindings,
analyzes and tests both packages, and validates their publish layout,
including that the `moq_ffi` archive holds the generated files.

`just dart bench` pins an optimized native library through the hook's existing
`library` user define. Published packages download optimized release libraries.
Expand All @@ -25,19 +36,17 @@ WebAssembly. Browser applications should use the TypeScript packages.
Bindings use [`kixelated/uniffi-dart`](https://github.com/kixelated/uniffi-dart)
tag `v0.3.1-kixelated.7+v0.32.0`, which carries the UniFFI 0.32, library-mode CLI,
disposed-argument, and allocation-failure ownership changes. The Nix development shell supplies that exact
revision plus the `nix/uniffi-dart-*.patch` fixes. Without Nix, install it
without those fixes:

```bash
cargo install --git https://github.com/kixelated/uniffi-dart \
--tag 'v0.3.1-kixelated.7+v0.32.0' --features binary uniffi-dart
```
revision plus the `nix/uniffi-dart-*.patch` fixes, and generation needs them:
the wrapper relies on `UniffiRustFuture`, which the cancellation patch adds. Run
`just dart generate` inside `nix develop`. A plain `cargo install` of the
generator lacks the patches and produces bindings the wrapper cannot compile
against, so it is not a supported way to generate.

## Releases

The raw package follows `moq-ffi-v{{version}}` tags. Its workflow uploads one
checksum-verified native library per supported target before publishing
`moq_ffi`. The wrapper follows `moq-dart-v{{version}}` tags and publishes
checksum-verified native library per supported target, generates the bindings,
and publishes `moq_ffi` with them. The wrapper follows `moq-dart-v{{version}}` tags and publishes
`moq` independently.

Pub.dev requires the first version of each new package to be uploaded manually.
Expand Down
2 changes: 2 additions & 0 deletions dart/moq/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# moq

**Experimental:** the API may change in any release, and nobody has run it on iOS or in a Flutter application yet.

Idiomatic Dart and Flutter bindings for Media over QUIC.

```dart
Expand Down
2 changes: 2 additions & 0 deletions dart/moq_ffi/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# moq\_ffi

**Experimental:** the API may change in any release, and nobody has run it on iOS or in a Flutter application yet.

Raw Dart and Flutter bindings for the MoQ protocol stack. Most applications
should use the higher-level [`moq`](https://pub.dev/packages/moq) package.

Expand Down
Loading