-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
eliminate absolute paths from the build system #18450
Copy link
Copy link
Open
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.zig build systemstd.Build, the build runner, `zig build` subcommand, package managementstd.Build, the build runner, `zig build` subcommand, package management
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.zig build systemstd.Build, the build runner, `zig build` subcommand, package managementstd.Build, the build runner, `zig build` subcommand, package management
Absolute paths are generally problematic:
For general improvement in robustness as well as progress towards #14286, this issue is to eliminate all absolute paths from the zig build system. Here are some example violations:
zig/lib/std/Build/Step/Run.zig
Lines 572 to 573 in 501a235
zig/lib/std/Build/Step/Run.zig
Lines 642 to 656 in 501a235
zig/lib/std/Build/Step/WriteFile.zig
Lines 216 to 218 in 501a235
There are plenty more.
Instead, this API should be moved from the compiler implementation (
Package.Path) tostd.Cache.Path:zig/src/Package.zig
Lines 6 to 10 in 501a235
Then, Path objects should be passed around rather than strings. This will improve the correctness of a bunch of stuff as well as reduce the amount of unnecessary string manipulation that is happening, and make it easier to implement detection of going outside a directory root.