4 个版本 (2 个重大更改)
0.3.0 | 2024 年 6 月 9 日 |
---|---|
0.2.1 | 2024 年 6 月 8 日 |
0.2.0 | 2023 年 12 月 29 日 |
0.1.0 | 2023 年 12 月 29 日 |
#778 在 解析器实现
每月 202 次下载
43KB
1K SLoC
android-bp
一个用于解析 Android.bp 文件的 Rust crate
使用方法
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);
}
依赖关系
~1MB
~19K SLoC