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
26 changes: 26 additions & 0 deletions .changeset/rename_uniffi_packages_to_ffi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
livekit-ffi: minor
---

Rename the published UniFFI packages to an FFI identity.

Following the `livekit-uniffi` merge, the packages built from
`livekit-ffi/core-modules` are named after the crate that now produces them. No
compatibility aliases are published.

| | was | now |
|---|---|---|
| Swift package / product | `LiveKitUniFFI` | `LiveKitFFI` |
| Swift FFI module | `RustLiveKitUniFFI` | `RustLiveKitFFI` |
| Maven artifact | `io.livekit:livekit-uniffi-android` | `io.livekit:livekit-ffi-android` |
| Kotlin package | `io.livekit.uniffi` | `io.livekit.ffi` |
| pub.dev package | `livekit_uniffi` | `livekit_ffi` |
| UniFFI namespace | `livekit_uniffi` | `livekit_ffi` |

**Breaking for the Swift, Android and Flutter SDKs.** Imports, dependency
coordinates and the generated module names all change together.

The Swift xcframework continues to be hosted at
`livekit/livekit-uniffi-xcframework`; only the package and product names inside
it change. Versions continue from the merged crate, so no published version
goes backwards within a name.
3 changes: 2 additions & 1 deletion .github/workflows/uniffi-cdylib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ jobs:
BUILD_IMAGE: ${{ matrix.build_image }}
run: |
set -euo pipefail
export FLAGS=$(python3 .github/scripts/ffi_features.py dart)
FLAGS=$(python3 .github/scripts/ffi_features.py dart)
export FLAGS
docker run --rm -e TARGET -e FLAGS -v "$PWD:/workspace" -w /workspace "$BUILD_IMAGE" bash -euo pipefail -c '
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none
export PATH="/root/.cargo/bin:$PATH"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/uniffi-dart-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: UniFFI Dart package

# Publishes the generated livekit_uniffi Dart package to pub.dev on a
# Publishes the generated livekit_ffi Dart package to pub.dev on a
# livekit-ffi release, together with the native libraries it loads.
#
# This is a separate workflow from uniffi-packages.yml because pub.dev's
Expand Down Expand Up @@ -201,20 +201,20 @@ jobs:
# consumer, and pub.dev versions cannot be unpublished.
- name: Stage package outside the work tree
run: |
rm -rf "$RUNNER_TEMP/livekit_uniffi"
cp -R livekit-ffi/packages/dart "$RUNNER_TEMP/livekit_uniffi"
if find "$RUNNER_TEMP/livekit_uniffi" \( -name 'liblivekit_ffi.*' -o -name 'livekit_uniffi.dll' \) | grep -q .; then
rm -rf "$RUNNER_TEMP/livekit_ffi"
cp -R livekit-ffi/packages/dart "$RUNNER_TEMP/livekit_ffi"
if find "$RUNNER_TEMP/livekit_ffi" \( -name 'liblivekit_ffi.*' -o -name 'livekit_ffi.dll' \) | grep -q .; then
echo "Staged package contains a local native library; refusing to publish." >&2
exit 1
fi

- name: Validate package
working-directory: ${{ runner.temp }}/livekit_uniffi
working-directory: ${{ runner.temp }}/livekit_ffi
run: |
dart pub get
dart pub publish --dry-run

- name: Publish to pub.dev
if: ${{ env.PUBLISH_ENABLED == 'true' && !inputs.dry_run }}
working-directory: ${{ runner.temp }}/livekit_uniffi
working-directory: ${{ runner.temp }}/livekit_ffi
run: dart pub publish --force
4 changes: 2 additions & 2 deletions .github/workflows/uniffi-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ env:
CARGO_TERM_COLOR: always
HOSTING_REPO: livekit/livekit-uniffi-xcframework
# SPM_NAME must match the value in livekit-ffi/Makefile.toml [env].
SPM_NAME: LiveKitUniFFI
OUTPUT_DIR: livekit-ffi/packages/swift/LiveKitUniFFI
SPM_NAME: LiveKitFFI
OUTPUT_DIR: livekit-ffi/packages/swift/LiveKitFFI

jobs:
build-and-publish:
Expand Down
12 changes: 6 additions & 6 deletions livekit-ffi/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ PACKAGES_DIR = "./packages"
SUPPORT_DIR = "./support"
LIB_NAME = "lib${CARGO_MAKE_CRATE_FS_NAME}"
TARGET_DIR = "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}"
SPM_NAME = "LiveKitUniFFI"
DART_PACKAGE_NAME = "livekit_uniffi"
SPM_NAME = "LiveKitFFI"
DART_PACKAGE_NAME = "livekit_ffi"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 First Dart release cannot publish

When a release first publishes livekit_ffi, the automated pub.dev publish fails. The manual first publish and automated-publishing settings for livekit_uniffi do not carry over to the new package.

Learn more

The package name in the generated pubspec comes from DART_PACKAGE_NAME via the pubspec template. The release job immediately runs dart pub publish --force for that name. pub.dev's initial manual publish and automated publishing configuration belong to an individual package identity; the workflow's bootstrap note describes the old package, not the new one. Without a manual first version and new automated publishing setup, the first tag-push publication cannot succeed.

Example: A tag for version 0.12.83 generates name: livekit_ffi. The release job authenticates through OIDC and tries to publish that package, but pub.dev has only been set up to automate livekit_uniffi; the new package is not published.

Recommended fix: Bootstrap livekit_ffi with a manual first publication, configure its own pub.dev automated publishing for livekit-ffi/v{{version}}, and update the workflow's bootstrap instructions before enabling the new package's automated release.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hiroshihorie Do you think it's worth creating a new pub.dev package called livekit_ffi here, or should I keep the package name in this one spot livekit_uniffi?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to create a new one 🙂

# Rendered into pubspec.yaml by dart-generate-manifest. Fail closed: every
# profile gets `publish_to: none` (dev packages embed a host dylib and must
# never reach pub.dev), and only an explicit release build clears it so
Expand Down Expand Up @@ -80,7 +80,7 @@ private = true

[tasks.android-shared.env]
ANDROID_CARGO_OUT_DIR = { source = "${CARGO_MAKE_PROFILE}", mapping = { development = "debug", release = "release", default = "debug" } }
ANDROID_AAR_BASENAME = "livekit-uniffi-android-release"
ANDROID_AAR_BASENAME = "livekit-ffi-android-release"

[tasks.build-android]
extend = "android-shared"
Expand Down Expand Up @@ -478,7 +478,7 @@ run_task = "swift-package-flow"

# MARK: - Android
#
# Output: ${PACKAGES_DIR}/android/livekit-uniffi-android-release.aar
# Output: ${PACKAGES_DIR}/android/livekit-ffi-android-release.aar
#
# Debugging: cargo make android-package
# → debug .so files packaged into the release AAR (unstripped Rust
Expand Down Expand Up @@ -649,10 +649,10 @@ exec cargo run -p bindgens --features dart-bindgen --bin uniffi-bindgen-dart --
#
# packages/dart/
# pubspec.yaml (from support/dart/pubspec.yaml.tera)
# lib/livekit_uniffi.dart
# lib/livekit_ffi.dart
# hook/build.dart (from support/dart/hook/build.dart)
# LICENSE, README.md, CHANGELOG.md
# liblivekit_uniffi.<ext> (dev only: copied local build)
# liblivekit_ffi.<ext> (dev only: copied local build)
#
# Publishing note: pub builds its archive from git's file listing and this
# whole tree is gitignored, so `dart pub publish` must run from a copy of
Expand Down
4 changes: 2 additions & 2 deletions livekit-ffi/src/core_modules/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ pub(crate) fn runtime() -> &'static Runtime {
RUNTIME.get_or_init(|| {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.thread_name("livekit-uniffi")
.thread_name("livekit-ffi-core")
.build()
.expect("Failed to build livekit-uniffi tokio runtime")
.expect("Failed to build livekit-ffi core-modules tokio runtime")
})
}
2 changes: 1 addition & 1 deletion livekit-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ pub mod build_info;
#[cfg(feature = "room-apis")]
uniffi::setup_scaffolding!("livekit_ffi");
#[cfg(feature = "core-modules")]
uniffi::setup_scaffolding!("livekit_uniffi");
uniffi::setup_scaffolding!("livekit_ffi");
10 changes: 5 additions & 5 deletions livekit-ffi/support/android/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LiveKit FFI — Android library

Gradle Android library module that packages UniFFI Kotlin bindings and native `liblivekit_uniffi.so` binaries into an **AAR**.
Gradle Android library module that packages UniFFI Kotlin bindings and native `liblivekit_ffi.so` binaries into an **AAR**.

## Prerequisites

Expand All @@ -16,7 +16,7 @@ cargo make android-package # debug .so in release A
cargo make --profile release android-package # release .so (CI / publishing)
```

The built AAR is located at: `packages/android/livekit-uniffi-android-release.aar`
The built AAR is located at: `packages/android/livekit-ffi-android-release.aar`

In the default (development) profile, Rust builds are unoptimized debug artifacts;
`--profile release` additionally applies release Rust flags and runs the size gate.
Expand Down Expand Up @@ -51,14 +51,14 @@ Or from this directory:
Output:

```
build/outputs/aar/livekit-uniffi-android-release.aar
build/outputs/aar/livekit-ffi-android-release.aar
```

## App integration

```kotlin
dependencies {
implementation("io.livekit:livekit-uniffi-android:x.y.z")
implementation("io.livekit:livekit-ffi-android:x.y.z")
}
```

Expand All @@ -85,7 +85,7 @@ Depend on the artifact as above, using the `VERSION_NAME` in this module's `grad

```kotlin
dependencies {
implementation("io.livekit:livekit-uniffi-android:0.0.1")
implementation("io.livekit:livekit-ffi-android:0.0.1")
}
```

Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/support/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ version = providers.gradleProperty("VERSION_NAME").get()
val generatedKotlinDir = rootDir.resolve("../../packages/kotlin")

android {
namespace = "io.livekit.uniffi"
namespace = "io.livekit.ffi"
compileSdk = 34

defaultConfig {
Expand Down
10 changes: 5 additions & 5 deletions livekit-ffi/support/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ android.nonTransitiveRClass=true
GROUP=io.livekit
VERSION_NAME=0.0.1

POM_NAME=LiveKit UniFFI for Android
POM_DESCRIPTION=UniFFI bindings for LiveKit Android SDK
POM_ARTIFACT_ID=livekit-uniffi-android
POM_NAME=LiveKit FFI for Android
POM_DESCRIPTION=UniFFI bindings for the LiveKit Android SDK
POM_ARTIFACT_ID=livekit-ffi-android
POM_PACKAGING=aar

POM_URL=https://github.com/livekit/rust-sdks/tree/main/livekit-uniffi
POM_SCM_URL=https://github.com/livekit/rust-sdks/tree/main/livekit-uniffi
POM_URL=https://github.com/livekit/rust-sdks/tree/main/livekit-ffi
POM_SCM_URL=https://github.com/livekit/rust-sdks/tree/main/livekit-ffi
POM_SCM_CONNECTION=scm:git:git://github.com/livekit/rust-sdks.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/livekit/rust-sdks.git

Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/support/android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ dependencyResolutionManagement {
}
}

rootProject.name = "livekit-uniffi-android"
rootProject.name = "livekit-ffi-android"
10 changes: 5 additions & 5 deletions livekit-ffi/support/dart/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# livekit_uniffi
# livekit_ffi

Dart bindings for the LiveKit Rust SDK core, generated from the
[`livekit-uniffi`](https://github.com/livekit/rust-sdks/tree/main/livekit-uniffi)
[`livekit-ffi`](https://github.com/livekit/rust-sdks/tree/main/livekit-ffi)
crate with [UniFFI](https://mozilla.github.io/uniffi-rs/) and
[uniffi-dart](https://github.com/Uniffi-Dart/uniffi-dart).

Expand All @@ -14,7 +14,7 @@ intended to be used directly in applications.
The bindings call into a prebuilt Rust dynamic library through Dart's
[Native Assets](https://dart.dev/tools/hooks). The package's `hook/build.dart`
resolves the library for your target platform at build time, downloading it
from the matching [`livekit-uniffi` release](https://github.com/livekit/rust-sdks/releases)
from the matching [`livekit-ffi` release](https://github.com/livekit/rust-sdks/releases)
and verifying its SHA-256 checksum. No Rust toolchain is required to consume
this package.

Expand All @@ -31,10 +31,10 @@ Linux (arm64, x64), and Windows (arm64, x64).
This package is generated; do not edit it directly. To build it from source:

```sh
cd rust-sdks/livekit-uniffi
cd rust-sdks/livekit-ffi
cargo make dart-package # generates packages/dart with a locally built library
```

See the [crate README](https://github.com/livekit/rust-sdks/tree/main/livekit-uniffi)
See the [crate README](https://github.com/livekit/rust-sdks/tree/main/livekit-ffi)
for details. Issues and pull requests go to
[livekit/rust-sdks](https://github.com/livekit/rust-sdks).
2 changes: 1 addition & 1 deletion livekit-ffi/support/dart/hook/build.dart.tera
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Native Assets build hook for the LiveKit UniFFI Dart bindings.
// Native Assets build hook for the LiveKit FFI Dart bindings.
//
// The generated bindings call the native library through `@Native` annotations
// bound to the asset id `package:<pkg>/uniffi:livekit_ffi`. This hook
Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/support/dart/test/access_token_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:livekit_uniffi/livekit_uniffi.dart';
import 'package:livekit_ffi/livekit_ffi.dart';

void main() {
// Exercises real Rust JWT/HMAC logic across the FFI boundary: generate a
Expand Down
2 changes: 1 addition & 1 deletion livekit-ffi/support/dart/test/build_version_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:livekit_uniffi/livekit_uniffi.dart';
import 'package:livekit_ffi/livekit_ffi.dart';

void main() {
// Smoke test for the whole FFI path: the build hook resolves the native
Expand Down
Loading
Loading