android_bp

Crates.ioandroid_bp
lib.rsandroid_bp
version0.3.0
sourcesrc
created_at2023-12-29 20:35:36.314309
updated_at2024-06-09 16:28:41.09941
descriptionAndroid.bp parser
homepagehttps://github.com/tardyp/rs-bp
repositoryhttps://github.com/tardyp/rs-bp
max_upload_size
id1083614
size56,793
Pierre Tardy (tardyp)

documentation

README

android-bp

a rust crate to parse Android.bp files

Usage

    use android_bp::BluePrint;

    let bp = BluePrint::from_file("fixtures/Android.bp").unwrap();
    println!("{:#?}", bp);

    // variables are accessible as a rust HashMap
    println!("{:#?}", bp.variables);
    for m in &bp.modules {
        if m.typ == "rust_binary" {
            println!("{:?}", m.get("name").unwrap());
        }
    }
    // or iter them by type
    for m in bp.modules_by_type("rust_host_test") {
        // m.get return an sometime inconvenient Option<&Value>
        // so some helper methods are provided
        let name = m.get_string("name").unwrap();
        let srcs = m.get_array("srcs").unwrap();
        println!("{:?} {:?}", name, srcs);
    }
Commit count: 41

cargo fmt