Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
Ben Dean-Kawamura 7c37987742 Merging changes from 0.28.3 back into main 2024-11-14 18:45:21 -05:00
bendk 9e1b120e32
Merge pull request #2211 from bendk/push-oynonqnuxvxp
2210: Tracing printouts for FFI calls
2024-10-16 14:56:52 -04:00
Mark Hammond 82d11879fc
Move old and dated authors entries from Cargo.tomls (#2272) 2024-10-15 09:38:09 -04:00
Ben Dean-Kawamura deae161be8 chore: Release 2024-10-08 09:29:39 -04:00
Ben Dean-Kawamura e31172fb75 chore: Release 2024-08-09 15:29:51 -04:00
Ben Dean-Kawamura d8ec1d287f 2210: Tracing printouts for FFI calls
Added the `uniffi:ffi-trace` feature.  If enabled, UniFFI will printout
tracing-level logs for FFI calls.  I hooked up the futures code to this,
in the future we could also log more stuff.  Lowering/lifting/cloning
arcs is the first example that comes to mind.

To see tracing, use the `--features=ffi-trace` when running a tests, for example:
  - `cd fixtures/futures/src`
  - `cargo test --features=ffi-trace`

Here's an example of the tracing printouts when running tests from the
futures fixtures:

```
rust_future_new: Handle(94402427620656)
rust_future_poll: Handle(94402427620656)
RustFuture::wake called
rust_future_poll: Handle(94402427620656)
RustFuture::poll is ready (canceled: false)
rust_future_complete: Handle(94402427620656)
rust_future_free: Handle(94402427620656)
```
2024-08-09 15:13:29 -04:00
Murph Murphy 3cb19d8600
Provide more external type information to `FfiType::RustBuffer` (#2195)
* Thread `ExternalType` metadata into RustBuffer

In service of Java bindgen being able to generate fully qualified
`RustBuffer`s when necessary.

* Switch to `test --no-run` from `build` for cdylib

`uniffi-bindgen-java` is external to the uniffi repo, so the
fixtures/examples are all `dev-dependencies`, which aren't built on a
call to `cargo build`. `cargo test --no-run` causes them to be built but
doesn't cause a run of tests in place.
2024-08-01 10:06:22 -04:00
Mark Hammond f1c846776f
Move cargo_metadata execution out to the edges (ie, to the cli) (#2201)
This continues the cargo_metadata feature work but making the execution
of cargo_metadata the resonsibility of the uniffi_bindgen callers
rather that executing it implicitly. This means the CLI,
which in-turn means the top-level uniffi crate also gets a
`cargo-metadata` feature.

This reverts what we did to fix #2183 - by making `no_deps` the
default, it means we will be unable to support reuse of UniFFI
components, because it means we only support all components
being in the same workspace. While this is a common use-case,
it's not the only use-case we want to support. So grabbing
all dependencies from cargo_metadata is again the default, but
there's a new command-line option to avoid it.

It also replaces some of #2195.
2024-07-31 17:09:41 -04:00
Mark Hammond 3c6521a789
Add a cargo_metadata feature so using cargo_metadata can be avoided in some cases (#2175) 2024-07-11 20:48:55 -04:00
Ben Dean-Kawamura f486682ffe chore: Release 2024-06-11 14:17:30 -04:00
Ben Dean-Kawamura 051f1291c2 chore: Release 2024-06-03 10:50:43 -04:00
Ben Dean-Kawamura 5ef30af9fe chore: Release 2024-05-15 15:38:15 -04:00
Mark Hammond a234cf0dda chore: Release 2024-04-03 17:38:29 -04:00
Ben Dean-Kawamura 6f1f9b71c4 chore: Release 2024-03-26 17:09:42 -04:00
Ben Dean-Kawamura 4a787e594d chore: Release 2024-01-24 10:42:27 -05:00
Ben Dean-Kawamura 27fbd42daa chore: Release 2024-01-23 13:35:53 -05:00
Ben Dean-Kawamura 803713c105 Merge changes from 'v0.25.3' 2023-12-07 14:31:04 -05:00
Ben Dean-Kawamura afb29ebdc1 Releasing 0.25.3
Added changelog entry for 0.25.3 and ran `cargo release`
2023-12-07 13:38:49 -05:00
Didier Villevalois 9f7c3c4663
add README to published crates (#1866)
Fixes #1860.
2023-11-26 22:48:25 -05:00
Mark Hammond ad7a01f803 chore: Release 2023-11-20 10:40:29 -05:00
Ben Dean-Kawamura f7237b7721 chore: Release 2023-11-09 11:41:08 -05:00
Ben Dean-Kawamura 6a2441a5ea chore: Release 2023-10-18 13:27:07 -04:00
Jan-Erik Rediger 1eabe8645c Apply 0.24.3 bump to `main` 2023-09-07 10:45:48 +02:00
Mark Hammond cae8edc45b
Avoid using serde just for printing debug representations (#1719) 2023-08-25 13:59:53 -04:00
Jan-Erik Rediger 217d4ccbf5 chore: Release 2023-06-23 12:16:38 +02:00
Jan-Erik Rediger ff92540817 chore: Release 2023-06-21 12:26:39 +02:00
Ben Dean-Kawamura b50414639c Reworking "crate mode" as "library mode"
With crate mode, the user specified a crate name and UniFFI handled
building it.  With library mode the user needs to build the library
themselves, then pass the path to UniFFI.

This is slightly less convenient for the user -- although not that much,
since somewhere in their build system they are going to need to build
the library and copy it out.  However, it's more flexible since users can
build their library with whatever combination of feature flags, targets,
etc. they want, and if this affects the generated bindings UniFFI will
work with it.  Before, UniFFI had to guess the flags to pass to `cargo
build`, which wasn't ideal.

Made a few doc changes to indicate that library mode is the recommended
way to build and will probably be the default sometime in the future.
However, for now it's still not the default.

Fixed some newer fixtures to use `include_scaffolding!()`
2023-05-26 12:27:04 -04:00
Ben Dean-Kawamura 68bd40fb17 Added "crate-mode" bindings generation
This leverages the new macro metadata feature to simplify bindings
generation.  The new mode is enabled by passing `--crate [main-crate]`
to the `generate` command instead of a UDL file.  UniFFI will then use
the exported metadata symbols cargo metadata to figure out what to
generate.  Bindings will be generated for main crate and all it's
UniFFIed dependencies into a single out dir.

The new system allows us to set defaults for several config values that
should work in virtually all cases.  `cydlib_name` can be calculated
from the dylib path that cargo metadata gives us.
`kotlin.external_packages` can be calculated since we're going to be
generating bindings for those external packages in the same pass.

I think this should improve use-cases like the app-services megazord,
where multiple UniFFI crates, including support crates, are compiled
into one large library.  It makes it much simpler to add new crates or
to move types into a support crate and use the external types feature:

  - No need to add a new `uniffi-bindgen` task to the build process
  - No need to add a `uniffi.toml` config just to spcify the dylib name.
  - No need to figure out the `external_packages` map for external
    packages.

Made the generate command more verbose, for example it now prints out
the files it's generating.  I found this very useful when debugging
generation issues and figured it would be nice going forward.
2023-05-26 12:27:04 -04:00
Ben Dean-Kawamura 50a5902ac5 Adding benchmark tests
- Added the `benchmarks` fixture.  This runs a set of benchmark tests
  and uses `criterion` to analyze the results.  Added some benchmarks
  for calling functions and callback interfaces.
- Added `run_script()` function, which is a more generic version of
  `run_test()`.
- uniffi_testing: Don't add `--test` when running `cargo build` to find
  the dylibs.  It's not needed for the fixture/example tests and it
  breaks the benchmark tests.
2023-03-23 16:02:45 -04:00
Ben Dean-Kawamura d42c37628b (cargo-release) version {{version}} 2023-01-27 11:35:00 -05:00
Jan-Erik Rediger 025b9a9cca chore: Release 2022-12-16 16:21:02 +01:00
Jan-Erik Rediger 6bf5991b89 Add metadata for uniffi_testing 2022-12-16 16:21:02 +01:00
Jan-Erik Rediger 8609771197
Require later cargo-release (#1430)
* Require later cargo-release

v0.22 removed some config options (as they are now the default or not needed)

* Publish uniffi_testing by default
2022-12-16 08:03:28 -06:00
Jan-Erik Rediger d93a94549e
Merge back release v0.21.1 (#1429)
* Document changed checksum mechanism for release

* (cargo-release) version 0.21.1
2022-12-16 07:50:37 -06:00
messense d8ec1172d6 Upgrade cargo_metadata to 0.15 2022-11-21 12:57:05 +01:00
Ben Dean-Kawamura ba72403fbe Added support for swift external types
This code assumes that all generate files will be compiled into a single
module, which makes external type support quite trivial.

- Updated the swift testing code to handle multiple UDL files.
- Made the custom type, enum, object, and record, FfiConverters public
  to allow them to be used with external types.
- Made the FfiConverter methods public.  I didn't make the protocols
  themselves public, since that would result in duplicate definitions
  when different UniFFI-generated swift files were linked together, but
  I did make each individual method public.
- Added Swift external types tests.
- Fixed a bug in the CustomType template.  I'm pretty sure we should be
  using `type_ffi_lowered` instead of `ffi_type_name` there since it's
  Swift code rather than a C header file.
- Added docs for configuring external types
2022-11-17 16:06:20 -05:00
Ben Dean-Kawamura 8d5ff759f2 Use `uniffi_testing` for our tests
The new system has several advantages:
  - It has handling for external crates, which makes the python
    ext-types fixtures work again.
  - It uses the correct suffix for Swift modules (#1194)
  - It doesn't require the `uniffi::testing` module, which I think will
    help #1374

This means that the example/fixture crates need to take a dev-dependency
on `uniffi_bindgen`.  I also updated several to take a dev-dependency on
`uniffi_macros` instead of a regular dependency, since they only needed
it for the tests. The required change was making sure all the crates had
a `lib` crate-type.

While updating the bindings code to use `uniffi_testing`, I also moved
it into its own module.
2022-11-07 09:52:42 -05:00
Jonas Platte 21ccb9816c Fix clippy lints
Automated with `cargo clippy --workspace --fix`.
2022-10-25 10:44:57 -04:00
Ben Dean-Kawamura 7dc595a183 (cargo-release) version 0.21.0 2022-10-14 14:04:51 -04:00
Ben Dean-Kawamura 2c92fa4845 (cargo-release) version 0.20.0 2022-09-13 10:59:22 -04:00
Jonas Platte 8699d12dfd
Support Arc<_> in the proc-macro frontend (#1333) 2022-09-07 16:51:20 +10:00
Jan-Erik Rediger 4f33516280
(cargo-release) version 0.19.6 (#1329) 2022-08-31 07:40:17 -05:00
Tarik Eshaq 2808944a32
Merge back release 0.19.4 and 0.19.5 into main (#1319)
* Allow Rust, Python and Kotlin keywords to be used as identifier names. (#1237)

* New regression test: We missed a newline

This is already fixed in `main`, but was an issue in 0.19.1

* Include the askama config file into the build

* Adding changelog entry for the Askama fix

* Disable publish for keyword fixtures (#1289)

* (cargo-release) version 0.19.2

* Extend regression test to Swift, Kotlin & Ruby

* Don't strip newlines around function definitions

Applies to Kotlin, Ruby and Swift.
Kotlin didn't actually break.

Co-authored-by: Travis Long <tlong@mozilla.com>

* (cargo-release) version 0.19.4

* Remove the r# added in 0.19.4

* (cargo-release) version 0.19.5

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
Co-authored-by: Jan-Erik Rediger <jrediger@mozilla.com>
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Co-authored-by: Ben Dean-Kawamura <bdk@mozilla.com>
Co-authored-by: Travis Long <tlong@mozilla.com>
2022-08-29 11:08:48 -07:00
bendk 6ce5d21925
Merge back changes from the 0.19.3 release (#1297)
* Allow Rust, Python and Kotlin keywords to be used as identifier names. (#1237)

* New regression test: We missed a newline

This is already fixed in `main`, but was an issue in 0.19.1

* Include the askama config file into the build

* Adding changelog entry for the Askama fix

* Disable publish for keyword fixtures (#1289)

* (cargo-release) version 0.19.2

* Extend regression test to Swift, Kotlin & Ruby

* Don't strip newlines around function definitions

Applies to Kotlin, Ruby and Swift.
Kotlin didn't actually break.

Co-authored-by: Travis Long <tlong@mozilla.com>

* (cargo-release) version 0.19.3

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
Co-authored-by: Jan-Erik Rediger <jrediger@mozilla.com>
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
Co-authored-by: Travis Long <tlong@mozilla.com>
2022-07-08 13:32:34 -04:00
bendk a638146611
Merging changes back from the 0.19.2 release today (#1290)
* Allow Rust, Python and Kotlin keywords to be used as identifier names. (#1237)

* New regression test: We missed a newline

This is already fixed in `main`, but was an issue in 0.19.1

* Include the askama config file into the build

* Adding changelog entry for the Askama fix

* Disable publish for keyword fixtures (#1289)

* (cargo-release) version 0.19.2

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
Co-authored-by: Jan-Erik Rediger <jrediger@mozilla.com>
Co-authored-by: Jan-Erik Rediger <janerik@fnordig.de>
2022-07-07 17:00:31 -04:00
Jonas Platte 2da9b9b49a Replace lazy_static with once_cell 2022-06-23 17:15:53 -04:00
Ben Dean-Kawamura 0b6d8c0e57 Merge branch 'release-v0.19.x' 2022-06-20 11:24:27 -04:00
Ben Dean-Kawamura 4296232a2f (cargo-release) version 0.19.1 2022-06-16 12:19:09 -04:00
Ben Dean-Kawamura c1f27860cb Merge branch 'release-v0.19.x' 2022-06-16 11:01:30 -04:00
Ben Dean-Kawamura d25c09e8dc (cargo-release) version 0.19.0 2022-06-16 10:01:38 -04:00