aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authordelta <darkussdelta@gmail.com>2025-08-26 04:25:15 +0200
committerdelta <darkussdelta@gmail.com>2025-08-26 04:25:15 +0200
commit7d0c2f4617bc0119e748f59e0a6bd8da79494087 (patch)
tree9c13646ee48fe2d1293c3bcc2898443bf445e252 /build.rs
parentaced62ade1363ae031114302ec69dbc7f6f38a10 (diff)
refactor to use a file for code input
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs39
1 files changed, 33 insertions, 6 deletions
diff --git a/build.rs b/build.rs
index fbb4ade..a402549 100644
--- a/build.rs
+++ b/build.rs
@@ -1,21 +1,48 @@
use std::{
- env::var, fs::{read, write}, io::Write, path::{Path, PathBuf}, process::{
+ env::var,
+ fs::{
+ read,
+ write,
+ },
+ io::Write,
+ path::{
+ Path,
+ PathBuf,
+ },
+ process::{
Command,
Stdio,
- }
+ },
};
fn main() {
println!("test");
println!("cargo::rerun-if-changed=nvim-treesitter/lua/nvim-treesitter/parsers.lua");
println!("cargo::rerun-if-changed=generate_parsers.lua");
- let mut child = Command::new("lua").arg("generate_parsers.lua").stdin(Stdio::piped()).stdout(Stdio::piped()).spawn().expect("Failed to spawn process");
+ let mut child = Command::new("lua")
+ .arg("generate_parsers.lua")
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .spawn()
+ .expect("Failed to spawn process");
let mut stdin = child.stdin.take().expect("Failed to open stdin");
std::thread::spawn(move || {
- stdin.write_all(read(Path::new("nvim-treesitter/lua/nvim-treesitter/parsers.lua")).expect("Failed to create parsers path").as_ref()).expect("Failed to write to stdin");
- }).join().unwrap();
+ stdin
+ .write_all(
+ read(Path::new("nvim-treesitter/lua/nvim-treesitter/parsers.lua"))
+ .expect("Failed to create parsers path")
+ .as_ref(),
+ )
+ .expect("Failed to write to stdin");
+ })
+ .join()
+ .unwrap();
let output = child.wait_with_output().expect("Failed to read stdout");
- write(PathBuf::from(format!("{}/_parsers.rs", var("OUT_DIR").unwrap())), output.stdout).unwrap();
+ write(
+ PathBuf::from(format!("{}/_parsers.rs", var("OUT_DIR").unwrap())),
+ output.stdout,
+ )
+ .unwrap();
}