Skip to content

Commit

Permalink
Fixed the other build scripts, parsecheck.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgschultz committed Apr 29, 2024
1 parent 5b3b4d4 commit 9233999
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
8 changes: 4 additions & 4 deletions examples/fib/build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Builder = @import("std").build.Builder;
const Build = @import("std").Build;

pub fn build(b: *Builder) void {
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand All @@ -10,8 +10,8 @@ pub fn build(b: *Builder) void {
.target = target,
.optimize = optimize,
});
exe.addAnonymousModule("zware", .{
.source_file = .{ .path = "../../src/main.zig" },
exe.root_module.addAnonymousImport("zware", .{
.root_source_file = .{ .path = "../../src/main.zig" },
});
b.installArtifact(exe);

Expand Down
8 changes: 4 additions & 4 deletions test/interface/build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Builder = @import("std").build.Builder;
const Build = @import("std").Build;

pub fn build(b: *Builder) void {
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand All @@ -10,8 +10,8 @@ pub fn build(b: *Builder) void {
.target = target,
.optimize = optimize,
});
exe.addAnonymousModule("zware", .{
.source_file = .{ .path = "../../src/main.zig" },
exe.root_module.addAnonymousImport("zware", .{
.root_source_file = .{ .path = "../../src/main.zig" },
});
b.installArtifact(exe);

Expand Down
8 changes: 4 additions & 4 deletions test/parsecheck/build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Builder = @import("std").build.Builder;
const Build = @import("std").Build;

pub fn build(b: *Builder) void {
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand All @@ -10,8 +10,8 @@ pub fn build(b: *Builder) void {
.target = target,
.optimize = optimize,
});
exe.addAnonymousModule("zware", .{
.source_file = .{ .path = "../../src/main.zig" },
exe.root_module.addAnonymousImport("zware", .{
.root_source_file = .{ .path = "../../src/main.zig" },
});
b.installArtifact(exe);

Expand Down
20 changes: 15 additions & 5 deletions test/parsecheck/src/parsecheck.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ const GeneralPurposeAllocator = std.heap.GeneralPurposeAllocator;
const ArenaAllocator = std.heap.ArenaAllocator;
var gpa = GeneralPurposeAllocator(.{}){};

const native_os = @import("builtin").os.tag;

pub fn main() !void {
var args = process.args();
defer _ = gpa.deinit();

var args = switch (native_os) {
.windows, .wasi => try process.ArgIterator.initWithAllocator(gpa.allocator()),
else => process.ArgIterator.init(),
};
defer args.deinit();

_ = args.skip();
const directory = args.next() orelse return error.NoFilename;

defer _ = gpa.deinit();

var wasm_files = ArrayList([]const u8).init(gpa.allocator());
defer wasm_files.deinit();

var dir = try std.fs.cwd().openIterableDir(directory, .{});
var dir = try std.fs.cwd().openDir(directory, .{
.no_follow = true,
.iterate = true,
});
defer dir.close();

var it = dir.iterate();
Expand All @@ -36,7 +46,7 @@ pub fn main() !void {
defer _ = arena.deinit();
const alloc = arena.allocator();

const program = try dir.dir.readFileAlloc(alloc, entry.name, 0xFFFFFFF);
const program = try dir.readFileAlloc(alloc, entry.name, 0xFFFFFFF);
if (program.len == 0) continue;

var store: Store = Store.init(alloc);
Expand Down
8 changes: 4 additions & 4 deletions tools/zware-gen/build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Builder = @import("std").build.Builder;
const Build = @import("std").Build;

pub fn build(b: *Builder) void {
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand All @@ -10,8 +10,8 @@ pub fn build(b: *Builder) void {
.target = target,
.optimize = optimize,
});
exe.addAnonymousModule("zware", .{
.source_file = .{ .path = "../../src/main.zig" },
exe.root_module.addAnonymousImport("zware", .{
.root_source_file = .{ .path = "../../src/main.zig" },
});
b.installArtifact(exe);

Expand Down

0 comments on commit 9233999

Please sign in to comment.