Skip to content

Commit

Permalink
move MakeOptions blk out of makeFn definition site
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultra-Code committed Oct 3, 2024
1 parent 549e6f9 commit fa790d8
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ const builtin = @import("builtin");
const mem = std.mem;
const Build = std.Build;
const Step = Build.Step;
const MakeOptions = if (@hasDecl(Step, "MakeOptions"))
Step.MakeOptions
else
std.Progress.Node;

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

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

const test_step = b.step("test", "Run lmdb tests");
const run_create_testdb = struct {
fn makeFn(step: *Step, options: blk: {
if (@hasDecl(std.Build.Step, "MakeOptions")) {
break :blk std.Build.Step.MakeOptions;
} else {
break :blk std.Progress.Node;
}
}) !void {
fn makeFn(step: *Step, options: MakeOptions) !void {
_ = options;
const test_run = Step.cast(step, Step.Run).?;
const subpath = "testdb/";
Expand Down Expand Up @@ -195,13 +193,7 @@ pub fn build(b: *std.Build) void {

const install_test_subpath = "test/";
install_test_step.makeFn = struct {
fn makeFn(step: *std.Build.Step, options: blk: {
if (@hasDecl(std.Build.Step, "MakeOptions")) {
break :blk std.Build.Step.MakeOptions;
} else {
break :blk std.Progress.Node;
}
}) !void {
fn makeFn(step: *Step, options: MakeOptions) !void {
_ = options;
const step_build = step.owner;
std.fs.cwd().makeDir(step_build.fmt(
Expand Down

0 comments on commit fa790d8

Please sign in to comment.