4 releases (2 breaking)

0.3.0 Jun 9, 2024
0.2.1 Jun 8, 2024
0.2.0 Dec 29, 2023
0.1.0 Dec 29, 2023

#1017 in Parser implementations

24 downloads per month

MIT license

43KB
1K SLoC

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);
    }

Dependencies

~1MB
~19K SLoC