https://github.com/sztomi/ninja_syntax
A Rust port of ninja_syntax.py
https://github.com/sztomi/ninja_syntax
Last synced: 2 months ago
JSON representation
A Rust port of ninja_syntax.py
- Host: GitHub
- URL: https://github.com/sztomi/ninja_syntax
- Owner: sztomi
- License: mit
- Created: 2023-07-08T13:44:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-08T15:05:12.000Z (almost 2 years ago)
- Last Synced: 2025-01-28T13:52:35.310Z (4 months ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ninja_syntax
This is a port of ninja_syntax.py to Rust. It allows you to easily emit ninja build files from
Rust with a syntax that is pretty similar to the official python module from the ninja repo.## Example
```rust
use ninja_syntax::*;
use std::path::Path;fn main() {
let mut nw = NinjaWriter(Path::new("build.ninja"));
nw.comment("Hello this is a comment");
nw.newline();let rule = NinjaRule::new("cc", "cc $in -o $out");
nw.rule(&rule);let mut build = NinjaBuild::new(&["test.o"], "cc");
build.inputs(&["test.c"]);
nw.build(&build);// write the file to disk
nw.close().unwrap();
}
```## Acknowledgements
Originally written by [Tobias Hieta][1], forked and licensed under MIT (with permission from the
author) by Tamás Szelei. Most of the code is the same, but slight changes were made to make it more
ergonomic and to use `textwrap` instead of a custom implementation of word wrapping. Finally, to
apply the *correct* indentation (which is two spaces). Originally part of [sa_ninja_gen][2], now
being published as a separate crate.[1]: https://github.com/tru/ninja-syntax
[2]: https://github.com/sztomi/sa_ninja_gen/tree/main