Commit graph

17 commits

Author SHA1 Message Date
Andrew Kelley
d789f1e5cf fuzzer: write inputs to shared memory before running
breaking change to the fuzz testing API; it now passes a type-safe
context parameter to the fuzz function.

libfuzzer is reworked to select inputs from the entire corpus.

I tested that it's roughly as good as it was before in that it can find
the panics in the simple examples, as well as achieve decent coverage on
the tokenizer fuzz test.

however I think the next step here will be figuring out why so many
points of interest are missing from the tokenizer in both Debug and
ReleaseSafe modes.

does not quite close #20803 yet since there are some more important
things to be done, such as opening the previous corpus, continuing
fuzzing after finding bugs, storing the length of the inputs, etc.
2025-02-11 13:39:20 -08:00
BratishkaErik
941677e083
std.Build: add addLibrary function (#22554)
Acts as a replacement for `addSharedLibrary` and `addStaticLibrary`, but
linking mode can be changed more easily in build.zig, for example:

In library:
```zig
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode for a foo_bar library") orelse .static; // or other default

const lib = b.addLibrary(.{
    .linkage = linkage,
    .name = "foo_bar",
    .root_module = mod,
});
```

In consumer:
```zig
const dep_foo_bar = b.dependency("foo_bar", .{
    .target = target,
    .optimize = optimize,
    .linkage = .static // or dynamic
});

mod.linkLibrary(dep_foor_bar.artifact("foo_bar"));
```

It also matches nicely with `linkLibrary` name.

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
2025-01-22 02:29:21 +00:00
Jonathan Marler
77c63ac360 doc: mention zig can't use URLs if their content changes
There's been some proliferation of dependency URLs that reference
mutable data such as links to git branches that can change.  This has
resulted in broken projects, i.e.

* 9eef9de94c/build.zig.zon
* 4b64353e9c

There's also disagreement about whether it's fine for URL's to point to
git branches, i.e.

https://github.com/Not-Nik/raylib-zig/pull/130

This updates the docs to mention that zig won't be able to use URLs if
their content changes.
2024-12-21 18:23:01 -05:00
mlugg
afc77f0603
init template: expand slightly, migrate from deprecated std.Build APIs 2024-12-18 01:49:14 +05:00
Andrew Kelley
9dc75f03e2 fix init template for new fuzz testing API 2024-09-11 13:41:29 -07:00
Andrew Kelley
cf9f8de661 update comment in init template
Unit tests are not run from the install step.

closes #21123
2024-08-18 14:23:49 -07:00
Karim Mk
3b3c9d2081 Fix typo in init files. 2024-07-26 14:33:59 -07:00
Andrew Kelley
5d3a1cfdf5 update init template
* add fuzz example
* explain that you might want to delete main.zig or root.zig
2024-07-26 12:18:23 -07:00
KNnut
cf36d3fdd3 add a missing comment in build.zig.zon 2024-07-15 10:47:36 -07:00
Andrew Kelley
95f0dce7da seriously people, don't put "zig-" in your package names
related #20178
2024-06-05 15:49:47 -07:00
Tim Culverhouse
6b020c3d15 init: clarify .paths usage in build.zig.zon
Clarify the usage of .paths in build.zig.zon. Follow the recommendation
of the comments to explicitly list paths by explicitly listing the paths
in the init project.
2024-05-28 21:20:41 -04:00
Linus Groh
d483ba7250 zig init: Replace deprecated LazyPath.path with Build.path() 2024-04-15 16:55:04 +03:00
Jeremia Dominguez
0ac15b9726 Document lazy dependency in init build.zig.zon
Also added the same description to doc/build.zig.zon.md
2024-04-11 14:56:07 -07:00
Maximilian
697b8f7d2f
Grammar fixes (#18320)
* Grammar fixes

Just a couple things I noticed

* Update build.zig.zon.md

Fix a/an usage for zon doc
2023-12-20 13:17:15 +02:00
Andrew Kelley
0c0b69891a zig fetch: add --save flag
```
--save        Add the fetched package to build.zig.zon
--save=[name] Add the fetched package to build.zig.zon as name
```
2023-11-26 19:41:00 -07:00
Andrew Kelley
9f363cd679 zig init: also create a build.zig.zon 2023-11-20 23:30:51 -07:00
Andrew Kelley
f645022d16 merge zig init-exe and zig init-lib into zig init
Instead of `zig init-lib` and `zig init-exe`, now there is only
`zig init`, which initializes any of the template files that do not
already exist, and makes a package that contains both an executable and
a static library. The idea is that the user can delete whatever they
don't want. In fact, I think even more things should be added to the
build.zig template.
2023-11-20 23:01:45 -07:00