From 91955dee587214722daa09e6f3dbff059ac3752e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 8 Mar 2019 22:53:35 -0500 Subject: breaking changes to zig build API and improved caching * in Zig build scripts, getOutputPath() is no longer a valid function to call, unless setOutputDir() was used, or within a custom make() function. Instead there is more convenient API to use which takes advantage of the caching system. Search this commit diff for `exe.run()` for an example. * Zig build by default enables caching. All build artifacts will go into zig-cache. If you want to access build artifacts in a convenient location, it is recommended to add an `install` step. Otherwise you can use the `run()` API mentioned above to execute programs directly from their location in the cache. Closes #330. `addSystemCommand` is available for programs not built with Zig build. * Please note that Zig does no cache evicting yet. You may have to manually delete zig-cache directories periodically to keep disk usage down. It's planned for this to be a simple Least Recently Used eviction system eventually. * `--output`, `--output-lib`, and `--output-h` are removed. Instead, use `--output-dir` which defaults to the current working directory. Or take advantage of `--cache on`, which will print the main output path to stdout, and the other artifacts will be in the same directory with predictable file names. `--disable-gen-h` is available when one wants to prevent .h file generation. * `@cImport` is always independently cached now. Closes #2015. It always writes the generated Zig code to disk which makes debug info and compile errors better. No more "TODO: remember C source location to display here" * Fix .d file parsing. (Fixes the MacOS CI failure) * Zig no longer creates "temporary files" other than inside a zig-cache directory. This breaks the CLI API that Godbolt uses. The suggested new invocation can be found in this commit diff, in the changes to `test/cli.zig`. --- test/cli.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/cli.zig') diff --git a/test/cli.zig b/test/cli.zig index 1520b3bde0..a36c810cd8 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -116,12 +116,12 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { const args = [][]const u8{ zig_exe, "build-obj", "--cache-dir", dir_path, - "--output", example_s_path, - "--output-h", "/dev/null", + "--name", "example", + "--output-dir", dir_path, "--emit", "asm", "-mllvm", "--x86-asm-syntax=intel", "--strip", "--release-fast", - example_zig_path, + example_zig_path, "--disable-gen-h", }; _ = try exec(dir_path, args); -- cgit v1.2.3