Skip to content

Commit

Permalink
Add support for uniffi 0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Feb 14, 2023
1 parent f69fdcc commit d7b21ab
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 152 deletions.
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ macos_arm64_task:
- cat Cargo.lock
install_script:
- brew install python3
- python3 -m pip install uniffi-bindgen==0.22.0
- python3 -m pip install uniffi-bindgen==0.23.0
<<: *BUILD_AND_TEST

linux_aarch64_task:
Expand All @@ -75,5 +75,5 @@ linux_aarch64_task:
- echo $CIRRUS_OS
- cat Cargo.lock
install_script:
- python3 -m pip install uniffi-bindgen==0.22.0
- python3 -m pip install uniffi-bindgen==0.23.0
<<: *BUILD_AND_TEST
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
if: ${{ !contains(matrix.python-version, 'pypy') }}
run: pip install cffi
- name: Install python packages
run: pip install virtualenv ziglang~=0.10.0 twine uniffi-bindgen==0.22.0
run: pip install virtualenv ziglang~=0.10.0 twine uniffi-bindgen==0.23.0
- uses: dtolnay/rust-toolchain@beta
id: rustup
with:
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add Cargo compile targets configuration for filtering multiple bin targets in [#1339](https://github.com/PyO3/maturin/pull/1339)
* Respect `rustflags` settings in cargo configuration file in [#1405](https://github.com/PyO3/maturin/pull/1405)
* Bump MSRV to 1.63.0 in [#1407](https://github.com/PyO3/maturin/pull/1407)
* Add support for uniffi 0.23 in [#1481](https://github.com/PyO3/maturin/pull/1481)

## [0.14.13] - 2023-02-12

Expand Down
6 changes: 4 additions & 2 deletions guide/src/bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ directory of a virtual environment) once installed.
uniffi bindings use [uniffi-rs](https://mozilla.github.io/uniffi-rs/) to generate Python `ctypes` bindings
from an interface definition file. uniffi wheels are compatible with all python versions including pypy.

You need to install [uniffi_bindgen](https://mozilla.github.io/uniffi-rs/tutorial/Prerequisites.html#the-uniffi-bindgen-cli-tool) first to build wheels for `uniffi` bindings:
You need to install [uniffi-bindgen](https://mozilla.github.io/uniffi-rs/tutorial/Prerequisites.html#the-uniffi-bindgen-cli-tool) first to build wheels for `uniffi` bindings:

```bash
cargo install uniffi_bindgen
pip install uniffi-bindgen==0.23.0
```

Note that `uniffi-bindgen` version should be aligned with your Rust `uniffi` dependency version.
5 changes: 2 additions & 3 deletions src/templates/Cargo.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ pyo3 = "0.18.1"
{% elif bindings == "rust-cpython" -%}
cpython = "0.7.1"
{% elif bindings == "uniffi" -%}
uniffi = "0.21.0"
uniffi_macros = "0.21.0"
uniffi = "0.23.0"

[build-dependencies]
uniffi_build = { version = "0.21.0", features = ["builtin-bindgen"] }
uniffi = { version = "0.23.0", features = ["build"] }
{% endif -%}
2 changes: 1 addition & 1 deletion src/templates/build.rs.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- if bindings == "uniffi" -%}
fn main() {
uniffi_build::generate_scaffolding("./src/example.udl").unwrap();
uniffi::generate_scaffolding("./src/example.udl").unwrap();
}
{% endif -%}
2 changes: 1 addition & 1 deletion src/templates/lib.rs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fn add(a: u32, b: u32) -> u32 {
a + b
}

uniffi_macros::include_scaffolding!("example");
uniffi::include_scaffolding!("example");
{%- endif %}
Loading

0 comments on commit d7b21ab

Please sign in to comment.