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

Update the Readme #5

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "ohos-sys"
version = "0.2.0-beta1"
version = "0.2.0-beta2"
edition = "2021"
description = "Bindings to the native API of OpenHarmony OS"
license = "Apache-2.0"
repository = "https://github.com/openharmony-rs/ohos-sys"
keywords = ["OpenHarmony", "HarmonyOS", "ffi"]
exclude = ["src/*/*_api11.rs"]

[dependencies]
document-features = { version = "0.2", optional = true }
Expand Down Expand Up @@ -50,4 +51,5 @@ document-features = ["dep:document-features"]

[package.metadata.docs.rs]
features = ["document-features"]
targets = ["aarch64-unknown-linux-ohos", "armv7-unknown-linux-ohos", "x86_64-unknown-linux-ohos"]
targets = ["aarch64-unknown-linux-ohos", "armv7-unknown-linux-ohos", "x86_64-unknown-linux-ohos"]
all-features = true
26 changes: 23 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
# ohos-sys

FFI-bindings for the native API of OpenHarmony OS.
FFI-bindings for the native API of OpenHarmony OS. See the [documentation] for a list of supported components.
This crate is under active development, and not officially affiliated with OpenHarmony OS.

## Development

The current bindings are generated with `bindgen` using `scripts/generate_bindings.sh` with version
`4.0.10.13` of the OpenHarmony SDK.
The current bindings are generated with `bindgen` using `scripts/generate_bindings.sh`.
A separate file is generated for each API version, and (assuming no breaking changes) the new additions are
manually copied to an `apiXX_additions.rs` file, which is included as a module if `feature = api-XX` is selected.
The generated file `drawing_apiXX.rs` should be committed to version control, so we can easily rerun the script on a
patch-release for a given API-level and see what changed.
The file itself is however not needed, and will be excluded from `crates.io` releases.

# Contributing

There are still quite a few OpenHarmony APIs missing. Feel free to contribute missing APIs, but be sure to adapt
the script, so your bindings are reproducible!
Please also check the following:

- Ensure that opaque struct definitions do not derive `Copy`, `Clone` and `Debug`.
- Blocklist all unnecessary type definitions, e.g. from the C standard library.
- Preferably generate the bindings with libclang in `C` mode. However, if a header file is not C-compliant
due to an issue of the OpenHarmony SDK, then setting `libclang` to C++ mode is fine.
- Be sure to guard the new component behind a cargo feature and document the feature in Cargo.toml.
- If you did not generate the bindings with API-level 10, specify which API-level you generated the bindings with
and guard the generated module behind the corresponding api-level feature flag.

## License

This crate is licensed under the Apache-2.0 license, matching the OpenHarmony OS SDK.

[documentation]: https://docs.rs/ohos-sys/latest/ohos_sys/