1 unstable release
0.1.0 | Oct 31, 2021 |
---|
#1816 in Procedural macros
4,074 downloads per month
20KB
494 lines
srcfiles
A tool for searching source files used to compile a Rust crate.
Usage
srcfiles path/to/root.rs
Prints best-effort representation of all .rs and include!
files used to compile a crate (currently only with debug output)
lib.rs
:
Extract list of source files for Rust crate
This crate will attempt to generate a list of source files for a given Rust crate. It does not compile the crate, and so does not require any of the crate's dependencies to be compiled.
For example, this is useful for generating a list of source files as dependencies for a non-Cargo build system.
There are a number of limitations with this:
- Only works on Rust 2018 code (TODO: check 2021)
- Will not file source files which are hidden by a macro or proc-macro
- Will be confused by conditional includes
There is some specific support for the cfg_if
macro.
Example
let result = srcfiles::crate_srcfiles("test_projects/simple/src/main.rs").unwrap_err();
let srcfiles = result.get_sources();
let errors = result.into_errors();
assert_eq!(srcfiles.len(), 7);
Dependencies
~1.5MB
~37K SLoC