Skip to content

Commit

Permalink
Bump v0.7.0+v0.25.0 (#51)
Browse files Browse the repository at this point in the history
* Bump v0.7.0+v0.25.0

Create `docs/RELEASE.md` containing the release procedure.

Refactor configuration options from `README.md` into
`docs/CONFIGURATION.md`.

* Update docs/RELEASE.md

Co-authored-by: Martynas Gurskas <[email protected]>

---------

Co-authored-by: Martynas Gurskas <[email protected]>
  • Loading branch information
arg0d and Lipt0nas authored Nov 16, 2023
1 parent cf0368c commit 5a4512f
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 63 deletions.
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
----

### v0.7.0+v0.25.0

- **BREAKING**: Emit `byte[]` instead of `List<byte>` for `bytes` type [#53](https://github.com/NordSecurity/uniffi-bindgen-cs/pull/53).

----

### v0.6.0+v0.25.0

- **BREAKING**: Update to uniffi v0.25.0.
- Implement Display trait method for objects. Override ToString() C# object method.

----

### v0.5.1+v0.24.0

- Bump to correct crate version.

### v0.5.0+v0.24.0

- **BREAKING**: Update uniffi to 0.24.
- **BREAKING**: Remove `package` configuration option, use `namespace` instead.
- Implement `bytes` type.
- Implement `--library` command line option.
- Default config file to `uniffi.toml` in crate root, if no config file is specified in
command line options.

----

### v0.4.1+v0.23.0

- Bump to correct crate version.

### v0.4.0+v0.23.0

- **BREAKING**: Emit flat enum variants using `PascalCase` instead of `SCREAMING_SNAKE_CASE`.
- Lowercase numeric types in generated bindings code.

----

### v0.3.0, v0.3.1

This is a version somewhere between 0.23.0 and 0.24.0. This was supposed to be a temporary stepping
stone for the actual 0.24.0 version, but ended up never being actually used (at least by us). It
is reverted in main branch. Use v0.2.0 instead.

- **DO NOT USE, UNFINISHED**

----

### v0.2.4+v0.23.0

- Fix missing imports when ImplicitUsings is not enabled.
- Allow configuration of global methods class name (uniffi.toml: global_methods_class_name).

### v0.2.3+v0.23.0

- Fix 0.2 release to be compatible with mozilla/uniffi-rs 0.23.0 after docstring changes.

### v0.2.2+v0.23.0

- Implement docstrings.

### v0.2.1+v0.23.0

- Add `namespace` configuration option to `uniffi.toml`.

### v0.2.0+v0.23.0

- **BREAKING**: Update uniffi to 0.23.0.
- Allow `uniffi-bindgen-cs` to be used as a library.

----
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 11 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Minimum Rust version required to install `uniffi-bindgen-cs` is `1.72`.
Newer Rust versions should also work fine.

```bash
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.6.0+v0.25.0
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.7.0+v0.25.0
```

# How to generate bindings
Expand Down Expand Up @@ -40,70 +40,18 @@ There are a couple of requirements to compile the generated bindings file:

The following uniffi features are unsupported.

- [External types](https://github.com/NordSecurity/uniffi-bindgen-cs/issues/40)
- External types [#40](https://github.com/NordSecurity/uniffi-bindgen-cs/issues/40)

- [Async functions](https://github.com/NordSecurity/uniffi-bindgen-cs/issues/41)
- Async functions [#41](https://github.com/NordSecurity/uniffi-bindgen-cs/issues/41)

# Configuration options

It's possible to configure some settings by passing `--config` argument to the generator. All
configuration keys are defined in `bindings.csharp` section.
It's possible to [configure some settings](docs/CONFIGURATION.md) by passing `--config`
argument to the generator.
```bash
uniffi-bindgen-cs path/to/definitions.udl --config path/to/uniffi.toml
```

- `cdylib_name` - override the dynamic library name linked by generated bindings, excluding `lib`
prefix and `.dll` file extension. When using `--library` mode, defaults to library's name.
In standalone mode this value is required, and error will be produced if its missing.
```toml
# For library `libgreeter.dll`
[bindings.csharp]
cdylib_name = "greeter"
```

- `custom_types` - properties for custom type defined in UDL with `[Custom] typedef string Url;`.
```toml
# Represent URL as a C# native `Uri` class. The underlying type of URL is a string.
[bindings.csharp.custom_types.Url]
imports = ["System"]
type_name = "Uri"
into_custom = "new Uri({})"
from_custom = "{}.AbsoluteUri"
```

- `imports` (optional) - any imports required to satisfy this type.

- `type_name` (optional) - the name to represent the type in generated bindings. Default is the
type alias name from UDL, e.g. `Url`.

- `into_custom` (required) - an expression to convert from the underlying type into custom type. `{}` will
will be expanded into variable containing the underlying value. The expression is used in a
return statement, i.e. `return <expression(value)>;`.

- `from_custom` (required) - an expression to convert from the custom type into underlying type. `{}` will
will be expanded into variable containing the custom value. The expression is used in a
return statement, i.e. `return <expression(value);>`.

- `namespace` - override the `namespace ..;` declaration in generated bindings file. The default is
`uniffi.{{namespace}}`, where `namespace` is the namespace from UDL file.
```toml
# emits `namespace com.example.greeter;` in generated bindings file
[bindings.csharp]
namespace = "com.example.greeter"
```

- `global_methods_class_name` - override the class name containing top level functions. The default
is `{{namespace}}Methods`, where `namespace` is the namespace from UDL file.
```toml
# emits `public static class LibGreeter { .. }` in generated bindings file
[bindings.csharp]
namespace = "LibGreeter"
```

# Contributing

For contribution guidelines, read [CONTRIBUTING.md](CONTRIBUTING.md)

# Versioning

`uniffi-bindgen-cs` is versioned separately from `uniffi-rs`. UniFFI follows the [SemVer rules from
Expand Down Expand Up @@ -135,8 +83,10 @@ The table shows `uniffi-rs` version history for tags that were published before
| v0.2.0 | v0.23.0 |
| v0.1.0 | v0.20.0 |

### v0.3.0
# Documentation

More documentation is available in [docs](docs) directory.

# Contributing

This is a version somewhere between 0.23.0 and 0.24.0. This was supposed to be a temporary stepping
stone for the actual 0.24.0 version, but ended up never being actually used (at least by us). It
is reverted in main branch. Use v0.2.0 instead.
For contribution guidelines, read [CONTRIBUTING.md](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uniffi-bindgen-cs"
version = "0.6.0+v0.25.0"
version = "0.7.0+v0.25.0"
edition = "2021"

[lib]
Expand Down
55 changes: 55 additions & 0 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Configuration options

It's possible to configure some settings by passing `--config` argument to the generator. All
configuration keys are defined in `bindings.csharp` section.
```bash
uniffi-bindgen-cs path/to/definitions.udl --config path/to/uniffi.toml
```

- `cdylib_name` - override the dynamic library name linked by generated bindings, excluding `lib`
prefix and `.dll` file extension. When using `--library` mode, defaults to library's name.
In standalone mode this value is required, and error will be produced if its missing.
```toml
# For library `libgreeter.dll`
[bindings.csharp]
cdylib_name = "greeter"
```

- `custom_types` - properties for custom type defined in UDL with `[Custom] typedef string Url;`.
```toml
# Represent URL as a C# native `Uri` class. The underlying type of URL is a string.
[bindings.csharp.custom_types.Url]
imports = ["System"]
type_name = "Uri"
into_custom = "new Uri({})"
from_custom = "{}.AbsoluteUri"
```

- `imports` (optional) - any imports required to satisfy this type.

- `type_name` (optional) - the name to represent the type in generated bindings. Default is the
type alias name from UDL, e.g. `Url`.

- `into_custom` (required) - an expression to convert from the underlying type into custom type. `{}` will
will be expanded into variable containing the underlying value. The expression is used in a
return statement, i.e. `return <expression(value)>;`.

- `from_custom` (required) - an expression to convert from the custom type into underlying type. `{}` will
will be expanded into variable containing the custom value. The expression is used in a
return statement, i.e. `return <expression(value);>`.

- `namespace` - override the `namespace ..;` declaration in generated bindings file. The default is
`uniffi.{{namespace}}`, where `namespace` is the namespace from UDL file.
```toml
# emits `namespace com.example.greeter;` in generated bindings file
[bindings.csharp]
namespace = "com.example.greeter"
```

- `global_methods_class_name` - override the class name containing top level functions. The default
is `{{namespace}}Methods`, where `namespace` is the namespace from UDL file.
```toml
# emits `public static class LibGreeter { .. }` in generated bindings file
[bindings.csharp]
namespace = "LibGreeter"
```
44 changes: 44 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Figure out next version

Following [versioning rules](../README.md/#versioning), figure
out the version to be made. If there were any breaking changes since last version, bump the minor
component. If there weren't any breaking changes, bump the patch component.

The version follows semver, and consists of `uniffi-bindgen-cs` base version, followed by
upstream `uniffi-rs` version in the build metadata component (denoted as `+`). The upstream explicit
upstream `uniffi-rs` aids consumer to target the same upstream version when mixing multiple
generators, e.g. `uniffi-bindgen-cs` and `uniffi-bindgen-go`.
```
v0.6.0+v0.25.0
```

## Update version in [bindgen/Cargo.toml](../bindgen/Cargo.toml)

Note that the version in [bindgen/Cargo.toml](../bindgen/Cargo.toml) is not prefixed with `v`,
i.e. `0.6.0+v0.25.0` instead of `v0.6.0+v0.25.0`.

## Update version in [Cargo.lock](../Cargo.lock)

Run any `cargo` command to include the new version in `Cargo.lock` file, e.g.
```
cargo build
```

## Update version in [README.md](../README.md)

- Update the [installation command](../README.md#how-to-install) to use the new version.
- If upstream uniffi-rs version was updated, add new entry to [versioning table](../README.md#versioning).

## Update [CHANGELOG.md](../CHANGELOG.md)

Inspect Git history, create a list of changes since last version.
- For breaking changes, prefix the change with `**BREAKING**:`
- For important changes, such as memory leak or race condition fixes, prefix the change with `**IMPORTANT**:`

## Create PR

Create PR, get the PR reviewed, and merge into `main`.

## Create tag

Once the PR is merged into `main`, create new tag in `main` branch.
File renamed without changes.

0 comments on commit 5a4512f

Please sign in to comment.