Skip to content

chore(uniffi): Fully switch to uniffi proc macros#370

Open
Stackmator (stackmator) wants to merge 11 commits intomasterfrom
uniffi-proc-macros
Open

chore(uniffi): Fully switch to uniffi proc macros#370
Stackmator (stackmator) wants to merge 11 commits intomasterfrom
uniffi-proc-macros

Conversation

@stackmator
Copy link
Copy Markdown

@stackmator Stackmator (stackmator) commented Jan 8, 2026

Summary

  • Bump UniFFI to 0.31.1 and fully switch to the proc-macro workflow: drop build.rs scaffolding, the UDL file, and the in-tree uniffi-builder-macro.
  • Bindings are generated from a single namespace (devolutions_crypto_uniffi). The core devolutions-crypto crate stays free of any UniFFI dep, feature, or derive; shared types (version enums, Error) are re-exposed in the wrapper crate via #[uniffi::remote(...)].

Test plan

  • cargo check --workspace and cargo clippy --workspace clean
  • wrappers/wasm/wasm_build.sh produces the four wasm-pack targets (bundler/nodejs/web/no-modules)
  • wrappers/swift/generate.sh emits devolutions_crypto_uniffi.swift + matching .h/.modulemap, and swift test passes on macOS
  • Kotlin ./gradlew :lib:test passes
  • Python wheel build still succeeds (pyo3 path untouched)

@stackmator Stackmator (stackmator) force-pushed the uniffi-proc-macros branch 3 times, most recently from f0fb75a to 96d21a8 Compare January 12, 2026 16:11
@mmorrissette-devolutions

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@mmorrissette-devolutions

This comment was marked as resolved.

@chatgpt-codex-connector

This comment was marked as resolved.

1 similar comment
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

@mmorrissette-devolutions mmorrissette-devolutions marked this pull request as ready for review April 23, 2026 13:29
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@mmorrissette-devolutions
Copy link
Copy Markdown

Codex (@codex) review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Mathieu Morrissette and others added 11 commits April 24, 2026 11:15
Hardcoded fallbacks diverged from defaults::ITERATIONS=2 (was 3),
which would silently change derived keys for callers relying on
builder defaults. Route all fallbacks through argon2parameters_defaults
so bindings stay in sync with the core crate.
The autogenerated DevolutionsCryptoSwift.swift was removed, leaving the
directory untracked. generate.sh copies the freshly generated bindings
into Sources/DevolutionsCryptoSwift/ and Package.swift references that
path as the target source — both break when the directory is absent
after checkout.
The previous setup had two scaffolding calls — one in the core crate
(emitting devolutions_crypto.*) and one in the wrapper crate (emitting
devolutions_crypto_uniffi.*). Swift generate.sh only copied the former,
silently dropping all wrapper Object types (Argon2Parameters, Ciphertext,
SigningKeyPair, ...) from the Swift package.

Revert all uniffi derives and scaffolding from the core crate, then
re-declare the shared enums and Error in the wrapper crate via
#[uniffi::remote(...)]. Single scaffolding, single namespace
(devolutions_crypto_uniffi), all types in one module. Rename the Swift
systemLibrary target directory, modulemaps, and generate.sh filename
references to match.
The imports referenced a package that does not exist under the current
bindgen config (uniffi.toml sets package_name = org.devolutions.crypto).
The tests live in that same package, so no import is needed:
- DataType resolves locally
- bare Exception resolves to kotlin.Exception, which still catches
  DevolutionsCryptoException (the generated flat error).
The builder macro was replaced by hand-written Arc<Mutex<...>> builders
in the wrapper crate, leaving the macro crate unreferenced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants