aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authordelta <darkussdelta@gmail.com>2025-08-26 00:57:02 +0200
committerdelta <darkussdelta@gmail.com>2025-08-26 00:58:09 +0200
commitcfd14e880023752bffe9a01d1781b54ceefa32ec (patch)
treecaf8bf8ef7cb966c9d06776bb75d02d11fe7eda7 /build.rs
initial commit
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..fbb4ade
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,21 @@
+use std::{
+ 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 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();
+
+ let output = child.wait_with_output().expect("Failed to read stdout");
+ write(PathBuf::from(format!("{}/_parsers.rs", var("OUT_DIR").unwrap())), output.stdout).unwrap();
+}