| ... | @@ -116,9 +116,13 @@ pub const CliModule = struct { | ... | @@ -116,9 +116,13 @@ pub const CliModule = struct { |
| 116 | | 116 | |
| 117 | fn lower(cm: *const CliModule, arena: Allocator, gpa: Allocator, argv: *std.ArrayList([]const u8)) !void { | 117 | fn lower(cm: *const CliModule, arena: Allocator, gpa: Allocator, argv: *std.ArrayList([]const u8)) !void { |
| 118 | try argv.ensureUnusedCapacity(gpa, 2 * cm.deps.count() + 1); | 118 | try argv.ensureUnusedCapacity(gpa, 2 * cm.deps.count() + 1); |
| 119 | for (cm.deps.values()) |dep| { | 119 | for (cm.deps.keys(), cm.deps.values()) |name, dep| { |
| 120 | argv.appendAssumeCapacity("--dep"); | 120 | argv.appendAssumeCapacity("--dep"); |
| 121 | argv.appendAssumeCapacity(dep.name); | 121 | if (mem.eql(u8, name, dep.name)) { |
| | 122 | argv.appendAssumeCapacity(dep.name); |
| | 123 | } else { |
| | 124 | argv.appendAssumeCapacity(try allocPrint(arena, "{s}={s}", .{ name, dep.name })); |
| | 125 | } |
| 122 | } | 126 | } |
| 123 | argv.appendAssumeCapacity(try allocPrint(arena, "-M{s}={s}", .{ cm.name, cm.root_path })); | 127 | argv.appendAssumeCapacity(try allocPrint(arena, "-M{s}={s}", .{ cm.name, cm.root_path })); |
| 124 | } | 128 | } |
| ... | @@ -922,12 +926,18 @@ pub fn main(init: process.Init.Minimal) !void { | ... | @@ -922,12 +926,18 @@ pub fn main(init: process.Init.Minimal) !void { |
| 922 | build_configurer_argv.shrinkRetainingCapacity(argv_deps_index); | 926 | build_configurer_argv.shrinkRetainingCapacity(argv_deps_index); |
| 923 | for (deps_mod.deps.values()) |dep| { | 927 | for (deps_mod.deps.values()) |dep| { |
| 924 | try build_configurer_argv.ensureUnusedCapacity(gpa, 2 * dep.deps.count() + 1); | 928 | try build_configurer_argv.ensureUnusedCapacity(gpa, 2 * dep.deps.count() + 1); |
| 925 | for (dep.deps.values()) |sub| { | 929 | for (dep.deps.keys(), dep.deps.values()) |name, sub| { |
| 926 | build_configurer_argv.appendAssumeCapacity("--dep"); | 930 | build_configurer_argv.appendAssumeCapacity("--dep"); |
| 927 | build_configurer_argv.appendAssumeCapacity(sub.name); | 931 | if (mem.eql(u8, name, sub.name)) { |
| | 932 | build_configurer_argv.appendAssumeCapacity(sub.name); |
| | 933 | } else { |
| | 934 | build_configurer_argv.appendAssumeCapacity(try allocPrint(arena, "{s}={s}", .{ |
| | 935 | name, sub.name, |
| | 936 | })); |
| | 937 | } |
| 928 | } | 938 | } |
| 929 | build_configurer_argv.appendAssumeCapacity(try allocPrint(arena, "-M{s}={s}", .{ | 939 | build_configurer_argv.appendAssumeCapacity(try allocPrint(arena, "-M{s}={s}/{s}", .{ |
| 930 | dep.name, dep.root_path, | 940 | dep.name, dep.root_path, std.zig.build_zig_basename, |
| 931 | })); | 941 | })); |
| 932 | } | 942 | } |
| 933 | try deps_mod.lower(arena, gpa, &build_configurer_argv); | 943 | try deps_mod.lower(arena, gpa, &build_configurer_argv); |