@@ -19,6 +19,8 @@ const NativeTargetInfo = std.zig.system.NativeTargetInfo;
19
19
const Sha256 = std .crypto .hash .sha2 .Sha256 ;
20
20
const Build = @This ();
21
21
22
+ const build_util = @import ("Build/util.zig" );
23
+
22
24
pub const Cache = @import ("Build/Cache.zig" );
23
25
24
26
/// deprecated: use `Step.Compile`.
@@ -1679,7 +1681,7 @@ pub const LazyPath = union(enum) {
1679
1681
.generated = > | gen | return gen .path orelse {
1680
1682
std .debug .getStderrMutex ().lock ();
1681
1683
const stderr = std .io .getStdErr ();
1682
- dumpBadGetPathHelp (gen .step , stderr , src_builder , asking_step ) catch {};
1684
+ build_util . dumpBadGetPathHelp (gen .step , stderr , src_builder , asking_step ) catch {};
1683
1685
@panic ("misconfigured build script" );
1684
1686
},
1685
1687
}
@@ -1694,54 +1696,6 @@ pub const LazyPath = union(enum) {
1694
1696
}
1695
1697
};
1696
1698
1697
- /// In this function the stderr mutex has already been locked.
1698
- fn dumpBadGetPathHelp (
1699
- s : * Step ,
1700
- stderr : fs.File ,
1701
- src_builder : * Build ,
1702
- asking_step : ? * Step ,
1703
- ) anyerror ! void {
1704
- const w = stderr .writer ();
1705
- try w .print (
1706
- \\getPath() was called on a GeneratedFile that wasn't built yet.
1707
- \\ source package path: {s}
1708
- \\ Is there a missing Step dependency on step '{s}'?
1709
- \\
1710
- , .{
1711
- src_builder .build_root .path orelse "." ,
1712
- s .name ,
1713
- });
1714
-
1715
- const tty_config = std .io .tty .detectConfig (stderr );
1716
- tty_config .setColor (w , .red ) catch {};
1717
- try stderr .writeAll (" The step was created by this stack trace:\n " );
1718
- tty_config .setColor (w , .reset ) catch {};
1719
-
1720
- const debug_info = std .debug .getSelfDebugInfo () catch | err | {
1721
- try w .print ("Unable to dump stack trace: Unable to open debug info: {s}\n " , .{@errorName (err )});
1722
- return ;
1723
- };
1724
- const ally = debug_info .allocator ;
1725
- std .debug .writeStackTrace (s .getStackTrace (), w , ally , debug_info , tty_config ) catch | err | {
1726
- try stderr .writer ().print ("Unable to dump stack trace: {s}\n " , .{@errorName (err )});
1727
- return ;
1728
- };
1729
- if (asking_step ) | as | {
1730
- tty_config .setColor (w , .red ) catch {};
1731
- try stderr .writeAll (" The step that is missing a dependency on the above step was created by this stack trace:\n " );
1732
- tty_config .setColor (w , .reset ) catch {};
1733
-
1734
- std .debug .writeStackTrace (as .getStackTrace (), w , ally , debug_info , tty_config ) catch | err | {
1735
- try stderr .writer ().print ("Unable to dump stack trace: {s}\n " , .{@errorName (err )});
1736
- return ;
1737
- };
1738
- }
1739
-
1740
- tty_config .setColor (w , .red ) catch {};
1741
- try stderr .writeAll (" Hope that helps. Proceeding to panic.\n " );
1742
- tty_config .setColor (w , .reset ) catch {};
1743
- }
1744
-
1745
1699
/// Allocates a new string for assigning a value to a named macro.
1746
1700
/// If the value is omitted, it is set to 1.
1747
1701
/// `name` and `value` need not live longer than the function call.
0 commit comments