Skip to content

Commit 0edbe5a

Browse files
committed
add basic build.zig.zon documentation
1 parent 2f4bead commit 0edbe5a

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

doc/build.zig.zon.md

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

0 commit comments

Comments
 (0)