diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index a61341a5920..5a804692b2e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -36,7 +36,7 @@ jobs: - uses: ./.github/actions/just - name: Install uniffi-bindgen-cpp - run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 - name: Check run: just cpp check diff --git a/.github/workflows/platform.yml b/.github/workflows/platform.yml index 1ef63cb0b26..921ec319de7 100644 --- a/.github/workflows/platform.yml +++ b/.github/workflows/platform.yml @@ -105,7 +105,7 @@ jobs: - name: Install uniffi-bindgen-cpp if: needs.scope.outputs.cpp == 'true' || needs.scope.outputs.obs == 'true' shell: bash - run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 - name: Rust compile and tests if: needs.scope.outputs.rs == 'true' shell: bash @@ -151,7 +151,7 @@ jobs: secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - name: Install uniffi-bindgen-cpp if: needs.scope.outputs.obs == 'true' - run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 - name: Rust compile and tests if: needs.scope.outputs.rs == 'true' env: diff --git a/.github/workflows/release-cpp.yml b/.github/workflows/release-cpp.yml index 98b6d88d541..d64bf51b862 100644 --- a/.github/workflows/release-cpp.yml +++ b/.github/workflows/release-cpp.yml @@ -74,7 +74,7 @@ jobs: # The tag flake.nix pins; see the comment there. - name: Install uniffi-bindgen-cpp shell: bash - run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 # The package version lives in cpp/moq/VERSION; a tag that disagrees is a mistake. - name: Check version diff --git a/.github/workflows/release-shared-ffi.yml b/.github/workflows/release-shared-ffi.yml index ee699e05f3c..25dbe695f7c 100644 --- a/.github/workflows/release-shared-ffi.yml +++ b/.github/workflows/release-shared-ffi.yml @@ -91,7 +91,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - name: Install uniffi-bindgen-cpp - run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + run: cargo install uniffi-bindgen-cpp --locked --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 - name: Download default-feature input uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: diff --git a/cpp/moq/README.md b/cpp/moq/README.md index 7e7bfc04e49..6741ab9e770 100644 --- a/cpp/moq/README.md +++ b/cpp/moq/README.md @@ -1,6 +1,6 @@ # moq C++ package -C++17 bindings for [rs/moq-ffi](../../rs/moq-ffi): the sources `uniffi-bindgen-cpp` generates, plus `include/moq/moq.hpp`, a thin layer that adds the executor, shutdown, and `co_await` glue. `uniffi.toml` strips moq-ffi's `Moq` type prefix, so `MoqClient` is generated as `moq::Client`. Nothing here re-implements a method; a shape problem is fixed in moq-ffi, where every binding benefits. User docs: [doc/lib/cpp](../../doc/lib/cpp/index.md). +C++17 bindings for [rs/moq-ffi](../../rs/moq-ffi): the sources `uniffi-bindgen-cpp` generates, plus `include/moq/moq.hpp`, a thin layer that adds the executor, shutdown, and `co_await` glue. `uniffi.toml` strips moq-ffi's `Moq` type prefix and `moq_` function prefix, so `MoqClient` is generated as `moq::Client` and `moq_mint_epoch` as `moq::mint_epoch`. Nothing here re-implements a method; a shape problem is fixed in moq-ffi, where every binding benefits. User docs: [doc/lib/cpp](../../doc/lib/cpp/index.md). ## Layout @@ -14,12 +14,12 @@ C++17 bindings for [rs/moq-ffi](../../rs/moq-ffi): the sources `uniffi-bindgen-c `just cpp check` builds and installs the package, builds the probe against it with `find_package` at C++17 and C++23 and, outside Windows, with pkg-config at C++17, runs each, and compiles the doc samples (also outside Windows). It also builds the probe at C++23 over bindings at C++17, to prove the two link. The probe builds with exceptions and RTTI disabled. `just cpp check --archive FILE` runs the same consumer checks against an extracted release archive, without rebuilding the package. Release dry runs check every archive this way. -The generator is a fork, [kixelated/uniffi-bindgen-cpp](https://github.com/kixelated/uniffi-bindgen-cpp). It carries LiveKit's async support ported to uniffi 0.32, plus the `error_style = "expected"` and `strip_type_prefix` options `uniffi.toml` turns on. The dev shell provides it. Without Nix: +The generator is a fork, [kixelated/uniffi-bindgen-cpp](https://github.com/kixelated/uniffi-bindgen-cpp). It carries LiveKit's async support ported to uniffi 0.32, plus the `error_style = "expected"`, `strip_type_prefix`, and `strip_function_prefix` options `uniffi.toml` turns on. The dev shell provides it. Without Nix: ```bash cargo install uniffi-bindgen-cpp --locked \ --git https://github.com/kixelated/uniffi-bindgen-cpp \ - --tag v0.11.0-kixelated.5+v0.32.2 + --tag v0.11.0-kixelated.6+v0.32.2 ``` `flake.nix` pins the same tag and lists every other place that names it. diff --git a/cpp/moq/include/moq/moq.hpp b/cpp/moq/include/moq/moq.hpp index b29dedbc953..58dc5805260 100644 --- a/cpp/moq/include/moq/moq.hpp +++ b/cpp/moq/include/moq/moq.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #if defined(__cpp_impl_coroutine) && __has_include() #include @@ -63,38 +62,11 @@ inline void shutdown() noexcept { ::uniffi::shutdown_async_dispatcher(); } -// Sets the log level: "error", "warn", "info", "debug", "trace", or "". Errors if called twice. -inline expected log_level(const std::string &level) { - return moq_log_level(level); -} - -// The settings a default ClientConfig dials with, for a settings UI to show. Knobs whose default -// depends on the backend (GSO, path MTU discovery, congestion control, system roots) stay unset. -inline ClientConfig client_defaults() { - return moq_client_defaults(); -} - -// The protocol versions offered by default, most preferred first, as ClientConfig::versions spells them. -inline std::vector versions() { - return moq_versions(); -} - -// Whether this build can write qlog traces for QuicConfig::qlog. -inline bool qlog_supported() { - return moq_qlog_supported(); -} - -// Mints a fresh publisher epoch, ordered newest last. Announce one per run in AnnounceRoute::epoch, -// so viewers see a restart as a new broadcast instead of a stalled one. -inline std::string mint_epoch() { - return moq_mint_epoch(); -} - // The wall-clock time an epoch encodes, to the millisecond. Errors unless it is a UUIDv7. // Millisecond ticks hold every 48-bit UUIDv7 time, where system_clock's nanoseconds overflow in 2262. inline expected> epoch_time(const std::string &epoch) { - auto ms = moq_epoch_time_ms(epoch); + auto ms = epoch_time_ms(epoch); if (!ms) { return unexpected(std::move(ms).error()); } diff --git a/cpp/moq/uniffi.toml b/cpp/moq/uniffi.toml index 1f910872903..dab402d70b5 100644 --- a/cpp/moq/uniffi.toml +++ b/cpp/moq/uniffi.toml @@ -2,5 +2,6 @@ # bindings build with exceptions disabled (Unreal's default). [bindings.cpp] error_style = "expected" -# moq-ffi prefixes its types for languages without namespaces; C++ has `moq::`. +# moq-ffi prefixes its types and free functions for languages without namespaces; C++ has `moq::`. strip_type_prefix = "Moq" +strip_function_prefix = "moq_" diff --git a/flake.nix b/flake.nix index 0c254a48be7..d15ba098697 100644 --- a/flake.nix +++ b/flake.nix @@ -402,22 +402,22 @@ # # This points at a fork of LiveKit's async branch (livekit/uniffi-bindgen-cpp # PR #1): neither LiveKit nor NordSecurity has a uniffi 0.32 generator, - # and the fork adds `error_style = "expected"` and `strip_type_prefix`, - # which cpp/moq/uniffi.toml turns on. Its tags add a `-kixelated.N` - # pre-release so they never collide with upstream's. Move back upstream - # once one tags both. + # and the fork adds `error_style = "expected"`, `strip_type_prefix`, and + # `strip_function_prefix`, which cpp/moq/uniffi.toml turns on. Its tags + # add a `-kixelated.N` pre-release so they never collide with upstream's. + # Move back upstream once one tags both. uniffi-bindgen-cpp = pkgs.rustPlatform.buildRustPackage rec { pname = "uniffi-bindgen-cpp"; - version = "0.11.0-kixelated.5+v0.32.2"; + version = "0.11.0-kixelated.6+v0.32.2"; src = pkgs.fetchFromGitHub { owner = "kixelated"; repo = "uniffi-bindgen-cpp"; rev = "v${version}"; - hash = "sha256-y148irMNOsMrfjbUT/f3jlNmpxT0/z/2LVlP+t1oq8I="; + hash = "sha256-r0O/iAad2Z82KhG+6AOvqESAktaR7THQQVoR2CyP+ok="; }; - cargoHash = "sha256-QBURLIg255O6J4A+wzZVk4cUJPdJb6JepZKofX0fLZg="; + cargoHash = "sha256-0YWQF8eSUsemU0Y3jgZh7Kgtno/58zBAxPYpcBwPRuk="; # The workspace's other member is the fixture crate, which pulls the # uniffi examples in from git; build only the generator. diff --git a/quest/m1/README.md b/quest/m1/README.md index 1ed50b773a3..569c6b4de43 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -147,7 +147,6 @@ audit's receive-memory, priority, and lease bugs rank ahead of that reshape. - [JSON encoder options without a downcast](/quest/m1/json-encoder-options.md) - moq-mux's `json_snapshot` takes its `deltas` switch through a typed path any custom catalog entry can use, not an `Any` downcast - [CI housekeeping](/quest/m1/ci-housekeeping.md) - validate queue nextest at 24 threads and remove the actionlint queue ignore after its release - [Main is no slower than release](/quest/m1/release-perf/README.md) - every benchmark where main is slower than release is fixed or accepted with a reason, checked by a final paired run before the cut -- [Unprefixed C++ free functions](/quest/m1/cpp-free-function-prefix.md) - generated free functions drop `moq_`, and `moq.hpp` deletes its five pass-through wrappers before C++ first publishes - [API-diff check](/quest/m1/api-diff.md) - a recipe diffs every published package's API against its last release, run on PRs into release and against main before the cut - [API Extractor checks](/quest/m1/api-extractor-checks.md) - API Extractor fails a PR on a forgotten export, an unresolved declaration, or an undocumented export, replacing the hand-rolled `.d.ts` checkers - [Generated JS API reference](/quest/m1/js-api-reference.md) - the doc site renders an API reference for every `@moq/*` package from API Extractor's doc model diff --git a/quest/m1/cpp-free-function-prefix.md b/quest/m1/cpp-free-function-prefix.md deleted file mode 100644 index 37d17c2d1eb..00000000000 --- a/quest/m1/cpp-free-function-prefix.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] Strip moq_ from generated C++ free functions - -## Goal - -Generated C++ free functions drop moq-ffi's `moq_` prefix the way generated -types already drop `Moq` (`strip_type_prefix` in `cpp/moq/uniffi.toml`), so -`moq::log_level` is the generated function itself. `moq.hpp` -(`cpp/moq/include/moq/moq.hpp`) then deletes its five pass-through wrappers: -`log_level`, `mint_epoch`, `client_defaults`, `versions` and -`qlog_supported`. - -## Plan - -Decided with the maintainer on 2026-10-17: the goal as drafted, the follow-up -#5727 deferred. Moved to m1 on 2026-10-22 (maintainer, from an external API -audit): the C++ package is unpublished, so stripping the prefix before its -first publication avoids shipping both the `moq::moq_*` names and their -wrappers. - -The option belongs in the uniffi-bindgen-cpp fork, released and pinned the -way #5727 pinned `strip_type_prefix` (every place that PR moved the pin). -`epoch_time` stays in `moq.hpp`, since it converts milliseconds to a -`time_point`, and calls the stripped `epoch_time_ms`. Callers in `cpp/obs` and -`doc/lib/cpp` already use the short names. The C++ package is unreleased, so -no upgrade note. Public API: C++ only, `moq::moq_*` free functions are gone. - -## Related - -- [Switch to rust2's UniFFI](/quest/m2/uniffi-fork.md) - where the generator option will live once the fork moves into kixelated/rust2 diff --git a/rs/moq-ffi/build.sh b/rs/moq-ffi/build.sh index ff6e18fced1..64ef4cb71ae 100755 --- a/rs/moq-ffi/build.sh +++ b/rs/moq-ffi/build.sh @@ -192,7 +192,7 @@ generate_bindings() { # C++ uses a third-party bindgen too: a fork carrying LiveKit's async support # ported to uniffi 0.32, which upstream has not released. Install it with: - # cargo install --locked uniffi-bindgen-cpp --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.5+v0.32.2 + # cargo install --locked uniffi-bindgen-cpp --git https://github.com/kixelated/uniffi-bindgen-cpp --tag v0.11.0-kixelated.6+v0.32.2 if command -v uniffi-bindgen-cpp >/dev/null 2>&1; then echo " Generating cpp bindings..." uniffi-bindgen-cpp --library "$lib_path" \ diff --git a/test/interop/clients/cpp/main.cpp b/test/interop/clients/cpp/main.cpp index f58605b0a9d..376077846c9 100644 --- a/test/interop/clients/cpp/main.cpp +++ b/test/interop/clients/cpp/main.cpp @@ -467,7 +467,7 @@ int main(int argc, char **argv) { fail("--url and --broadcast are required"); } // Warnings and errors from the Rust layer, such as a publication outside the grant. - ok(moq::moq_log_level("warn"), "log level"); + ok(moq::log_level("warn"), "log level"); if (role == "publish") { if (tones.empty()) {