gpu-dawn: add NO_ENSURE_SUBMODULES=true env var for development

If you're working on changes to source files in `gpu-dawn/libs/dawn/`,
it's annoying to have the build system constantly reset your revision to
the desired one.

`NO_ENSURE_SUBMODULES=true` will now disable this behavior.

Helps hexops/mach#86

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-02-20 16:27:42 -07:00 committed by Stephen Gutekanst
parent 1bc6a7e829
commit 69b2551378

View file

@ -177,6 +177,9 @@ fn linkFromSource(b: *Builder, step: *std.build.LibExeObjStep, options: Options)
}
fn ensureSubmodules(allocator: std.mem.Allocator) !void {
if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| {
if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
} else |_| {}
const child = try std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", "--recursive" }, allocator);
child.cwd = thisDir();
child.stderr = std.io.getStdErr();