| Crates.io | android_bp |
| lib.rs | android_bp |
| version | 0.3.1 |
| created_at | 2023-12-29 20:35:36.314309+00 |
| updated_at | 2025-12-01 19:21:52.256013+00 |
| description | Android.bp parser |
| homepage | https://github.com/tardyp/rs-bp |
| repository | https://github.com/tardyp/rs-bp |
| max_upload_size | |
| id | 1083614 |
| size | 65,148 |
a rust crate to parse Android.bp files
use android_bp::BluePrint;
let bp = BluePrint::from_file("fixtures/example.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);
}
The project parses successfully all the Android.bp files in the AOSP tree. Test files are present in the src/test_db.tar.xz archive.
different possible values are abstracted in the Value enum
modules (module { ... })
variables (var = "value")
variables extend (var += [ "new value" ])
expressions (var : "value" + \n"value"), used for strings long enough to be split in multiple lines