3.0 to <=3.0.14 do not work
It will fail with something like this:
error[E0405]: cannot find trait `CommandFactory` in crate `clap`
--> uniffi_bindgen/src/lib.rs:499:10
|
499 | #[derive(Parser)]
| ^^^^^^ not found in `clap`
|
= note: this error originates in the derive macro `Parser` (in Nightly builds, run with -Z macro-backtrace for more info)
This seems to have been fixed in 3.1
Changelog is here: https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#310---2022-02-16
NOTE: No bindings implementation has been done. It still all defaults to
strings.
Uses a fork of weedle, released as weedle2,
with one additional commit to allow arbitrary types in record keys:
90031e37d4
The new Askama version adds refererences in less places. This required
a few changes:
- `&dyn fmt::Display` args get change to `&str`
- Enum literals (`Type::String`) need a `.borrow()` appended to them if
they get passed to a filter function.
- Method calls that then get filtered, (`something.type_()|type_name`)
need a `.borrow()` appended to them. In a some cases, this can also
be fixed by having the template code use a field from the template
struct directly rather than via a method call.
- Arguments captured in matches also need a `.borrow()` if they get
passed to a filter function.
Fixed some incorrect whitespace handling code that was only working
because of Askama bugs that were fixed in this version.
Updated the Rust versions to match the policy for Firefox 97. Askama
requires a newer minimum version, because it uses the `bool_to_option`
feature.
* Unit of code: separate kotlin backend in to several managable files
Introduce seam within mod filter
Introduce oracle and fallback code type. Tests pass
Pass around an oracle in the most disgusting way
Split out first modules into files, and passing tests
Extracted enum
Extracted fallback code type
Simplify CodeType trait
Changed name to LanguageOracle. Added formatting for FFIType
Add methods, but nothing for it for adding definitions to CodeType implementations
Handover comments
Convert String to use the pattern. Edited lower+lift machinery in one file
Enum declaration now being generated from its own file
Unfortunately, I've had to rip out
```
{% if member.contains_unsigned_types(ci) %}@ExperimentalUnsignedTypes{% endif %}
```
and
```
{%- if ci.type_contains_object_references(field.type_()) -%}
```
from the Kotlin templates. This is because we can no longer depend on the component interface being available to the templates.
I expect this will be difficult to fix without another pass, and this seems awkward because the is backend specific.
Object working too with almost no changes to templates
Re-add contains_object_references
Re-add contains_unsigned_types
Convert Records
Primitive macro working with primitive boolean
Convert numbers, booleans, strings and floats in to CodeTypes
Fixup other tests / clippy
Convert optional, sequence and map
Convert optional, sequence and map Part II
Convert errors
Tidy / cargo fmt
Convert callback interfaces Part I
Convert callback interfaces Part II
Tidy unsigned types in compounds
Converted Timestamp and Duration
Remove legacy filters and fallbacks (!)
cargo fmt
Delegate imports out to the CodeTypes and Members themselves
Moved helper code and member declarations into a declaration_code method
Rename StringReturn to String
FFI Function tidy
Convert top level functions
Rename unsigned_type_annotation macro
Tighten up visibility of Kotlin objects
Move differential set up of objects and callback interfaces from Helpers.kt to object and callback_interface files
Remove unnecessary type_identifier method from MemberDeclaration
Add better docs
Rename MemberDeclation to CodeDeclaration
Rename LanguageOracle to CodeOracle
Fix typos
Self-review
Remove file of dead code
Remove requirement for implementing unneeded CodeType methods
* Address tarikeshaq nits
* Address reviewer comments I
* Address reviewer comments II
* Remove unsigned types annotations
Cargo fmt
This is basically copying the upstream fix proposed for `nom`, until we
get a new release with the fix included.
Ref https://github.com/Geal/nom/pull/1286/
The new version of weedle tracks an update in the WebIDL spec [1]
that renamed `void` to `undefined`, which makes sense for the web but
is a bit of a pain for us. To avoid churning consumers of uniffi,
this commit adds some special-case handling for the identifier `void`
in return position. You can tell that the special-casing works
by the fact that this doesn't require changes to any of our tests,
many of which use the `void` syntax.
[1] Ref https://github.com/rustwasm/weedle/pull/43
This commit adds a backend that generates bindings for Firefox
front-end code. The bindings are written in WebIDL. For more details,
please see the comments in the `gecko_js` module, as well as the
ADR.
Closes#11.
Co-authored-by: Dan Mosedale <dmose2@gmail.com>
* 258 — Add toml file to configure kotlin binding.
* Move uniiffi.toml to package directory
* Working with serde/merge_with in kotlin only
* Working with python and swift
* Standardize on config, ci ordering in arg lists
* cargo fmt
* Address reviewer comments
Previously, we were using two experimental features of Kotlin,
in different ways:
* Unsigned types, both as API-level types and for some internal
helpers.
* The `buildMap` function, for easily building a Map.
Both of these were emitted as part of the generated Kotlin code,
regardless of whether the component actually needed them.
In the first case, consumers would get a warning that they need
to opt-in to using experimental unsigned types, even if the API
they were consuming did not use any unsigned types.
In the second case, we were silently opting in to an experimental
API, meaning that consumers might find the generated code broken
by a future Kotlin release without any warning.
This commit removes default-on experimental Kotlin APIs. Now,
the only time Kotlin consumers will hear about experimental APIs
is if they're using a component with unsigned integers in its
public API, in which case they will need to explicitly opt in
(and hence will be aware of the potential for bustage if the
feature gets removed or changed in future Kotlin releases).
The key here was to refactor the ways the `ComponentInterface`
deals with types, so that we can inspect the set of types that
are actually used by the interface and emit only the code required
for those types. This is encapsulated in a new `TypeUniverse`
struct whose job is to maintain that whole-interface view of the
set of types in use.