we have tested on
#
# - rustc 1.89.0-nightly (e703dff8f 2025-06-11)
# - cargo-llvm-cov v0.6.10
# or
# - rustc 1.91.0 (f8297e351 2025-10-28)
# - cargo-llvm-cov v0.6.21
# run `rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu` to install the `llvm-tools-preview`Some additional packages are required:
sudo apt install -y jq
cargo install tokeiaadl.pest解析aadl源文件(/AADLSource/*.aadl案例)。
transform.rs将解析后的pairs结构 -> 自定义的AST(ast.rs)中。
converter.rs支持aadl_ast -> 轻量级rust_ast(intermediate_ast.rs):
/implementations、/types文件夹下的conv_*.rs文件,按AADL组件的分类,分别对相应的组件进行转换。
collector.rs:在转换开始前/结束后对aadl_ast进行一些扫描,获取信息。
intermediate_print.rs打印rust代码(存储在/generate/)。
model_statistics.rs使用pest解析的结果,统计AADL模型中各类型组件的数量,每次执行代码生成时被调用。结果在\generate\statistics\目录下。
cd compiler
make cov
# see readme from compiler/generate_test
# check `/aadl2rust/compiler/target/llvm-cov/html/index.html` for the whole coverage reportcd compiler
cargo test #run all test cases.
just cov-html # generate an HTML coverage report.
#output file: "\compiler\target\llvm-cov\html\index.html"
cargo run -- --input <folder_name> # run a single caseTo count effective lines of AADL code (excluding blank lines and comments) for each case under AADLSource/:
chmod +x scripts/aadl_loc_by_folder_csv.sh
./scripts/aadl_loc_by_folder_csv.sh # output file:AADLSource/aadl_code_loc_by_folder.csvTo count effective lines of Rust code for each generated project under generate/project/:
chmod +x scripts/rust_loc_by_project_csv.sh
./scripts/rust_loc_by_project_csv.sh
#output file :generate/project_rust_code_loc_by_folder.csv