application-services/components/crashtest
Ben Dean-Kawamura eb1f268654 Build improvements with UniFFI library mode
Bumped UniFFI to 0.28.2

Added a tool to run uniffi-bindgen in library mode.  It can input either
a specific library path or the megazord crate name.

Use that simplify several build scripts -- especially the generate docs
ones.  The best part of this is that we no longer have to maintain
hand-written modulemaps, which makes adding a new component harder than
it needs to be.

Split out the uniffi-bindgen commands from `build-xcframework.sh`.  This
way you can run them standalone and see the results, even if you don't
have XCode setup.

One change is that
automation/swift-components-docs/generate-swift-project.sh now uses
`megazord_ios` rather than `megazord`.  I think this should result in
slightly more accurate docs, since historically some components in the
Android megazord aren't in the iOS one (Although, I think they match at
the present).
2024-10-17 17:59:42 +00:00
..
android Switch to UniFFI library mode 2024-09-18 20:31:35 +00:00
src fix: add proper Rust doc comments to UDL files 2024-09-16 07:42:17 +00:00
Cargo.toml Use uniffi as a workspace dependency 2023-12-15 18:32:25 +00:00
README.md Merge ios and ios-rust directories and clean up Xcode project (#4830) 2022-03-03 10:03:32 -10:00
build.rs Updating UniFFI to version 0.23 2023-01-27 12:38:55 -05:00
uniffi.toml Build improvements with UniFFI library mode 2024-10-17 17:59:42 +00:00

README.md

Crash Testing Helper APIs

This is a little helper component to make it easier to debug issues with crash reporting, by letting you deliberately crash a consuming app.

Features

The Crash Testing Helper APIs let you deliberately crash your application in a variety of ways:

  1. By triggering a hard abort inside the Rust code of the component, which should surface as a crash of the application.
  2. By triggering a panic inside the Rust code of the component, which should surface as an "internal error" exception to the calling code.

The component does not offer any support for crash reporting, debugging etc itself, it's just designed to let you more easily test those things in your application.

Using the Crash Testing Helper APIs

Before using this component

This component does not currently integrate with the Glean SDK and does not submit any telemetry, so you do not need to request a data-review before using this component.

Prerequisites

To use this component, you should be familiar with how to integrate application-services components into an application on your target platform:

  • Android: Add the mozilla.appservices.crashtest package as a gradle dependency, but make sure you're using the same version of application-services as used by Android Components.
  • iOS: start with the guide to consuming rust components on iOS.
  • Other Platforms: we don't know yet; please reach out on slack to discuss!

Component API

For details on how to use this component, consult the public interface definition or view the generated Rust API documentation by running:

cargo doc --no-deps --open

Working on the Crash Testing Helper APIs

Prerequisites

To effectively work on the Crash Testing Helper APIs, you will need to be familiar with:

Overview

This component uses uniffi-rs to create its public API surface in Rust, and then generate bindings for Kotlin and Swift. The code is organized as follows:

  • The public API surface is implemented in ./src/lib.rs, with matching declarations in ./src/crashtest.udl to define how it gets exposed to other languages.
  • The ./android/ directory contains android-specific build scripts that generate Kotlin wrappers and publish them as an AAR, and some Android tests.
  • The ./ios/ directory is a placeholder for generated Swift code. There are a couple of Swift tests in /megazords/ios-rust/MozillaTestServicesTests/CrashTestTests.swift.

Detailed Docs

We use rustdoc to document both the public API of this component and its various internal implementation details. View the docs by running:

cargo doc --no-deps --document-private-items --open