| ... | @@ -1457,7 +1457,26 @@ pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency { | ... | @@ -1457,7 +1457,26 @@ pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency { |
| 1457 | process.exit(1); | 1457 | process.exit(1); |
| 1458 | } | 1458 | } |
| 1459 | | 1459 | |
| 1460 | fn dependencyInner( | 1460 | pub fn anonymousDependency( |
| | 1461 | b: *Build, |
| | 1462 | /// The path to the directory containing the dependency's build.zig file, |
| | 1463 | /// relative to the current package's build.zig. |
| | 1464 | relative_build_root: []const u8, |
| | 1465 | /// A direct `@import` of the build.zig of the dependency. |
| | 1466 | comptime build_zig: type, |
| | 1467 | args: anytype, |
| | 1468 | ) *Dependency { |
| | 1469 | const arena = b.allocator; |
| | 1470 | const build_root = b.build_root.join(arena, &.{relative_build_root}) catch @panic("OOM"); |
| | 1471 | const name = arena.dupe(u8, relative_build_root) catch @panic("OOM"); |
| | 1472 | for (name) |*byte| switch (byte.*) { |
| | 1473 | '/', '\\' => byte.* = '.', |
| | 1474 | else => continue, |
| | 1475 | }; |
| | 1476 | return dependencyInner(b, name, build_root, build_zig, args); |
| | 1477 | } |
| | 1478 | |
| | 1479 | pub fn dependencyInner( |
| 1461 | b: *Build, | 1480 | b: *Build, |
| 1462 | name: []const u8, | 1481 | name: []const u8, |
| 1463 | build_root_string: []const u8, | 1482 | build_root_string: []const u8, |