-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fleshes out the documentation book. It should be fairly readable in Markdown in the github interface, but may be better done in mdbook. Note to self: document how to contribute to documents.
- Loading branch information
Showing
33 changed files
with
1,072 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Community Participation Guidelines | ||
|
||
This repository is governed by Mozilla's code of conduct and etiquette guidelines. | ||
For more details, please read the | ||
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). | ||
|
||
## How to Report | ||
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page. | ||
|
||
## Project Specific Etiquette | ||
|
||
### Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
Project maintainers who do not follow or enforce Mozilla's Participation Guidelines in good | ||
faith may face temporary or permanent repercussions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Changing generated Typescript or C++ templates | ||
|
||
The central workings of a `uniffi-bingen` are its templates. | ||
|
||
`uniffi-bindgen-react-native` templates are in the following directories: | ||
|
||
- [Typescript templates][ts-templates] | ||
- [C++ templates][cpp-templates] | ||
|
||
Templates are written for [Askama templating library](https://djc.github.io/askama/template_syntax.html). | ||
|
||
There is a small-ish runtime for both languages: | ||
|
||
- [`typescript/src`][ts-runtime], with [tests][ts-tests] and [polyfills][ts-polyfills]. | ||
- ['cpp/includes`][cpp-runtime]. | ||
|
||
This is intended to allow developers from outside the project to contribute more easily. | ||
|
||
Making a change to the templates should be accompanied by an additional test, either in [an existing test fixture][fixtures], or a new one. | ||
|
||
Running the tests can be done with: | ||
|
||
```sh | ||
./scripts/run-tests.sh | ||
``` | ||
|
||
An individual test can be run: | ||
|
||
```sh | ||
./scripts/run-tests.sh -f $fixtureName | ||
``` | ||
|
||
[ts-templates]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/crates/ubrn_bindgen/src/bindings/react_native/gen_typescript/templates | ||
[cpp-templates]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/crates/ubrn_bindgen/src/bindings/react_native/gen_cpp/templates | ||
[ts-runtime]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/typescript/src | ||
[ts-tests]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/typescript/tests | ||
[ts-polyfills]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/typescript/testing | ||
[cpp-runtime]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/cpp/includes | ||
[fixtures]: https://github.com/jhugman/uniffi-bindgen-react-native/tree/main/fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Adding or changing turbo-module templates | ||
|
||
In addition to generating the bindings between Hermes and Rust, `uniffi-bindgen-react-native` generates the files needed to run this as a turbo-module. The list of files are [documented elsewhere in this book](../reference/turbo-module-files.md). | ||
|
||
Templates are written for [Askama templating library](https://djc.github.io/askama/template_syntax.html). | ||
|
||
Changing the templates for these files is relatively simple. [This PR is a good example](https://github.com/jhugman/uniffi-bindgen-react-native/pull/112) of adding a file. | ||
|
||
- Template files are in the [`codegen/templates` directory][codegen/templates]. | ||
- Template configuration are in [`codegen/mod.rs`][codegen/mod.rs] file. | ||
|
||
[codegen/mod.rs]: https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/codegen/mod.rs | ||
[codegen/templates]: https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/codegen/templates | ||
|
||
### Adding a new template | ||
|
||
1. Add new template to the [`codegen/templates` directory][codegen/templates]. | ||
1. Add a new `RenderedFile` struct, which specifies the template, and its path to [the `files` module](https://github.com/jhugman/uniffi-bindgen-react-native/blob/e7f85c616bf6985070081ec47f0b2b268890cc7d/crates/ubrn_cli/src/codegen/mod.rs#L141-L298) in [`codegen/mod.rs`][codegen/mod.rs]. | ||
1. Add an entry to [the list of generated files in this book](../reference/turbo-module-files.md). | ||
|
||
The [template context](https://github.com/jhugman/uniffi-bindgen-react-native/blob/e7f85c616bf6985070081ec47f0b2b268890cc7d/crates/ubrn_cli/src/codegen/mod.rs#L55-L59) will have quite a lot of useful information data-structures about the project; the most prominent: | ||
|
||
- [`ModuleMetadata`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_bindgen/src/bindings/metadata.rs), which is generated from the `lib.a` file from the uniffi contents of the Rust library. | ||
- [`ProjectConfig`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_cli/src/config/mod.rs) which is the in-memory representation of the [YAML configuration file](../reference/config-yaml.md). | ||
- [`CrateMetadata`](https://github.com/jhugman/uniffi-bindgen-react-native/blob/main/crates/ubrn_common/src/rust_crate.rs) which is data about the crate derived from `cargo metadata`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Cutting a Release | ||
|
||
## Version numbers | ||
|
||
Uniffi has a `semver` versioning scheme. At time of writing, the current version of `uniffi-rs` is `0.28.3` | ||
|
||
`uniffi-bindgen-react-native` uses this version number with prepended with a `-` and a variant number, starting at `0`. | ||
|
||
Thus, at first release, the version of `uniffi-bindgen-react-native` will be `0.28.3-0`. | ||
|
||
### Compatibility with other packages | ||
|
||
Other versioning we should take care to note: | ||
|
||
- React Native | ||
- `create-react-native-library` |
Oops, something went wrong.