launcher is a system to combine several programs into a single binary, to save memory and disk space. Each program can be written in its own directory and run independently.
The Fuchsia operating system will maintain one VMO containing the
launcher binary image, and will serve that VMO to each package which uses one of the programs that were combined to make the
This project should be automatically included in builds by including any project that uses it.
To convert a program to use
launcher, you will build a library instead of a binary; include the library in the
launcher binary; link to the
launcher binary from the component that used to use your program's binary; and adjust your .cml files slightly.
In your program's directory:
arghcommand-line arg struct, for example
pub struct CommandLine. (If you don't use command line args, add an empty struct with
#[derive(FromArgs, Debug, PartialEq)].)
#[argh(subcommand, name = "your-choice")].
pub const PROGRAM_NAME: &str = "your-choice";
mainfuntion with this signature:
pub async fn main(args: CommandLine) -> Result<(), Error>
#[fasync::run_singlethreaded]or similar lines.
rustc_lib, and replace
CommandLinestruct to the
ChildArgsenum in main.rs
PROGRAM_NAMEto the first
mainfrom the second
To invoke a program that has been integrated in
"//src/diagnostics/launcher:bin"instead of the original binary.
your-choicein this example) to the .cml file as the first
launcher will be integration-tested by every program that uses it. No unit tests are currently contemplated.