Skip to content

Commit 603946c

Browse files
Nemo157syphar
authored andcommitted
If syntax submodules don't exist at all, initialize them
1 parent a0ff6c1 commit 603946c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ fn compile_syntax(out_dir: &Path) -> Result<()> {
191191
parsing::{SyntaxDefinition, SyntaxSetBuilder},
192192
};
193193

194+
if std::fs::metadata("assets/syntaxes").is_err() {
195+
let status = std::process::Command::new("git")
196+
.args(["submodule", "update", "--init"])
197+
.status()
198+
.context("attempting to initialize submodules")?;
199+
if !status.success() {
200+
return Err(anyhow::anyhow!("initializing submodules failed"));
201+
}
202+
}
203+
194204
fn tracked_add_from_folder(
195205
builder: &mut SyntaxSetBuilder,
196206
path: impl AsRef<Path>,

0 commit comments

Comments
 (0)