aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build
AgeCommit message (Collapse)Author
2025-09-04std.elf: change STV enum from u2 to u3Alex Rønne Petersen
In gABI 4.3, st_other was changed such that the lower 3 bits are reserved for the visibility, up from the previous 2 bits.
2025-08-31std.fmt: delete deprecated APIsAndrew Kelley
std.fmt.Formatter -> std.fmt.Alt std.fmt.format -> std.Io.Writer.print
2025-08-30upgrade more old API usesAndrew Kelley
2025-08-30rework std.Io.Writer.Allocating to support runtime-known alignmentAndrew Kelley
Also, breaking API changes to: * std.fs.Dir.readFileAlloc * std.fs.Dir.readFileAllocOptions
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-29std.Io: delete CountingReaderAndrew Kelley
2025-08-28std.Io: delete GenericWriterAndrew Kelley
2025-08-26std.Build.WebServer: fix racemlugg
Just a typo: I wasn't actually using the duped message, so the message I sent could be freed in this interval.
2025-08-26std.Build.Step.Compile: fix race condition in args file creationIan Johnson
Fixes #23993 Previously, if multiple build processes tried to create the same args file, there was a race condition with the use of the non-atomic `writeFile` function which could cause a spawned compiler to read an empty or incomplete args file. This commit avoids the race condition by first writing to a temporary file with a random path and renaming it to the desired path.
2025-08-26std.Build.Step.TranslateC: forward --cache-dir and --global-cache-dir flagsAdamGoertz
2025-08-16Build.Step.Run: fix missing stdin buffer and flushIsaac Freund
Writer.sendFileAll() asserts non-zero buffer capacity in the case that the fallback is hit. It also requires the caller to flush. The buffer may be bypassed as an optimization but this is not a guarantee. Also improve the Writer documentation and add an earlier assert on buffer capacity in sendFileAll().
2025-08-16Compilation: remove last instance of deprecatedReaderAndrew Kelley
This also makes initStreaming preemptively disable file size checking.
2025-08-15std.Build: improve error for peak RSS exceeding declared valuemlugg
As well as the exact byte count, include a human-readable value so it's clearer what the error is actually telling you. The exact byte count might not be worth keeping, but I decided I would in case it's useful in any scenario.
2025-08-13build runner: fix single-threaded buildmlugg
Resolves: #24723
2025-08-13std.io.Writer.Allocating: rename getWritten() to written()Isaac Freund
This "get" is useless noise and was copied from FixedBufferWriter. Since this API has not yet landed in a release, now is a good time to make the breaking change to fix this.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-09net: Always set WSA_FLAG_OVERLAPPED when creating Windows sockets. Rework ↵kcbanner
send and receive logic to use overlapped I/O. build-web: Remove the now-redundant supports_recv logic
2025-08-09Fix `respondWebSocket`, enable --webui on Windowskcbanner
This commit re-enables the --webui functionality on windows, with the caveat that rebuild functionality is still disabled (due to deadlocks caused by reading to / writing from the same non-overlapped socket on multiple threads). I updated the UI to be aware of this, and hide the `Rebuild` button. http.Server: Remove incorrect advance() call. This was causing browsers to disconnect the websocket, as we were sending undefined bytes. build.WebServer: Re-enable on windows, but disable functionality that requires receiving messages from the client build-web: Show total times in tables
2025-08-07Merge pull request #24661 from alichraghi/spv4Andrew Kelley
spirv: refactor and remove deduplication ISel
2025-08-07update build system to new http.Server APIAndrew Kelley
2025-08-03Watch: do not fail when file is removedAli Cheraghi
before this we would get a crash
2025-08-02std.Build: keep compiler alive under `-fincremental --webui`mlugg
Previously, this only applied when using `-fincremental --watch`, but `--webui` makes the build runner stay alive just like `--watch` does, so the same logic applies here. Without this, attempting to perform incremental updates with `--webui` performs full rebuilds. (I did test that before merging the PR, but at that time I was passing `--watch` too -- which has since been disallowed -- so I missed that it doesn't work as expected without that option!)
2025-08-02std.Build.Watch: add macOS implementation based on FSEventStreammlugg
Resolves: #21905
2025-08-01build system: replace fuzzing UI with build UI, add time reportmlugg
This commit replaces the "fuzzer" UI, previously accessed with the `--fuzz` and `--port` flags, with a more interesting web UI which allows more interactions with the Zig build system. Most notably, it allows accessing the data emitted by a new "time report" system, which allows users to see which parts of Zig programs take the longest to compile. The option to expose the web UI is `--webui`. By default, it will listen on `[::1]` on a random port, but any IPv6 or IPv4 address can be specified with e.g. `--webui=[::1]:8000` or `--webui=127.0.0.1:8000`. The options `--fuzz` and `--time-report` both imply `--webui` if not given. Currently, `--webui` is incompatible with `--watch`; specifying both will cause `zig build` to exit with a fatal error. When the web UI is enabled, the build runner spawns the web server as soon as the configure phase completes. The frontend code consists of one HTML file, one JavaScript file, two CSS files, and a few Zig source files which are built into a WASM blob on-demand -- this is all very similar to the old fuzzer UI. Also inherited from the fuzzer UI is that the build system communicates with web clients over a WebSocket connection. When the build finishes, if `--webui` was passed (i.e. if the web server is running), the build runner does not terminate; it continues running to serve web requests, allowing interactive control of the build system. In the web interface is an overall "status" indicating whether a build is currently running, and also a list of all steps in this build. There are visual indicators (colors and spinners) for in-progress, succeeded, and failed steps. There is a "Rebuild" button which will cause the build system to reset the state of every step (note that this does not affect caching) and evaluate the step graph again. If `--time-report` is passed to `zig build`, a new section of the interface becomes visible, which associates every build step with a "time report". For most steps, this is just a simple "time taken" value. However, for `Compile` steps, the compiler communicates with the build system to provide it with much more interesting information: time taken for various pipeline phases, with a per-declaration and per-file breakdown, sorted by slowest declarations/files first. This feature is still in its early stages: the data can be a little tricky to understand, and there is no way to, for instance, sort by different properties, or filter to certain files. However, it has already given us some interesting statistics, and can be useful for spotting, for instance, particularly complex and slow compile-time logic. Additionally, if a compilation uses LLVM, its time report includes the "LLVM pass timing" information, which was previously accessible with the (now removed) `-ftime-report` compiler flag. To make time reports more useful, ZIR and compilation caches are ignored by the Zig compiler when they are enabled -- in other words, `Compile` steps *always* run, even if their result should be cached. This means that the flag can be used to analyze a project's compile time without having to repeatedly clear cache directory, for instance. However, when using `-fincremental`, updates other than the first will only show you the statistics for what changed on that particular update. Notably, this gives us a fairly nice way to see exactly which declarations were re-analyzed by an incremental update. If `--fuzz` is passed to `zig build`, another section of the web interface becomes visible, this time exposing the fuzzer. This is quite similar to the fuzzer UI this commit replaces, with only a few cosmetic tweaks. The interface is closer than before to supporting multiple fuzz steps at a time (in line with the overall strategy for this build UI, the goal will be for all of the fuzz steps to be accessible in the same interface), but still doesn't actually support it. The fuzzer UI looks quite different under the hood: as a result, various bugs are fixed, although other bugs remain. For instance, viewing the source code of any file other than the root of the main module is completely broken (as on master) due to some bogus file-to-module assignment logic in the fuzzer UI. Implementation notes: * The `lib/build-web/` directory holds the client side of the web UI. * The general server logic is in `std.Build.WebServer`. * Fuzzing-specific logic is in `std.Build.Fuzz`. * `std.Build.abi` is the new home of `std.Build.Fuzz.abi`, since it now relates to the build system web UI in general. * The build runner now has an **actual** general-purpose allocator, because thanks to `--watch` and `--webui`, the process can be arbitrarily long-lived. The gpa is `std.heap.DebugAllocator`, but the arena remains backed by `std.heap.page_allocator` for efficiency. I fixed several crashes caused by conflation of `gpa` and `arena` in the build runner and `std.Build`, but there may still be some I have missed. * The I/O logic in `std.Build.WebServer` is pretty gnarly; there are a *lot* of threads involved. I anticipate this situation improving significantly once the `std.Io` interface (with concurrency support) is introduced.
2025-07-30build system: print captured stderr on Run step failureLoris Cro
when a Run step that captures stderr fails, no output from it is visible by the user and, since the step failed, any downstream step that would process the captured stream will not run, making it impossible for the user to see the stderr output from the failed process invocation, which makes for a frustrating puzzle when this happens in CI.
2025-07-26std.Build: Deprecate `Step.Compile` APIs that mutate the root moduleCarl Åstholm
Not only are `Step.Compile` methods like `linkLibC()` redundant because `Module` exposes the same APIs, it also might not be immediately obvious to users that these methods modify the underlying root module, which can be a footgun and lead to unintended results if the module is exported to package consumers or shared by multiple compile steps. Using `compile.root_module.link_libc = true` makes it more clear to users which of the compile step and the module owns which options.
2025-07-23std.Io.poll: update to new I/O APIAndrew Kelley
2025-07-22std.tar: update to new I/O APIAndrew Kelley
2025-07-21std.fs.File: delete writeFileAll and friendsAndrew Kelley
please use File.Writer for these use cases also breaking API changes to std.fs.AtomicFile
2025-07-20Merge pull request #24488 from ziglang/moreAndrew Kelley
std.zig: finish updating to new I/O API
2025-07-20Merge pull request #24505 from ziglang/jsonAndrew Kelley
update std.json and std.zon to new I/O API
2025-07-20std.Build.Step.Run: fix up 681d324c49e7cdc773cc891ea49ed69dd03c23c7Alex Rønne Petersen
https://github.com/ziglang/zig/pull/24151/files#r2217494741
2025-07-19std.Io.Writer: fix writeSliceSwapAndrew Kelley
tried to be too clever, wrote bad code
2025-07-19std.zon: update to new I/O APIAndrew Kelley
2025-07-17std.Build.Step.ConfigHeader: add the lazy file styled input as a dependencyTristan Ross
2025-07-16fix memory leakAlex Kladov
closes #24421
2025-07-14std.Io.Reader.appendRemaining: add missing assertAndrew Kelley
2025-07-12std.Build.Step.Run: Set WINEDEBUG=-all for -fwine by default.Alex Rønne Petersen
This silences the excessive default stderr logging from Wine. The user can still override this by setting WINEDEBUG in the environment; this just provides a more sensible default. Closes #24139.
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-09std.Build.Cache: remove debugging remnantsAndrew Kelley
oops!
2025-07-07std.Build.Step.CheckObject: mostly revert to master branchAndrew Kelley
the updated code to use new std.io API is crashing
2025-07-07fix 32-bit compilationAndrew Kelley
2025-07-07std.Build.Step.Options: fix build failureAndrew Kelley
2025-07-07std.io.Writer.printValue: rework logicAndrew Kelley
Alignment and fill options only apply to numbers. Rework the implementation to mainly branch on the format string rather than the type information. This is more straightforward to maintain and more straightforward for comptime evaluation. Enums support being printed as decimal, hexadecimal, octal, and binary. `formatInteger` is another possible format method that is unconditionally called when the value type is struct and one of the integer-printing format specifiers are used.
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07fix build runnerAndrew Kelley
2025-07-07std.io.Writer.Allocating: rename interface to writerAndrew Kelley
2025-07-07std.io.Reader: fix appendRemainingAndrew Kelley
2025-07-07std.Build.Cache: write manifest without heap allocatingAndrew Kelley
Now that the buffered writing interface is not generic.
2025-07-07std.Build.Step.CheckObject: fix the TODOAndrew Kelley