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

69 Коммитов

Автор SHA1 Сообщение Дата
Jan-Erik Rediger 61811c77e0 Regression test for doc annotations parsing failure 2024-06-17 12:27:43 +02:00
Ben Dean-Kawamura 5903ce59b3 chore: Release 2024-06-11 14:17:56 -04:00
Ben Dean-Kawamura f486682ffe chore: Release 2024-06-11 14:17:30 -04:00
Ben Dean-Kawamura fb752f8936 Merging the release-v0.27.x back into main 2024-06-03 12:13:49 -04:00
Ben Dean-Kawamura 99d851ee16 chore: Release 2024-06-03 10:51:18 -04:00
Ben Dean-Kawamura 051f1291c2 chore: Release 2024-06-03 10:50:43 -04:00
Ben Dean-Kawamura df87af5fcd Remove the unicode-linebreak / unicode-width dependencies
Docstrings rarely have unicode characters so these are not adding much
value.  They present an issue for the downstream moz-central crate
(https://bugzilla.mozilla.org/show_bug.cgi?id=1894888), so let's remove
them.
2024-06-03 10:24:49 -04:00
Ben Dean-Kawamura 142858003e chore: Release 2024-05-15 15:38:15 -04:00
Ben Dean-Kawamura 5ef30af9fe chore: Release 2024-05-15 15:38:15 -04:00
Mark Hammond 13a1c559cb
TargetLanguage is now just a cli concept, so move it there (#2101) 2024-05-10 10:30:33 -04:00
Ben Dean-Kawamura 91243c0c60 Remove the oneshot dependency (#1736)
Implemented our own oneshot channel using a Mutex.  It's not quite as
efficient as the `oneshot` one, but I think it should be fine for our
purposes.  My gut feeling is that the loss of overhead is neglibable
compared the other existing overhead that UniFFI adds.

The API of the new oneshot is basically the same, except send/recv are
not failable.
2024-05-10 10:10:53 -04:00
Ben Dean-Kawamura 2ff4849fd9 Added ffi-buffer scaffolding functions
These are alternate versions of the current scaffolding functions that
use u64 buffers to handle their input/output.

The main use case is the gecko-js bindings used in Firefox.  This allows
us to replace the generated C++ code with static code, since the
scaffolding functions now always have the exact same signature.

This commit generates FFI buffer versions for scaffolding functions
defined for user functions/methods.  It does not generate them for
functions with known/static signatures like the rust buffer FFI
functions, or the object clone/delete functions.  If the signature is
always the same, then there isn't a problem calling the normal
scaffolding functions.
2024-05-10 09:25:05 -04:00
Ben Dean-Kawamura d76ab7d75f Remove the oneshot dependency (#1736)
Implemented our own oneshot channel using a Mutex.  It's not quite as
efficient as the `oneshot` one, but I think it should be fine for our
purposes.  My gut feeling is that the loss of overhead is neglibable
compared the other existing overhead that UniFFI adds.

The API of the new oneshot is basically the same, except send/recv are
not failable.
2024-05-07 11:01:35 -04:00
bendk 96453d79fe
Merge pull request #2039 from bendk/ffi-buffer
Added ffi-buffer scaffolding functions
2024-05-06 13:21:03 -04:00
Ben Dean-Kawamura a4dae7e670 Added ffi-buffer scaffolding functions
These are alternate versions of the current scaffolding functions that
use u64 buffers to handle their input/output.

The main use case is the gecko-js bindings used in Firefox.  This allows
us to replace the generated C++ code with static code, since the
scaffolding functions now always have the exact same signature.

This commit generates FFI buffer versions for scaffolding functions
defined for user functions/methods.  It does not generate them for
functions with known/static signatures like the rust buffer FFI
functions, or the object clone/delete functions.  If the signature is
always the same, then there isn't a problem calling the normal
scaffolding functions.
2024-05-06 12:57:39 -04:00
Ben Dean-Kawamura 8a6948dcde Remove the unicode-linebreak / unicode-width dependencies
Docstrings rarely have unicode characters so these are not adding much
value.  They present an issue for the downstream moz-central crate
(https://bugzilla.mozilla.org/show_bug.cgi?id=1894888), so let's remove
them.
2024-05-06 15:39:36 +02:00
Erich Gubler a82487fada build: upgrade `heck` 0.4.1 → 0.5.0, `clap` 4.3.19 → 4.5.4 2024-05-06 11:14:54 +02:00
Mark Hammond 15a347327a
Rename the 'ext-types/guid' fixture to 'ext-types/custom-types' (#2072) 2024-04-15 14:53:45 -04:00
Mark Hammond 0ecafdc067 chore: Release 2024-04-03 17:38:29 -04:00
Mark Hammond a234cf0dda chore: Release 2024-04-03 17:38:29 -04:00
Ben Dean-Kawamura d52c5460ae chore: Release 2024-03-26 17:10:27 -04:00
Ben Dean-Kawamura 6f1f9b71c4 chore: Release 2024-03-26 17:09:42 -04:00
Alexander Cyon 0a88d94178
Increase BUF_SIZE to 16384 | Allowing large errors (#2042)
* Increase BUF_SIZE to 16384 (from 4096), allowing large errors (enums) to be used. Add fixture which unit tests fails even for BUF_SIZE of 8198, but works with 16k.
2024-03-20 19:18:56 -04:00
Ben Dean-Kawamura e7b0b550b1 Foreign-implemented async trait methods (#2017)
These methods input a completion function that they call when the async
function is complete. They return a ForeignFuture struct, which
represents the foreign task object and is used to drop/cancel futures.
Like Rust, dropping and cancelling are coupled together into one operation.

- Added `RustCallStatus` as an `FfiType` variant, since I wanted to use
  it in the `ForeignFutureResult` structs.  In theory, we could define
  `RustCallStatus` a `FfiType::Struct`, but I didn't want to introduce
  that change in this PR.
- Fixed the result mapping code to work with async functions.  Before we
  were executing the mapping call, then awaiting the result, but we need
  to do that in the opposite order (`foo.into().await` vs `foo.await.into()`).
  Also, specify the return type generics for `rust_future_new` so that
  the Rust can figure out the into() generics.
2024-03-18 17:24:55 -04:00
Sammy Khamis 337833006f
Generate underyling enum variant literals for swift and kotlin (#1944) 2024-03-08 15:38:06 -05:00
bendk 7bcd3c9b30
Merge pull request #2015 from bendk/merge-0.26.1-to-main
Merge 0.26.1 to main
2024-03-07 10:32:52 -05:00
Ben Dean-Kawamura 2a998a0b61 Merge 'v0.26.1' to main
This only updates the CHANGELOG and version numbers.  All the functional
changes were already in main.

Whiile merging the changelog, I also removed a duplicate "What's new"
header and moved the "All changes" link to the bottom of the entry.
2024-03-07 10:29:29 -05:00
Jan-Erik Rediger f78a458cbf Python: Force named parameters for struct constructors
BREAKING CHANGE:
Named arguments to struct constructors are now required.
Note that this now allows default values before non-default ones, which
previously lead to a syntax error in generated Python.
2024-03-07 16:23:27 +01:00
Jan-Erik Rediger bb985bb93b
Check lowering after coercing default value (#2009) 2024-03-06 16:27:41 +01:00
Mark Hammond 2e4e2ae53e
Allow interfaces to be errors. (#1963) 2024-02-26 21:03:03 -05:00
Ben Dean-Kawamura 49beceaba5 Adding support for Rust async trait methods
This was pretty easy, it mostly meant not hard coding that we don't
support async methods and which order to apply `#[uniffi::export]` vs
`#[async_trait::async_trait]`.

The next step is foreign-implemented traits.
2024-02-07 16:51:51 -05:00
Ben Dean-Kawamura f856555557 Bump weedle2 to 5.0.0
This was previously published as weedle 4.0.1, but this change was actually breaking:

bf9097cc2f (diff-389c79acae386eb845b5e78c7a4b3e284837370f5afb4e31daf5455c8cb200f9R238)

I yanked the 4.0.1 release, let's release this with a new major version instead.
2024-01-25 10:32:01 -05:00
Ben Dean-Kawamura d5332be35e chore: Release 2024-01-24 10:42:27 -05:00
Ben Dean-Kawamura 4a787e594d chore: Release 2024-01-24 10:42:27 -05:00
Ben Dean-Kawamura f580c369de Bump weedle2 to 5.0.0
This was previously published as weedle 4.0.1, but this change was actually breaking:

bf9097cc2f (diff-389c79acae386eb845b5e78c7a4b3e284837370f5afb4e31daf5455c8cb200f9R238)

I yanked the 4.0.1 release, let's release this with a new major version instead.
2024-01-24 10:42:27 -05:00
Ben Dean-Kawamura cccb063706 chore: Release 2024-01-23 15:10:09 -05:00
Ben Dean-Kawamura 794db3619f chore: Release 2024-01-23 15:10:09 -05:00
Ben Dean-Kawamura 9c225f48a7 chore: Release 2024-01-23 13:35:53 -05:00
Ben Dean-Kawamura 27fbd42daa chore: Release 2024-01-23 13:35:53 -05:00
Mike Hommey 6ca87e41cb Update goblin to 0.8 2024-01-16 12:18:51 -05:00
Ben Dean-Kawamura b705005813 Update oneshot-uniffi to 0.1.6
This brings in the `into_raw` and `from_raw` methods that we may want to
use to pass oneshot senders over the FFI.  It still uses my patched
version to avoid #1736.
2023-12-28 10:37: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
bendk 673e01ff57
Depend on our patched oneshot carte (#1736) (#1886)
This avoids pulling in the loom dependency.
2023-12-07 11:16:38 -05:00
bendk d380d164cf
Clone objects when lowering them (#1797) (#1880)
Currently, `lower()` always returns a borrow of the object handle.  This
is fine for function arguments, since you know the object is still
alive on the stack while the function is being called.  However, for
function returns this is not correct.

To fix this: clone the handle in `lower()`. Added a test for this -- it
was surprisingly easy to cause a segfault with the current behavior.

Removed the reexport-scaffolding-macro fixture which broke and often
requires changes when the FFI changes.  I don't think it's giving us
enough value at this point to justify continuing to update it.
2023-12-04 14:21:43 -05:00
bendk bf038e8d66
Remove `uniffi-fixture-foreign-executor` (#1881)
This fixture is testing the foreign executor code, which isn't actually
used in practice.  I hope to add similar functionality, but that's
probably going to use a new fixture anyways, for example:
5cabadaaaa
2023-12-02 10:44:49 -05:00
Didier Villevalois 45d0f340f7
Docstrings for proc macros (#1862)
* test: add docstring tests for proc-macros

* feat: support docstrings in metadata

* fix(bindgen): improve docstrings in Enums and Errors

* chore: add .idea to .gitignore

* chore: add changelog entry
2023-11-30 09:51:04 +01:00
Mark Hammond a93bdfa249
Add an arithmetic-procmacro example and tweaks to the examples README (#1857) 2023-11-29 11:48:02 -05:00
Kristupas Antanavicius bf9097cc2f Implement docstrings
Docstrings are declared in .udl file by prefixing a line with three
slashes ///. Docstrings can be placed basically anywhere - functions,
objects, methods, constructors, callbacks, etc.. A docstring placed in
a wrong place will generate UDL parser error.
2023-11-22 14:10:07 +01:00
Mark Hammond d2bdd8f8c9 Merge remote-tracking branch 'origin/release-v0.25.x' into main 2023-11-20 13:03:14 -05:00