zig/test/standalone
Abhinav Gupta d3a163f868
build/LazyPath: Add dirname (#18371)
Adds a variant to the LazyPath union representing a parent directory
of a generated path.

```zig
const LazyPath = union(enum) {
    generated_dirname: struct {
        generated: *const GeneratedFile,
        up: usize,
    },
    // ...
}
```

These can be constructed with the new method:

```zig
pub fn dirname(self: LazyPath) LazyPath
```

For the cases where the LazyPath is already known
(`.path`, `.cwd_relative`, and `dependency`)
this is evaluated right away.
For dirnames of generated files and their dirnames,
this is evaluated at getPath time.

dirname calls can be chained, but for safety,
they are not allowed to escape outside a root
defined for each case:

- path: This is relative to the build root,
  so dirname can't escape outside the build root.
- generated: Can't escape the zig-cache.
- cwd_relative: This can be a relative or absolute path.
  If relative, can't escape the current directory,
  and if absolute, can't go beyond root (/).
- dependency: Can't escape the dependency's root directory.

Testing:
I've included a standalone case for many of the happy cases.
I couldn't find an easy way to test the negatives, though,
because tests cannot yet expect panics.
2024-01-04 18:47:28 -05:00
..
c_compiler std.Build.ResolvedTarget: rename target field to result 2024-01-01 17:51:18 -07:00
cat allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
child_process zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
cmakedefine test: add standalone test for cmakedefine 2023-06-21 21:51:07 +02:00
coff_dwarf disable standalone coff_dwarf test on aarch64-windows 2024-01-01 19:49:08 -07:00
compiler_rt_panic std.Build.ResolvedTarget: rename target field to result 2024-01-01 17:51:18 -07:00
dep_diamond zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
dep_mutually_recursive zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
dep_recursive zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
dep_shared_builtin zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
dep_triangle zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
depend_on_main_mod add standalone test for depending on the main module 2024-01-01 19:49:08 -07:00
dirname build/LazyPath: Add dirname (#18371) 2024-01-04 18:47:28 -05:00
embed_generated_file zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
emit_asm_and_bin build system: follow-up enhancements regarding LazyPath 2023-07-30 11:19:32 -07:00
empty_env zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
extern zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
global_linkage zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
guess_number update guess number standalone test 2020-12-18 12:22:46 -07:00
hello_world all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
install_raw_hex zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
ios std.Build.ResolvedTarget: rename target field to result 2024-01-01 17:51:18 -07:00
issue_339 zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
issue_794 build system: follow-up enhancements regarding LazyPath 2023-07-30 11:19:32 -07:00
issue_5825 fix windows-only test case not upgraded to new build API 2024-01-01 17:51:18 -07:00
issue_8550 zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
issue_9402 Added implementation for _fseeki64 and _ftelli64 from mingw-w64 9.0.0 (#9402). (#9766) 2021-09-15 13:38:00 -04:00
issue_9693 std: collect all options under one namespace 2023-01-05 02:31:29 -07:00
issue_11595 zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
issue_12471 translate-c: Don't add self-defined macros to global name table 2022-08-26 11:24:57 +03:00
issue_12588 zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
issue_12706 zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
issue_13970 fix build logic due to state mutations and break the API accordingly 2023-04-11 08:42:14 -07:00
load_dynamic_library zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
main_return_error test: update remaining code to fix 'var is never mutated' errors 2023-11-19 09:57:04 +00:00
mix_c_files zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
mix_o_files zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
noreturn_call Sema: do not emit dbg_inline_end after NoReturn 2022-09-02 17:57:10 +03:00
options zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
pie zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
pkg_import zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
self_exe_symlink std.Build.ResolvedTarget: rename target field to result 2024-01-01 17:51:18 -07:00
shared_library zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
sigpipe re-enable standalone tests based on build.zig 2023-03-15 10:48:14 -07:00
stack_iterator fix stack_iterator test build script 2024-01-01 19:49:08 -07:00
static_c_lib zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
strip_empty_loop zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
strip_struct_init zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
test_runner_module_imports zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
test_runner_path std.Build.CompileStep: remove run() and install() 2023-04-10 18:35:14 -07:00
use_alias test: update remaining code to fix 'var is never mutated' errors 2023-11-19 09:57:04 +00:00
windows_resources rename std.zig.CrossTarget to std.Target.Query 2024-01-01 17:51:18 -07:00
windows_spawn zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
zerolength_check zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
brace_expansion.zig re-enable standalone tests based on build.zig 2023-03-15 10:48:14 -07:00
http.zig std.http.Client: documentaion fixes 2023-10-21 20:53:00 -05:00
issue_7030.zig re-enable standalone tests based on build.zig 2023-03-15 10:48:14 -07:00