aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-07 12:30:16 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-07 12:30:16 -0500
commit3fce8008cc1303cb3a8ed6c2c48cbebc81dadaa8 (patch)
tree4695f875212d2e9d9a4e2ab5444055c0383af4d7 /src-self-hosted
parent7f4cce3345baab10ff51e898c3810ee58e6bd88b (diff)
downloadzig-3fce8008cc1303cb3a8ed6c2c48cbebc81dadaa8.tar.gz
zig-3fce8008cc1303cb3a8ed6c2c48cbebc81dadaa8.zip
skip self-hosted for now as we work towards async I/O
1. behavior tests with --test-evented-io 2. std lib tests with --test-evented-io 3. fuzz test evented I/O a bit, make it robust 4. make sure it works on all platforms (kqueue, Windows IOCP, epoll/other) 5. restart efforts on self-hosted
Diffstat (limited to 'src-self-hosted')
-rw-r--r--src-self-hosted/compilation.zig24
-rw-r--r--src-self-hosted/introspect.zig2
-rw-r--r--src-self-hosted/main.zig2
3 files changed, 14 insertions, 14 deletions
diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig
index 0f455fadcd..15453fabcc 100644
--- a/src-self-hosted/compilation.zig
+++ b/src-self-hosted/compilation.zig
@@ -29,7 +29,7 @@ const Package = @import("package.zig").Package;
const link = @import("link.zig").link;
const LibCInstallation = @import("libc_installation.zig").LibCInstallation;
const CInt = @import("c_int.zig").CInt;
-const fs = event.fs;
+const fs = std.fs;
const util = @import("util.zig");
const max_src_size = 2 * 1024 * 1024 * 1024; // 2 GiB
@@ -442,7 +442,7 @@ pub const Compilation = struct {
comp.name = try Buffer.init(comp.arena(), name);
comp.llvm_triple = try util.getTriple(comp.arena(), target);
comp.llvm_target = try util.llvmTargetFromTriple(comp.llvm_triple);
- comp.zig_std_dir = try std.fs.path.join(comp.arena(), &[_][]const u8{ zig_lib_dir, "std" });
+ comp.zig_std_dir = try fs.path.join(comp.arena(), &[_][]const u8{ zig_lib_dir, "std" });
const opt_level = switch (build_mode) {
.Debug => llvm.CodeGenLevelNone,
@@ -488,8 +488,8 @@ pub const Compilation = struct {
defer comp.events.deinit();
if (root_src_path) |root_src| {
- const dirname = std.fs.path.dirname(root_src) orelse ".";
- const basename = std.fs.path.basename(root_src);
+ const dirname = fs.path.dirname(root_src) orelse ".";
+ const basename = fs.path.basename(root_src);
comp.root_package = try Package.create(comp.arena(), dirname, basename);
comp.std_package = try Package.create(comp.arena(), comp.zig_std_dir, "std.zig");
@@ -521,7 +521,7 @@ pub const Compilation = struct {
if (comp.tmp_dir.getOrNull()) |tmp_dir_result|
if (tmp_dir_result.*) |tmp_dir| {
// TODO evented I/O?
- std.fs.deleteTree(tmp_dir) catch {};
+ fs.deleteTree(tmp_dir) catch {};
} else |_| {};
}
@@ -797,7 +797,7 @@ pub const Compilation = struct {
async fn rebuildFile(self: *Compilation, root_scope: *Scope.Root) BuildError!void {
const tree_scope = blk: {
- const source_code = fs.readFile(
+ const source_code = fs.cwd().readFileAlloc(
self.gpa(),
root_scope.realpath,
max_src_size,
@@ -935,8 +935,8 @@ pub const Compilation = struct {
fn initialCompile(self: *Compilation) !void {
if (self.root_src_path) |root_src_path| {
const root_scope = blk: {
- // TODO async/await std.fs.realpath
- const root_src_real_path = std.fs.realpathAlloc(self.gpa(), root_src_path) catch |err| {
+ // TODO async/await fs.realpath
+ const root_src_real_path = fs.realpathAlloc(self.gpa(), root_src_path) catch |err| {
try self.addCompileErrorCli(root_src_path, "unable to open: {}", .{@errorName(err)});
return;
};
@@ -1157,7 +1157,7 @@ pub const Compilation = struct {
const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", .{ file_prefix[0..], suffix });
defer self.gpa().free(file_name);
- const full_path = try std.fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] });
+ const full_path = try fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] });
errdefer self.gpa().free(full_path);
return Buffer.fromOwnedSlice(self.gpa(), full_path);
@@ -1178,8 +1178,8 @@ pub const Compilation = struct {
const zig_dir_path = try getZigDir(self.gpa());
defer self.gpa().free(zig_dir_path);
- const tmp_dir = try std.fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] });
- try std.fs.makePath(self.gpa(), tmp_dir);
+ const tmp_dir = try fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] });
+ try fs.makePath(self.gpa(), tmp_dir);
return tmp_dir;
}
@@ -1351,7 +1351,7 @@ async fn addFnToLinkSet(comp: *Compilation, fn_val: *Value.Fn) Compilation.Build
}
fn getZigDir(allocator: *mem.Allocator) ![]u8 {
- return std.fs.getAppDataDir(allocator, "zig");
+ return fs.getAppDataDir(allocator, "zig");
}
fn analyzeFnType(
diff --git a/src-self-hosted/introspect.zig b/src-self-hosted/introspect.zig
index 67181b40a8..3cf18ab363 100644
--- a/src-self-hosted/introspect.zig
+++ b/src-self-hosted/introspect.zig
@@ -14,7 +14,7 @@ pub fn testZigInstallPrefix(allocator: *mem.Allocator, test_path: []const u8) ![
const test_index_file = try fs.path.join(allocator, &[_][]const u8{ test_zig_dir, "std", "std.zig" });
defer allocator.free(test_index_file);
- var file = try fs.File.openRead(test_index_file);
+ var file = try fs.cwd().openRead(test_index_file);
file.close();
return test_zig_dir;
diff --git a/src-self-hosted/main.zig b/src-self-hosted/main.zig
index fc0825f3db..fbfd1e2642 100644
--- a/src-self-hosted/main.zig
+++ b/src-self-hosted/main.zig
@@ -724,7 +724,7 @@ async fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtErro
if (try held.value.put(file_path, {})) |_| return;
}
- const source_code = event.fs.readFile(
+ const source_code = fs.cwd().readFileAlloc(
fmt.allocator,
file_path,
max_src_size,