| ... | @@ -29,7 +29,7 @@ const Package = @import("package.zig").Package; | ... | @@ -29,7 +29,7 @@ const Package = @import("package.zig").Package; |
| 29 | const link = @import("link.zig").link; | 29 | const link = @import("link.zig").link; |
| 30 | const LibCInstallation = @import("libc_installation.zig").LibCInstallation; | 30 | const LibCInstallation = @import("libc_installation.zig").LibCInstallation; |
| 31 | const CInt = @import("c_int.zig").CInt; | 31 | const CInt = @import("c_int.zig").CInt; |
| 32 | const fs = event.fs; | 32 | const fs = std.fs; |
| 33 | const util = @import("util.zig"); | 33 | const util = @import("util.zig"); |
| 34 | | 34 | |
| 35 | const max_src_size = 2 * 1024 * 1024 * 1024; // 2 GiB | 35 | const max_src_size = 2 * 1024 * 1024 * 1024; // 2 GiB |
| ... | @@ -442,7 +442,7 @@ pub const Compilation = struct { | ... | @@ -442,7 +442,7 @@ pub const Compilation = struct { |
| 442 | comp.name = try Buffer.init(comp.arena(), name); | 442 | comp.name = try Buffer.init(comp.arena(), name); |
| 443 | comp.llvm_triple = try util.getTriple(comp.arena(), target); | 443 | comp.llvm_triple = try util.getTriple(comp.arena(), target); |
| 444 | comp.llvm_target = try util.llvmTargetFromTriple(comp.llvm_triple); | 444 | comp.llvm_target = try util.llvmTargetFromTriple(comp.llvm_triple); |
| 445 | comp.zig_std_dir = try std.fs.path.join(comp.arena(), &[_][]const u8{ zig_lib_dir, "std" }); | 445 | comp.zig_std_dir = try fs.path.join(comp.arena(), &[_][]const u8{ zig_lib_dir, "std" }); |
| 446 | | 446 | |
| 447 | const opt_level = switch (build_mode) { | 447 | const opt_level = switch (build_mode) { |
| 448 | .Debug => llvm.CodeGenLevelNone, | 448 | .Debug => llvm.CodeGenLevelNone, |
| ... | @@ -488,8 +488,8 @@ pub const Compilation = struct { | ... | @@ -488,8 +488,8 @@ pub const Compilation = struct { |
| 488 | defer comp.events.deinit(); | 488 | defer comp.events.deinit(); |
| 489 | | 489 | |
| 490 | if (root_src_path) |root_src| { | 490 | if (root_src_path) |root_src| { |
| 491 | const dirname = std.fs.path.dirname(root_src) orelse "."; | 491 | const dirname = fs.path.dirname(root_src) orelse "."; |
| 492 | const basename = std.fs.path.basename(root_src); | 492 | const basename = fs.path.basename(root_src); |
| 493 | | 493 | |
| 494 | comp.root_package = try Package.create(comp.arena(), dirname, basename); | 494 | comp.root_package = try Package.create(comp.arena(), dirname, basename); |
| 495 | comp.std_package = try Package.create(comp.arena(), comp.zig_std_dir, "std.zig"); | 495 | comp.std_package = try Package.create(comp.arena(), comp.zig_std_dir, "std.zig"); |
| ... | @@ -521,7 +521,7 @@ pub const Compilation = struct { | ... | @@ -521,7 +521,7 @@ pub const Compilation = struct { |
| 521 | if (comp.tmp_dir.getOrNull()) |tmp_dir_result| | 521 | if (comp.tmp_dir.getOrNull()) |tmp_dir_result| |
| 522 | if (tmp_dir_result.*) |tmp_dir| { | 522 | if (tmp_dir_result.*) |tmp_dir| { |
| 523 | // TODO evented I/O? | 523 | // TODO evented I/O? |
| 524 | std.fs.deleteTree(tmp_dir) catch {}; | 524 | fs.deleteTree(tmp_dir) catch {}; |
| 525 | } else |_| {}; | 525 | } else |_| {}; |
| 526 | } | 526 | } |
| 527 | | 527 | |
| ... | @@ -797,7 +797,7 @@ pub const Compilation = struct { | ... | @@ -797,7 +797,7 @@ pub const Compilation = struct { |
| 797 | | 797 | |
| 798 | async fn rebuildFile(self: *Compilation, root_scope: *Scope.Root) BuildError!void { | 798 | async fn rebuildFile(self: *Compilation, root_scope: *Scope.Root) BuildError!void { |
| 799 | const tree_scope = blk: { | 799 | const tree_scope = blk: { |
| 800 | const source_code = fs.readFile( | 800 | const source_code = fs.cwd().readFileAlloc( |
| 801 | self.gpa(), | 801 | self.gpa(), |
| 802 | root_scope.realpath, | 802 | root_scope.realpath, |
| 803 | max_src_size, | 803 | max_src_size, |
| ... | @@ -935,8 +935,8 @@ pub const Compilation = struct { | ... | @@ -935,8 +935,8 @@ pub const Compilation = struct { |
| 935 | fn initialCompile(self: *Compilation) !void { | 935 | fn initialCompile(self: *Compilation) !void { |
| 936 | if (self.root_src_path) |root_src_path| { | 936 | if (self.root_src_path) |root_src_path| { |
| 937 | const root_scope = blk: { | 937 | const root_scope = blk: { |
| 938 | // TODO async/await std.fs.realpath | 938 | // TODO async/await fs.realpath |
| 939 | const root_src_real_path = std.fs.realpathAlloc(self.gpa(), root_src_path) catch |err| { | 939 | const root_src_real_path = fs.realpathAlloc(self.gpa(), root_src_path) catch |err| { |
| 940 | try self.addCompileErrorCli(root_src_path, "unable to open: {}", .{@errorName(err)}); | 940 | try self.addCompileErrorCli(root_src_path, "unable to open: {}", .{@errorName(err)}); |
| 941 | return; | 941 | return; |
| 942 | }; | 942 | }; |
| ... | @@ -1157,7 +1157,7 @@ pub const Compilation = struct { | ... | @@ -1157,7 +1157,7 @@ pub const Compilation = struct { |
| 1157 | const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", .{ file_prefix[0..], suffix }); | 1157 | const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", .{ file_prefix[0..], suffix }); |
| 1158 | defer self.gpa().free(file_name); | 1158 | defer self.gpa().free(file_name); |
| 1159 | | 1159 | |
| 1160 | const full_path = try std.fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] }); | 1160 | const full_path = try fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] }); |
| 1161 | errdefer self.gpa().free(full_path); | 1161 | errdefer self.gpa().free(full_path); |
| 1162 | | 1162 | |
| 1163 | return Buffer.fromOwnedSlice(self.gpa(), full_path); | 1163 | return Buffer.fromOwnedSlice(self.gpa(), full_path); |
| ... | @@ -1178,8 +1178,8 @@ pub const Compilation = struct { | ... | @@ -1178,8 +1178,8 @@ pub const Compilation = struct { |
| 1178 | const zig_dir_path = try getZigDir(self.gpa()); | 1178 | const zig_dir_path = try getZigDir(self.gpa()); |
| 1179 | defer self.gpa().free(zig_dir_path); | 1179 | defer self.gpa().free(zig_dir_path); |
| 1180 | | 1180 | |
| 1181 | const tmp_dir = try std.fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] }); | 1181 | const tmp_dir = try fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] }); |
| 1182 | try std.fs.makePath(self.gpa(), tmp_dir); | 1182 | try fs.makePath(self.gpa(), tmp_dir); |
| 1183 | return tmp_dir; | 1183 | return tmp_dir; |
| 1184 | } | 1184 | } |
| 1185 | | 1185 | |
| ... | @@ -1351,7 +1351,7 @@ async fn addFnToLinkSet(comp: *Compilation, fn_val: *Value.Fn) Compilation.Build | ... | @@ -1351,7 +1351,7 @@ async fn addFnToLinkSet(comp: *Compilation, fn_val: *Value.Fn) Compilation.Build |
| 1351 | } | 1351 | } |
| 1352 | | 1352 | |
| 1353 | fn getZigDir(allocator: *mem.Allocator) ![]u8 { | 1353 | fn getZigDir(allocator: *mem.Allocator) ![]u8 { |
| 1354 | return std.fs.getAppDataDir(allocator, "zig"); | 1354 | return fs.getAppDataDir(allocator, "zig"); |
| 1355 | } | 1355 | } |
| 1356 | | 1356 | |
| 1357 | fn analyzeFnType( | 1357 | fn analyzeFnType( |