zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ece1d1daf476fdffc69279c686ad1e2101ce6e4d (tree)
parent 02acde99a142e89c30d0e49cc703d0ad80ea31b7
Author: Veikka Tuominen <git@vexu.eu>
Date:   Wed, 20 Jul 2022 16:39:13 +0300

CLI: add error for duplicate package

Diffstat:
Msrc/main.zig | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/main.zig b/src/main.zig @@ -858,6 +858,12 @@ fn buildOutputType( ) catch |err| { fatal("Failed to add package at path {s}: {s}", .{ pkg_path.?, @errorName(err) }); }; + + if (mem.eql(u8, pkg_name.?, "std") or mem.eql(u8, pkg_name.?, "root") or mem.eql(u8, pkg_name.?, "builtin")) { + fatal("unable to add package '{s}' -> '{s}': conflicts with builtin package", .{ pkg_name.?, pkg_path.? }); + } else if (cur_pkg.table.get(pkg_name.?)) |prev| { + fatal("unable to add package '{s}' -> '{s}': already exists as '{s}", .{ pkg_name.?, pkg_path.?, prev.root_src_path }); + } try cur_pkg.addAndAdopt(gpa, pkg_name.?, new_cur_pkg); cur_pkg = new_cur_pkg; } else if (mem.eql(u8, arg, "--pkg-end")) {