Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes for C# 0.28.0 #16

Open
wants to merge 295 commits into
base: main
Choose a base branch
from
Open

Conversation

arg0d
Copy link
Collaborator

@arg0d arg0d commented Aug 23, 2024

No description provided.

mhammond and others added 30 commits November 20, 2023 13:20
That module was getting pretty long and I want to add some more
functionality to it.  Let's split it up into smaller files.

This commit just moves things around and renames `ContinuationDataCell`
to `Scheduler`.
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.
Fixes mozilla#1831

Also fixes naming problem bindings with external types with
unusual names.
* 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
Search the path for `bash` vs expecting it at `/bin`.
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:
mozilla@5cabada
I want to fix mozilla#1797 by cloning the object handle in lower().  However,
this presents an issue in the dynamic languages because they perform
various failable checks in lower(): type checks, bounds checks, etc.  If
the check fails, then the cloned handle will be leaked.

Prevent this by adding a `check()` method.  We do the check first then
once we get to `lower()`, nothing can fail.
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.
For constructors and other methods that return an object, UniFFI can
wrap the object in an `Arc<>` just fine, the library doesn't need to do
this.  Allowing the library to skip the wrapping can improve ergonomics,
especially if we start to allow interfaces as errors.
This avoids pulling in the loom dependency.
Added changelog entry for 0.25.3 and ran `cargo release`
This has been long deprecated and was removed in Python 3.12
This isn't currently used, so let's get rid of it.
mozilla#1885)

Also implements exposing the discriminator for Python.
The struct name changed in fbc6631,
let's make the field name match it.
This makes it so the scaffolding templates use `export_for_udl` rather
than generating their own code.
The main change is that we will now use the `cargo release --no-publish`
flag to avoid publishing to `crates.io` until the release PR is approved.

Added the `--execute` flag by default.  I don't think we need to do dry
runs since we're now only creating a commit and waiting for PR approval.

Updated `release-process.md` to reflect the new process.

I left the current wording about separating `uniffi` releases from the
rest of the crates, although I noticed that in practice we haven't been
doing that.  All of our major changes in the last year bumped
`UNIFFI_CONTRACT_VERSION`, so we never had a chance to, for example,
bump the `unffi-bindgen` version without also bumping the `uniffi`
version.  Maybe we should revisit this decision, but I didn't want to do
that in this change.

A consequence of the last note is that we still need to make the 2
`Chore: Release` commits.
PollResult is an `i8` in Rust, but was incorrectly specified as a
`Short` in Kotlin.  Things seem to be working accidentally, but this
should be fixed.
This is needed to allow these to work with proc-macros.

This is not needed for UDL, because there we generate a function than
inputs `&String`, then pass that value to the Rust function than inputs
`&str`.  Rust can handle that conversion automatically.  However, with
proc-macros the scaffolding function types are always exactly the same
as the source function types.
flisky and others added 29 commits May 29, 2024 13:34
Be more consistent with Python variable prefixes
The generation of these docs generates a lot of churn in the gh-pages
branch - even when nothing has changed - so instead we skip building
and publishing them and link to the generated pages on docs.rs.
This causes the version selector to be rendered into the pages,
however they will not be shown until we actually deploy
version information.

Includes a script to help generate redirects for all our "old" pages.
docs(kotlin): mention `AttachCurrentThread`
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.
…encies

Remove the unicode-linebreak / unicode-width dependencies
fixtures/regressions/cdylib-crate-type-dependency/ffi-crate/Cargo.toml
fixtures/regressions/kotlin-experimental-unsigned-types/Cargo.toml
uniffi_bindgen/src/bindings/kotlin/templates/CallbackInterfaceTemplate.kt
uniffi_bindgen/src/bindings/kotlin/templates/TopLevelFunctionTemplate.kt
uniffi_bindgen/src/bindings/python/templates/CallbackInterfaceTemplate.py
uniffi_bindgen/src/bindings/python/templates/TopLevelFunctionTemplate.py
uniffi_bindgen/src/bindings/swift/templates/CallbackInterfaceTemplate.swift
uniffi_bindgen/src/bindings/swift/templates/ObjectTemplate.swift
uniffi_bindgen/src/bindings/swift/templates/RecordTemplate.swift
uniffi_bindgen/src/bindings/swift/templates/TopLevelFunctionTemplate.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.