aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/Run.zig
AgeCommit message (Collapse)Author
2024-08-07introduce a web interface for fuzzingAndrew Kelley
* new .zig-cache subdirectory: 'v' - stores coverage information with filename of hash of PCs that want coverage. This hash is a hex encoding of the 64-bit coverage ID. * build runner * fixed bug in file system inputs when a compile step has an overridden zig_lib_dir field set. * set some std lib options optimized for the build runner - no side channel mitigations - no Transport Layer Security - no crypto fork safety * add a --port CLI arg for choosing the port the fuzzing web interface listens on. it defaults to choosing a random open port. * introduce a web server, and serve a basic single page application - shares wasm code with autodocs - assets are created live on request, for convenient development experience. main.wasm is properly cached if nothing changes. - sources.tar comes from file system inputs (introduced with the `--watch` feature) * receives coverage ID from test runner and sends it on a thread-safe queue to the WebServer. * test runner - takes a zig cache directory argument now, for where to put coverage information. - sends coverage ID to parent process * fuzzer - puts its logs (in debug mode) in .zig-cache/tmp/libfuzzer.log - computes coverage_id and makes it available with `fuzzer_coverage_id` exported function. - the memory-mapped coverage file is now namespaced by the coverage id in hex encoding, in `.zig-cache/v` * tokenizer - add a fuzz test to check that several properties are upheld
2024-07-25add --debug-rt CLI arg to the compiler + bonus editsAndrew Kelley
The flag makes compiler_rt and libfuzzer be in debug mode. Also: * fuzzer: override debug logs and disable debug logs for frequently called functions * std.Build.Fuzz: fix bug of rerunning the old unit test binary * report errors from rebuilding the unit tests better * link.Elf: additionally add tsan lib and fuzzer lib to the hash
2024-07-25build runner sends a start_fuzzing message to test runnerAndrew Kelley
2024-07-25build runner: extract logic to std.Build.FuzzAndrew Kelley
2024-07-25add `--fuzz` CLI argument to `zig build`Andrew Kelley
This flag makes the build runner rebuild unit tests after the pipeline finishes, if it finds any unit tests. I did not make this integrate with file system watching yet. The test runner is updated to detect which tests are fuzz tests. Run step is updated to track which test indexes are fuzz tests.
2024-07-23std.Build.Step.Run: Fix invocation syntax for Wasmtime 14+.Alex Rønne Petersen
https://github.com/bytecodealliance/wasmtime/issues/7384
2024-07-23add std.testing.random_seedAndrew Kelley
closes #17609
2024-07-20add std.fmt.hexAndrew Kelley
converts an unsigned integer into an array
2024-07-14make zig compiler processes live across rebuildsAndrew Kelley
Changes the `make` function signature to take an options struct, which additionally includes `watch: bool`. I intentionally am not exposing this information to configure phase logic. Also adds global zig cache to the compiler cache prefixes. Closes #20600
2024-07-12Merge pull request #20580 from ziglang/watchAndrew Kelley
introduce file system watching features to the zig build system
2024-07-12std.Build.Step.Run: support prefixed artifact argsxtex
Just like how addPrefixedFileArg and addPrefixedDirectoryArg works, we can make it for artifacts. Signed-off-by: Bingwu Zhang <xtexchooser@duck.com>
2024-07-12std.Build.Step.Run: integrate with --watchAndrew Kelley
2024-06-08std.Build: remove deprecated b.host in favor of b.graph.host (#20237)Krzysztof Wolicki
2024-05-31std.Build.Step.Run: global lock when child inherits stderrAndrew Kelley
The docs for setting stdio to "inherit" say: It also means that this step will obtain a global lock to prevent other steps from running in the meantime. The implementation of this lock was missing but is now provided by this commit. closes #20119
2024-05-27std.Build.Step.Run: account for new environment variableAndrew Kelley
Introduces `disable_zig_progress` which prevents the build runner from assigning the child process a progress node. This is needed for the empty_env test which requires the environment to be completely empty.
2024-05-27std.Build.Step.Run: don't create empty progress nodeAndrew Kelley
2024-05-27update the codebase for the new std.Progress APIAndrew Kelley
2024-05-20Build.Step.Run: fix cache management when there are side effectsJacob Young
Closes #19947
2024-05-11std.Build.Step.Run: add missing call to writeManifestAndrew Kelley
fixes #19938
2024-05-05Run: add output directory argumentsJacob Young
This allows running commands that take an output directory argument. The main thing that was needed for this feature was generated file subpaths, to allow access to the files in a generated directory. Additionally, a minor change was required to so that the correct directory is created for output directory args.
2024-05-05Build: cleanupJacob Young
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
2024-05-05Run: add lazy path file inputsJacob Young
This replaces `extra_file_dependencies` with support for lazy paths. Also assert output file basenames are not empty, avoid improper use of field default values, ensure stored strings are duplicated, and prefer `ArrayListUnmanaged` to discourage misuse of direct field access which wouldn't add step dependencies.
2024-05-03Rename Dir.writeFile2 -> Dir.writeFile and update all callsitesRyan Liptak
writeFile was deprecated in favor of writeFile2 in f645022d16361865e24582d28f1e62312fbc73bb. This commit renames writeFile2 to writeFile and makes writeFile2 a compile error.
2024-03-30Update uses of `@fieldParentPtr` to use RLSJacob Young
2024-03-30Update uses of `@fieldParentPtr` to pass a pointer typeJacob Young
2024-03-18std.Build.Step.Run: documentation for addFileArg and friendsAndrew Kelley
Someone on IRC got these functions mixed up, and it sure would have been helpful to have these docs in the first place, eh?
2024-03-15Fix stuttering stderr in Zig test logNguyễn Gia Phong
Before this fix, the stderr FIFO was advanced by the length of the trimmed message, thus the next error log contained the tail of that message.
2024-02-09Merge pull request #18712 from Vexu/std.optionsAndrew Kelley
std: make options a struct instance instead of a namespace
2024-02-02std.Build: revert moving some fields to GraphAndrew Kelley
On second thought, let's keep a bunch of these flags how they already were. Partial revert of the previous commit.
2024-02-02std.Build: implement --host-target, --host-cpu, --host-dynamic-linkerAndrew Kelley
This also makes a long-overdue change of extracting common state from Build into a shared Graph object. Getting the semantics right for these flags turned out to be quite tricky. In the end it works like this: * The override only happens when the target is fully native, with no additional query parameters, such as versions or CPU features added. * The override affects the resolved Target but leaves the original Query unmodified. * The "is native?" detection logic operates on the original, unmodified query. This makes it possible to provide invalid host target information, causing confusing errors to occur. Don't do that. There are some minor breaking changes to std.Build API such as the fact that `b.zig_exe` is now moved to `b.graph.zig_exe`, as well as a handful of other similar flags.
2024-02-01remove std.io.ModeVeikka Tuominen
2024-01-10zig build: handle stderr more elegantlyAndrew Kelley
* Specifically recognize stderr as a different concept than an error message in Step results. * Display it differently when only stderr occurs but the build proceeds successfully. closes #18473
2024-01-03Merge pull request #18262 from ziglang/fix-18259Andrew Kelley
std.Build.Step.Run: fix depfile support
2024-01-02std.Build.Step.Run: fix depfile supportLoris Cro
2024-01-01std.Build.ResolvedTarget: rename target field to resultAndrew Kelley
This change is seemingly insignificant but I actually agonized over this for three days. Some other things I considered: * (status quo in master branch) make Compile step creation functions accept a Target.Query and delete the ResolvedTarget struct. - downside: redundantly resolve target queries many times * same as before but additionally add a hash map to cache target query resolutions. - downside: now there is a hash map that doesn't actually need to exist, just to make the API more ergonomic. * add is_native_os and is_native_abi fields to std.Target and use it directly as the result of resolving a target query. - downside: they really don't belong there. They would be available as comptime booleans via `@import("builtin")` but they should not be exposed that way. With this change the downsides are: * the option name of addExecutable and friends is `target` instead of `resolved_target` matching the type name. - upside: this does not break compatibility with existing build scripts * you likely end up seeing `target.result.cpu.arch` rather than `target.cpu.arch`. - upside: this is an improvement over `target.target.cpu.arch` which it was before this commit. - downside: `b.host.target` is now `b.host.result`.
2024-01-01std.Target: add DynamicLinkerAndrew Kelley
2024-01-01fix infinite loop in Run stepAndrew Kelley
Previously this relied on recursion; now it relies on the recursive iteration which is better, but means the recursive call needs to be deleted.
2024-01-01fix linker test regressionsAndrew Kelley
Caused by problems with transitive dependencies
2024-01-01zig build system: change target, compilation, and module APIsAndrew Kelley
Introduce the concept of "target query" and "resolved target". A target query is what the user specifies, with some things left to default. A resolved target has the default things discovered and populated. In the future, std.zig.CrossTarget will be rename to std.Target.Query. Introduces `std.Build.resolveTargetQuery` to get from one to the other. The concept of `main_mod_path` is gone, no longer supported. You have to put the root source file at the module root now. * remove deprecated API * update build.zig for the breaking API changes in this branch * move std.Build.Step.Compile.BuildId to std.zig.BuildId * add more options to std.Build.ExecutableOptions, std.Build.ObjectOptions, std.Build.SharedLibraryOptions, std.Build.StaticLibraryOptions, and std.Build.TestOptions. * remove `std.Build.constructCMacro`. There is no use for this API. * deprecate `std.Build.Step.Compile.defineCMacro`. Instead, `std.Build.Module.addCMacro` is provided. - remove `std.Build.Step.Compile.defineCMacroRaw`. * deprecate `std.Build.Step.Compile.linkFrameworkNeeded` - use `std.Build.Module.linkFramework` * deprecate `std.Build.Step.Compile.linkFrameworkWeak` - use `std.Build.Module.linkFramework` * move more logic into `std.Build.Module` * allow `target` and `optimize` to be `null` when creating a Module. Along with other fields, those unspecified options will be inherited from parent `Module` when inserted into an import table. * the `target` field of `addExecutable` is now required. pass `b.host` to get the host target.
2024-01-01introduce std.Build.Module and extract some logic into itAndrew Kelley
This moves many settings from `std.Build.Step.Compile` and into `std.Build.Module`, and then makes them transitive. In other words, it adds support for exposing Zig modules in packages, which are configured in various ways, such as depending on other link objects, include paths, or even a different optimization mode. Now, transitive dependencies will be included in the compilation, so you can, for example, make a Zig module depend on some C source code, and expose that Zig module in a package. Currently, the compiler frontend autogenerates only one `@import("builtin")` module for the entire compilation, however, a future enhancement will be to make it honor the differences in modules, so that modules can be compiled with different optimization modes, code model, valgrind integration, or even target CPU feature set. closes #14719
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-10-22child_process + Build: rename exec to run + all related codeJan Philipp Hafer
Justification: exec, execv etc are unix concepts and portable version should be called differently. Do no touch non-Zig code. Adjust error names as well, if associated. Closes #5853.
2023-10-10Step.Run: change `cwd` to `?Build.LazyPath` (#17418)Krzysztof Wolicki
closes #17409
2023-10-06std: fix memory bug in getExternalExecutorJakub Konka
Until now, we would pass `candidate: NativeTargetInfo` which creates a copy of the `NativeTargetInfo.DynamicLinker` buffer. We would then return this buffer in `bad_dl: []const u8` which would goes out-of-scope the moment we leave this function frame yielding garbage. To fix this, we just need to remember to pass by const-pointer `candidate: *const NativeTargetInfo`.
2023-09-29Step.Run: fix assert of the wrong value (#17303)Krzysztof Wolicki
closes #16866
2023-08-25Build: fail tests that log errors, like `zig test` doesJacob Young
2023-08-13std.Build: add support for deps .d file in Step.RunSahnvour
2023-07-30std.Build.LazyPath: fix resolution of cwd_relativeAndrew Kelley
The callsites of getPath rely on the result being absolute so that they can pass the path to a child process with the cwd set to the build root.
2023-07-30build system: follow-up enhancements regarding LazyPathAndrew Kelley
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685 * move overrideZigLibDir and setMainPkgPath to options fields set once and then never mutated. * avoid introducing Build/util.zig * use doc comments for deprecation notices so that they show up in generated documentation. * introduce InstallArtifact.Options, accept it as a parameter to addInstallArtifact, and move override_dest_dir into it. Instead of configuring the installation via Compile step, configure the installation via the InstallArtifact step. In retrospect this is obvious. * remove calls to pushInstalledFile in InstallArtifact. See #14943 * rewrite InstallArtifact to not incorrectly observe whether a Compile step has any generated outputs. InstallArtifact is meant to trigger output generation. * fix child process evaluation code handling of `-fno-emit-bin`. * don't store out_h_filename, out_ll_filename, etc., pointlessly. these are all just simple extensions appended to the root name. * make emit_directory optional. It's possible to have nothing outputted, for example, if you're just type-checking. * avoid passing -femit-foo/-fno-emit-foo when it is the default * rename ConfigHeader.getTemplate to getOutput * deprecate addOptionArtifact * update the random number seed of Options step caching. * avoid using `inline for` pointlessly * avoid using `override_Dest_dir` pointlessly * avoid emitting an executable pointlessly in test cases Removes forceBuild and forceEmit. Let's consider these additions separately. Nearly all of the usage sites were suspicious.
2023-07-30Introduces `Compile.getEmittedX()` functions, drops `Compile.emit_X`. ↵Felix (xq) Queißner
Resolves #14971