authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-03 23:26:43-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-08 16:54:31-07:00
logd06da958846330ce7c40cf9c9fde1f9799cd30dd
tree9165b14299c0381eeb4a77762b7bd24f52a0f2e2
parentef8772938811402262060436eb481586c8a81b3e

add basic build.zig.zon documentation


1 files changed, 65 insertions(+), 0 deletions(-)

doc/build.zig.zon.md created+65
...@@ -0,0 +1,65 @@
1# build.zig.zon Documentation
2
3This is the manifest file for build.zig scripts. It is named build.zig.zon in
4order to make it clear that it is metadata specifically pertaining to
5build.zig.
6
7- **build root** - the directory that contains `build.zig`
8
9## Top-Level Fields
10
11### `name`
12
13String. Required.
14
15### `version`
16
17String. Required.
18
19[semver](https://semver.org/)
20
21### `dependencies`
22
23Struct.
24
25Each dependency must either provide a `url` and `hash`, or a `path`.
26
27#### `url`
28
29String.
30
31When updating this field to a new URL, be sure to delete the corresponding
32`hash`, otherwise you are communicating that you expect to find the old hash at
33the new URL.
34
35#### `hash`
36
37String.
38
39[multihash](https://multiformats.io/multihash/)
40
41This is computed from the file contents of the directory of files that is
42obtained after fetching `url` and applying the inclusion rules given by
43`paths`.
44
45This field is the source of truth; packages do not come from an `url`; they
46come from a `hash`. `url` is just one of many possible mirrors for how to
47obtain a package matching this `hash`.
48
49#### `path`
50
51String.
52
53When this is provided, the package is found in a directory relative to the
54build root. In this case the package's hash is irrelevant and therefore not
55computed.
56
57### `paths`
58
59List. Required.
60
61Specifies the set of files and directories that are included in this package.
62Paths are relative to the build root. Use the empty string (`""`) to refer to
63the build root itself.
64
65Only files included in the package are used to compute a package's `hash`.