Skip to content

Commit fa790d8

Browse files
committed
move MakeOptions blk out of makeFn definition site
1 parent 549e6f9 commit fa790d8

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

build.zig

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ const builtin = @import("builtin");
33
const mem = std.mem;
44
const Build = std.Build;
55
const Step = Build.Step;
6+
const MakeOptions = if (@hasDecl(Step, "MakeOptions"))
7+
Step.MakeOptions
8+
else
9+
std.Progress.Node;
610

7-
pub fn build(b: *std.Build) void {
11+
pub fn build(b: *Build) void {
812
if (comptime !checkVersion())
913
@compileError("Update your zig toolchain to >= 0.13.0");
1014

@@ -156,13 +160,7 @@ pub fn build(b: *std.Build) void {
156160

157161
const test_step = b.step("test", "Run lmdb tests");
158162
const run_create_testdb = struct {
159-
fn makeFn(step: *Step, options: blk: {
160-
if (@hasDecl(std.Build.Step, "MakeOptions")) {
161-
break :blk std.Build.Step.MakeOptions;
162-
} else {
163-
break :blk std.Progress.Node;
164-
}
165-
}) !void {
163+
fn makeFn(step: *Step, options: MakeOptions) !void {
166164
_ = options;
167165
const test_run = Step.cast(step, Step.Run).?;
168166
const subpath = "testdb/";
@@ -195,13 +193,7 @@ pub fn build(b: *std.Build) void {
195193

196194
const install_test_subpath = "test/";
197195
install_test_step.makeFn = struct {
198-
fn makeFn(step: *std.Build.Step, options: blk: {
199-
if (@hasDecl(std.Build.Step, "MakeOptions")) {
200-
break :blk std.Build.Step.MakeOptions;
201-
} else {
202-
break :blk std.Progress.Node;
203-
}
204-
}) !void {
196+
fn makeFn(step: *Step, options: MakeOptions) !void {
205197
_ = options;
206198
const step_build = step.owner;
207199
std.fs.cwd().makeDir(step_build.fmt(

0 commit comments

Comments
 (0)