# zig build system: correctly handle multiple output artifacts · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/66e76a0209586000a78fe896071e73202a80b81f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 66e76a0209586000a78fe896071e73202a80b81f

Requested commit: 66e76a0209586000a78fe896071e73202a80b81f

Commit: 66e76a0209586000a78fe896071e73202a80b81f

Tree: 15b80516b0aaddd2e114205e41ee0cda49c32030

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
zig build system: correctly handle multiple output artifacts

Previously the zig build system incorrectly assumed that the only build
artifact was a binary. Now, when you enable the cache, only the output
dir is printed to stdout, and the zig build system iterates over the
files in that directory, copying them to the output directory.

To support this change:

 * Add `std.os.renameat`, `std.os.renameatZ`, and `std.os.renameatW`.
 * Fix `std.os.linux.renameat` not compiling due to typos.
 * Deprecate `std.fs.updateFile` and `std.fs.updateFileMode`.
 * Add `std.fs.Dir.updateFile`, which supports using open directory
   handles for both the source and destination paths, as well as an
   options parameter which allows overriding the mode.
 * Update `std.fs.AtomicFile` to support operating based on an open
   directory handle. Instead of `std.fs.AtomicFile.init`, use
   `std.fs.Dir.atomicFile`.
 * `std.fs.AtomicFile` deinit() better handles the situation when the
    rename fails but the temporary file still exists, by still
    attempting to remove the temporary file.
 * `std.fs.Dir.openFileWindows` is moved to `std.os.windows.OpenFileW`.
 * `std.os.RenameError` gains the error codes `NoDevice`,
   `SharingViolation`, and `PipeBusy` which have been observed from
   Windows.

Closes #4733

```

## Parents

- [eb4d313dbc406b37f6bfdd98988c88c3b8ed542e](https://git.cafe/gitcafe/zig/commit/eb4d313dbc406b37f6bfdd98988c88c3b8ed542e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/66e76a0209586000a78fe896071e73202a80b81f?format=markdown)
