@shd101wyy/yo 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/skills/yo-async-effects/SKILL.md +4 -4
- package/.github/skills/yo-async-effects/async-effects-recipes.md +40 -40
- package/.github/skills/yo-core-patterns/SKILL.md +1 -1
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +30 -26
- package/.github/skills/yo-project-workflow/SKILL.md +6 -3
- package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
- package/.github/skills/yo-syntax/SKILL.md +7 -6
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +78 -60
- package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
- package/README.md +10 -8
- package/out/cjs/index.cjs +583 -567
- package/out/cjs/yo-cli.cjs +664 -632
- package/out/cjs/yo-lsp.cjs +510 -485
- package/out/esm/index.mjs +538 -522
- package/out/types/src/codegen/codegen-c.d.ts +2 -2
- package/out/types/src/codegen/functions/collection.d.ts +2 -2
- package/out/types/src/codegen/functions/context.d.ts +3 -2
- package/out/types/src/codegen/types/collection.d.ts +2 -2
- package/out/types/src/codegen/utils/index.d.ts +3 -1
- package/out/types/src/doc/builder.d.ts +2 -2
- package/out/types/src/evaluator/calls/closure-type.d.ts +2 -2
- package/out/types/src/evaluator/calls/record-type.d.ts +11 -0
- package/out/types/src/evaluator/context.d.ts +8 -9
- package/out/types/src/evaluator/index.d.ts +3 -3
- package/out/types/src/evaluator/types/record.d.ts +14 -0
- package/out/types/src/evaluator/types/validation.d.ts +2 -2
- package/out/types/src/evaluator/values/anonymous-module.d.ts +5 -5
- package/out/types/src/evaluator/values/impl.d.ts +1 -1
- package/out/types/src/expr.d.ts +1 -4
- package/out/types/src/formatter.d.ts +11 -0
- package/out/types/src/function-value.d.ts +1 -1
- package/out/types/src/lsp/document-manager.d.ts +1 -1
- package/out/types/src/lsp/formatting.d.ts +2 -0
- package/out/types/src/module-manager.d.ts +3 -3
- package/out/types/src/tests/formatter.test.d.ts +1 -0
- package/out/types/src/types/creators.d.ts +3 -4
- package/out/types/src/types/definitions.d.ts +8 -19
- package/out/types/src/types/guards.d.ts +3 -3
- package/out/types/src/types/tags.d.ts +0 -1
- package/out/types/src/types/utils.d.ts +1 -1
- package/out/types/src/value-tag.d.ts +0 -1
- package/out/types/src/value.d.ts +6 -13
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/alg/hash.yo +13 -21
- package/std/allocator.yo +25 -40
- package/std/async.yo +3 -7
- package/std/build.yo +105 -151
- package/std/cli/arg_parser.yo +184 -169
- package/std/collections/array_list.yo +350 -314
- package/std/collections/btree_map.yo +142 -131
- package/std/collections/deque.yo +132 -128
- package/std/collections/hash_map.yo +542 -566
- package/std/collections/hash_set.yo +623 -687
- package/std/collections/linked_list.yo +275 -293
- package/std/collections/ordered_map.yo +113 -85
- package/std/collections/priority_queue.yo +73 -73
- package/std/crypto/md5.yo +191 -95
- package/std/crypto/random.yo +56 -64
- package/std/crypto/sha256.yo +151 -107
- package/std/encoding/base64.yo +87 -81
- package/std/encoding/hex.yo +43 -50
- package/std/encoding/html.yo +56 -81
- package/std/encoding/html_char_utils.yo +7 -13
- package/std/encoding/html_entities.yo +2248 -2253
- package/std/encoding/json.yo +316 -224
- package/std/encoding/punycode.yo +86 -116
- package/std/encoding/toml.yo +67 -66
- package/std/encoding/utf16.yo +37 -44
- package/std/env.yo +62 -91
- package/std/error.yo +12 -20
- package/std/fmt/display.yo +5 -9
- package/std/fmt/index.yo +8 -14
- package/std/fmt/to_string.yo +330 -315
- package/std/fmt/writer.yo +58 -87
- package/std/fs/dir.yo +83 -102
- package/std/fs/file.yo +147 -180
- package/std/fs/metadata.yo +45 -78
- package/std/fs/temp.yo +55 -65
- package/std/fs/types.yo +27 -40
- package/std/fs/walker.yo +53 -68
- package/std/gc.yo +5 -8
- package/std/glob.yo +30 -43
- package/std/http/client.yo +107 -120
- package/std/http/http.yo +106 -96
- package/std/http/index.yo +4 -6
- package/std/imm/list.yo +88 -93
- package/std/imm/map.yo +528 -464
- package/std/imm/set.yo +52 -57
- package/std/imm/sorted_map.yo +340 -286
- package/std/imm/sorted_set.yo +57 -63
- package/std/imm/string.yo +404 -345
- package/std/imm/vec.yo +173 -181
- package/std/io/reader.yo +3 -6
- package/std/io/writer.yo +4 -8
- package/std/libc/assert.yo +5 -9
- package/std/libc/ctype.yo +32 -22
- package/std/libc/dirent.yo +26 -25
- package/std/libc/errno.yo +164 -90
- package/std/libc/fcntl.yo +52 -45
- package/std/libc/float.yo +66 -44
- package/std/libc/limits.yo +42 -33
- package/std/libc/math.yo +53 -82
- package/std/libc/signal.yo +72 -47
- package/std/libc/stdatomic.yo +217 -188
- package/std/libc/stdint.yo +5 -29
- package/std/libc/stdio.yo +5 -29
- package/std/libc/stdlib.yo +32 -39
- package/std/libc/string.yo +5 -23
- package/std/libc/sys/stat.yo +58 -56
- package/std/libc/time.yo +5 -19
- package/std/libc/unistd.yo +5 -20
- package/std/libc/wctype.yo +6 -9
- package/std/libc/windows.yo +26 -30
- package/std/log.yo +41 -55
- package/std/net/addr.yo +102 -97
- package/std/net/dns.yo +27 -28
- package/std/net/errors.yo +50 -49
- package/std/net/tcp.yo +113 -124
- package/std/net/udp.yo +55 -66
- package/std/os/env.yo +35 -33
- package/std/os/signal.yo +15 -25
- package/std/path.yo +276 -311
- package/std/prelude.yo +6316 -4333
- package/std/process/command.yo +87 -103
- package/std/process/index.yo +12 -31
- package/std/regex/compiler.yo +196 -95
- package/std/regex/flags.yo +58 -39
- package/std/regex/index.yo +157 -173
- package/std/regex/match.yo +20 -31
- package/std/regex/node.yo +134 -152
- package/std/regex/parser.yo +283 -259
- package/std/regex/unicode.yo +172 -202
- package/std/regex/vm.yo +155 -171
- package/std/string/index.yo +5 -7
- package/std/string/rune.yo +45 -55
- package/std/string/string.yo +937 -964
- package/std/string/string_builder.yo +94 -104
- package/std/string/unicode.yo +46 -64
- package/std/sync/channel.yo +72 -73
- package/std/sync/cond.yo +31 -36
- package/std/sync/mutex.yo +30 -32
- package/std/sync/once.yo +13 -16
- package/std/sync/rwlock.yo +26 -31
- package/std/sync/waitgroup.yo +20 -25
- package/std/sys/advise.yo +16 -24
- package/std/sys/bufio/buf_reader.yo +77 -93
- package/std/sys/bufio/buf_writer.yo +52 -65
- package/std/sys/clock.yo +4 -9
- package/std/sys/constants.yo +77 -61
- package/std/sys/copy.yo +4 -10
- package/std/sys/dir.yo +26 -43
- package/std/sys/dns.yo +41 -61
- package/std/sys/errors.yo +95 -103
- package/std/sys/events.yo +45 -57
- package/std/sys/externs.yo +319 -267
- package/std/sys/fallocate.yo +7 -11
- package/std/sys/fcntl.yo +14 -22
- package/std/sys/file.yo +26 -40
- package/std/sys/future.yo +5 -8
- package/std/sys/iov.yo +12 -25
- package/std/sys/lock.yo +12 -13
- package/std/sys/mmap.yo +38 -43
- package/std/sys/path.yo +3 -8
- package/std/sys/perm.yo +7 -21
- package/std/sys/pipe.yo +5 -12
- package/std/sys/process.yo +23 -29
- package/std/sys/seek.yo +10 -12
- package/std/sys/signal.yo +7 -13
- package/std/sys/signals.yo +52 -35
- package/std/sys/socket.yo +63 -58
- package/std/sys/socketpair.yo +3 -6
- package/std/sys/sockinfo.yo +11 -20
- package/std/sys/statfs.yo +11 -34
- package/std/sys/statx.yo +25 -52
- package/std/sys/sysinfo.yo +15 -20
- package/std/sys/tcp.yo +62 -92
- package/std/sys/temp.yo +5 -9
- package/std/sys/time.yo +5 -15
- package/std/sys/timer.yo +6 -11
- package/std/sys/tty.yo +10 -18
- package/std/sys/udp.yo +22 -39
- package/std/sys/umask.yo +3 -6
- package/std/sys/unix.yo +33 -52
- package/std/testing/bench.yo +49 -52
- package/std/thread.yo +10 -15
- package/std/time/datetime.yo +105 -89
- package/std/time/duration.yo +43 -56
- package/std/time/instant.yo +13 -18
- package/std/time/sleep.yo +5 -9
- package/std/url/index.yo +184 -209
- package/std/worker.yo +6 -10
- package/out/types/src/evaluator/calls/module-type.d.ts +0 -11
- package/out/types/src/evaluator/types/module.d.ts +0 -19
package/std/build.yo
CHANGED
|
@@ -13,28 +13,24 @@
|
|
|
13
13
|
//! install :: build.step("install", "Build all artifacts");
|
|
14
14
|
//! install.depend_on(exe);
|
|
15
15
|
//! ```
|
|
16
|
-
|
|
17
16
|
// ── Optimization levels ──────────────────────────────────────────────
|
|
18
|
-
|
|
19
17
|
/// Optimization level for compiled artifacts.
|
|
20
18
|
Optimize :: enum(
|
|
21
|
-
/// No optimizations, full debug info.
|
|
19
|
+
/// No optimizations, full debug info.
|
|
22
20
|
/// Compiler Flags: `-O0 -g`
|
|
23
21
|
Debug,
|
|
24
|
-
/// Optimized with safety checks.
|
|
22
|
+
/// Optimized with safety checks.
|
|
25
23
|
/// Compiler Flags: `-O2 -g`
|
|
26
24
|
ReleaseSafe,
|
|
27
|
-
/// Maximum speed optimizations.
|
|
25
|
+
/// Maximum speed optimizations.
|
|
28
26
|
/// Compiler Flags: `-O3`
|
|
29
27
|
ReleaseFast,
|
|
30
|
-
/// Optimize for binary size.
|
|
28
|
+
/// Optimize for binary size.
|
|
31
29
|
/// Compiler Flags `-O2`
|
|
32
30
|
ReleaseSmall
|
|
33
31
|
);
|
|
34
|
-
export
|
|
35
|
-
|
|
32
|
+
export(Optimize);
|
|
36
33
|
// ── Memory allocators ────────────────────────────────────────────────
|
|
37
|
-
|
|
38
34
|
/// Memory allocator to use in the compiled artifact.
|
|
39
35
|
Allocator :: enum(
|
|
40
36
|
/// High-performance allocator (mimalloc).
|
|
@@ -42,10 +38,8 @@ Allocator :: enum(
|
|
|
42
38
|
/// Standard C library malloc.
|
|
43
39
|
Libc
|
|
44
40
|
);
|
|
45
|
-
export
|
|
46
|
-
|
|
41
|
+
export(Allocator);
|
|
47
42
|
// ── Sanitizers ───────────────────────────────────────────────────────
|
|
48
|
-
|
|
49
43
|
/// Runtime sanitizer to enable.
|
|
50
44
|
Sanitize :: enum(
|
|
51
45
|
/// No sanitizer.
|
|
@@ -55,10 +49,8 @@ Sanitize :: enum(
|
|
|
55
49
|
/// LeakSanitizer — detects memory leaks only.
|
|
56
50
|
Leak
|
|
57
51
|
);
|
|
58
|
-
export
|
|
59
|
-
|
|
52
|
+
export(Sanitize);
|
|
60
53
|
// ── Step kinds ───────────────────────────────────────────────────────
|
|
61
|
-
|
|
62
54
|
/// Kind of build step.
|
|
63
55
|
StepKind :: enum(
|
|
64
56
|
Executable,
|
|
@@ -70,31 +62,15 @@ StepKind :: enum(
|
|
|
70
62
|
Custom,
|
|
71
63
|
Documentation
|
|
72
64
|
);
|
|
73
|
-
export
|
|
74
|
-
|
|
65
|
+
export(StepKind);
|
|
75
66
|
// ── Compilation targets ──────────────────────────────────────────────
|
|
76
|
-
|
|
77
|
-
CompilationTarget
|
|
78
|
-
X86_64_Linux_Gnu: "x86_64-linux-gnu",
|
|
79
|
-
X86_64_Linux_Musl: "x86_64-linux-musl",
|
|
80
|
-
Aarch64_Linux_Gnu: "aarch64-linux-gnu",
|
|
81
|
-
Aarch64_Linux_Musl: "aarch64-linux-musl",
|
|
82
|
-
Aarch64_Macos: "aarch64-macos",
|
|
83
|
-
X86_64_Macos: "x86_64-macos",
|
|
84
|
-
X86_64_Windows_Msvc: "x86_64-windows-msvc",
|
|
85
|
-
Wasm32_Emscripten: "wasm32-emscripten",
|
|
86
|
-
Wasm32_Wasi: "wasm32-wasi"
|
|
87
|
-
};
|
|
88
|
-
export CompilationTarget;
|
|
89
|
-
|
|
67
|
+
CompilationTarget :: { X86_64_Linux_Gnu : "x86_64-linux-gnu", X86_64_Linux_Musl : "x86_64-linux-musl", Aarch64_Linux_Gnu : "aarch64-linux-gnu", Aarch64_Linux_Musl : "aarch64-linux-musl", Aarch64_Macos : "aarch64-macos", X86_64_Macos : "x86_64-macos", X86_64_Windows_Msvc : "x86_64-windows-msvc", Wasm32_Emscripten : "wasm32-emscripten", Wasm32_Wasi : "wasm32-wasi" };
|
|
68
|
+
export(CompilationTarget);
|
|
90
69
|
// ── Target utilities ─────────────────────────────────────────────────
|
|
91
|
-
|
|
92
70
|
/// Host compilation target string.
|
|
93
71
|
target_host :: __yo_build_target_host();
|
|
94
|
-
export
|
|
95
|
-
|
|
72
|
+
export(target_host);
|
|
96
73
|
// ── Config struct types ──────────────────────────────────────────────
|
|
97
|
-
|
|
98
74
|
/// Configuration for building an executable.
|
|
99
75
|
Executable :: struct(
|
|
100
76
|
/// Artifact name.
|
|
@@ -110,8 +86,7 @@ Executable :: struct(
|
|
|
110
86
|
/// Runtime sanitizer.
|
|
111
87
|
(sanitize : Sanitize) ?= Sanitize.None
|
|
112
88
|
);
|
|
113
|
-
export
|
|
114
|
-
|
|
89
|
+
export(Executable);
|
|
115
90
|
/// Configuration for building a static library.
|
|
116
91
|
StaticLibrary :: struct(
|
|
117
92
|
/// Artifact name.
|
|
@@ -123,8 +98,7 @@ StaticLibrary :: struct(
|
|
|
123
98
|
/// Optimization level.
|
|
124
99
|
(optimize : Optimize) ?= Optimize.Debug
|
|
125
100
|
);
|
|
126
|
-
export
|
|
127
|
-
|
|
101
|
+
export(StaticLibrary);
|
|
128
102
|
/// Configuration for building a shared/dynamic library.
|
|
129
103
|
SharedLibrary :: struct(
|
|
130
104
|
/// Artifact name.
|
|
@@ -136,8 +110,7 @@ SharedLibrary :: struct(
|
|
|
136
110
|
/// Optimization level.
|
|
137
111
|
(optimize : Optimize) ?= Optimize.Debug
|
|
138
112
|
);
|
|
139
|
-
export
|
|
140
|
-
|
|
113
|
+
export(SharedLibrary);
|
|
141
114
|
/// Configuration for a test suite.
|
|
142
115
|
TestSuite :: struct(
|
|
143
116
|
/// Suite name.
|
|
@@ -147,10 +120,8 @@ TestSuite :: struct(
|
|
|
147
120
|
/// Compilation target triple (defaults to host).
|
|
148
121
|
(target : comptime_string) ?= __yo_build_target_host()
|
|
149
122
|
);
|
|
150
|
-
export
|
|
151
|
-
|
|
123
|
+
export(TestSuite);
|
|
152
124
|
// ── Build module type ────────────────────────────────────────────────
|
|
153
|
-
|
|
154
125
|
/// Represents a named source module that declares system library requirements.
|
|
155
126
|
/// Modules are the unit of reuse across Yo dependencies.
|
|
156
127
|
BuildModule :: struct(
|
|
@@ -160,10 +131,8 @@ BuildModule :: struct(
|
|
|
160
131
|
root : comptime_string,
|
|
161
132
|
_dep : comptime_string
|
|
162
133
|
);
|
|
163
|
-
export
|
|
164
|
-
|
|
134
|
+
export(BuildModule);
|
|
165
135
|
// ── Import entry type ────────────────────────────────────────────────
|
|
166
|
-
|
|
167
136
|
/// Pairs an import name with a module for use with `add_import`/`add_import_list`.
|
|
168
137
|
ImportEntry :: struct(
|
|
169
138
|
/// Import alias used in source code.
|
|
@@ -171,10 +140,8 @@ ImportEntry :: struct(
|
|
|
171
140
|
/// The module to import.
|
|
172
141
|
module : BuildModule
|
|
173
142
|
);
|
|
174
|
-
export
|
|
175
|
-
|
|
143
|
+
export(ImportEntry);
|
|
176
144
|
// ── Step type ────────────────────────────────────────────────────────
|
|
177
|
-
|
|
178
145
|
/// A build step returned by all registration functions.
|
|
179
146
|
/// Use `step.depend_on(dep)` to wire dependencies between steps.
|
|
180
147
|
Step :: struct(
|
|
@@ -183,11 +150,10 @@ Step :: struct(
|
|
|
183
150
|
/// Kind of step.
|
|
184
151
|
kind : StepKind
|
|
185
152
|
);
|
|
186
|
-
export
|
|
187
|
-
|
|
153
|
+
export(Step);
|
|
188
154
|
// ── Step methods ─────────────────────────────────────────────────────
|
|
189
|
-
|
|
190
|
-
|
|
155
|
+
impl(
|
|
156
|
+
Step,
|
|
191
157
|
/// Add a dependency — `dep` must complete before this step runs.
|
|
192
158
|
depend_on : (fn(comptime(self) : Self, comptime(dep) : Step) -> comptime(unit))({
|
|
193
159
|
__yo_build_step_depend_on(self.name, dep.name, dep.kind);
|
|
@@ -215,20 +181,17 @@ impl(Step,
|
|
|
215
181
|
__yo_build_add_cflags(self.name, flags);
|
|
216
182
|
})
|
|
217
183
|
);
|
|
218
|
-
|
|
219
184
|
// ── Build module methods ─────────────────────────────────────────────
|
|
220
|
-
|
|
221
|
-
|
|
185
|
+
impl(
|
|
186
|
+
BuildModule,
|
|
222
187
|
/// Link a system library into this module.
|
|
223
188
|
link : (fn(comptime(self) : Self, comptime(library) : Step) -> comptime(unit))({
|
|
224
189
|
__yo_build_module_link(self.name, library.name);
|
|
225
190
|
})
|
|
226
191
|
);
|
|
227
|
-
|
|
228
192
|
// ── Build option config types ────────────────────────────────────────
|
|
229
193
|
// Like Zig's b.option(), declare user-configurable options.
|
|
230
194
|
// CLI usage: yo build -Dname=value
|
|
231
|
-
|
|
232
195
|
/// User-configurable build option (declared in `build.yo`, set via `yo build -Dname=value`).
|
|
233
196
|
BuildOption :: struct(
|
|
234
197
|
/// Option name (used with `-D`).
|
|
@@ -238,10 +201,8 @@ BuildOption :: struct(
|
|
|
238
201
|
/// Default value if not provided.
|
|
239
202
|
(default : comptime_string) ?= ""
|
|
240
203
|
);
|
|
241
|
-
export
|
|
242
|
-
|
|
204
|
+
export(BuildOption);
|
|
243
205
|
// ── Dependency config types ──────────────────────────────────────────
|
|
244
|
-
|
|
245
206
|
/// Git-hosted dependency configuration.
|
|
246
207
|
GitDependency :: struct(
|
|
247
208
|
/// Dependency name.
|
|
@@ -253,8 +214,7 @@ GitDependency :: struct(
|
|
|
253
214
|
/// Subdirectory within the repository.
|
|
254
215
|
(path : comptime_string) ?= ""
|
|
255
216
|
);
|
|
256
|
-
export
|
|
257
|
-
|
|
217
|
+
export(GitDependency);
|
|
258
218
|
/// Local path dependency configuration.
|
|
259
219
|
PathDependency :: struct(
|
|
260
220
|
/// Dependency name.
|
|
@@ -262,8 +222,7 @@ PathDependency :: struct(
|
|
|
262
222
|
/// Filesystem path to the dependency root.
|
|
263
223
|
path : comptime_string
|
|
264
224
|
);
|
|
265
|
-
export
|
|
266
|
-
|
|
225
|
+
export(PathDependency);
|
|
267
226
|
/// System C library discovered via `pkg-config`.
|
|
268
227
|
SystemLibrary :: struct(
|
|
269
228
|
/// Library name (passed to `pkg-config`).
|
|
@@ -277,130 +236,124 @@ SystemLibrary :: struct(
|
|
|
277
236
|
/// Extra C preprocessor defines.
|
|
278
237
|
(defines : comptime_string) ?= ""
|
|
279
238
|
);
|
|
280
|
-
export
|
|
281
|
-
|
|
239
|
+
export(SystemLibrary);
|
|
282
240
|
// ── Dependency handle ────────────────────────────────────────────────
|
|
283
241
|
// Returned by build.dependency() and build.path_dependency().
|
|
284
242
|
// Provides access to artifacts defined in the dependency's build.yo.
|
|
285
|
-
|
|
286
243
|
/// Handle to a registered dependency. Use `.artifact()` or `.module()` to access its exports.
|
|
287
244
|
Dependency :: struct(
|
|
288
245
|
name : comptime_string
|
|
289
246
|
);
|
|
290
|
-
export
|
|
291
|
-
|
|
292
|
-
|
|
247
|
+
export(Dependency);
|
|
248
|
+
impl(
|
|
249
|
+
Dependency,
|
|
293
250
|
/// Access a named artifact from the dependency's `build.yo`.
|
|
294
251
|
/// Returns a `Step` that can be linked to the consumer's artifacts.
|
|
295
252
|
artifact : (fn(comptime(self) : Self, comptime(artifact_name) : comptime_string) -> comptime(Step))({
|
|
296
253
|
__yo_build_dep_artifact(self.name, artifact_name);
|
|
297
|
-
Step(name: artifact_name, kind: StepKind.StaticLibrary)
|
|
254
|
+
Step(name : artifact_name, kind : StepKind.StaticLibrary)
|
|
298
255
|
}),
|
|
299
256
|
/// Get a module from the dependency's `build.yo`.
|
|
300
257
|
/// Empty `module_name` defaults to the sole module if exactly one exists.
|
|
301
258
|
module : (fn(comptime(self) : Self, (comptime(module_name) : comptime_string) ?= "") -> comptime(BuildModule))({
|
|
302
259
|
_encoded :: __yo_build_dep_module(self.name, module_name);
|
|
303
|
-
BuildModule(name: module_name, root: "", _dep: self.name)
|
|
260
|
+
BuildModule(name : module_name, root : "", _dep : self.name)
|
|
304
261
|
})
|
|
305
262
|
);
|
|
306
|
-
|
|
307
263
|
// ── Build functions ──────────────────────────────────────────────────
|
|
308
264
|
// All registration functions return a Step value, allowing steps to be
|
|
309
265
|
// wired together as dependencies via step.depend_on(dep).
|
|
310
|
-
|
|
311
266
|
/// Register an executable artifact. Returns a `Step` for dependency wiring.
|
|
312
|
-
executable :: (fn(comptime(config) : Executable) -> comptime(Step))
|
|
313
|
-
opt_str :: match(
|
|
267
|
+
executable :: (fn(comptime(config) : Executable) -> comptime(Step))({
|
|
268
|
+
opt_str :: match(
|
|
269
|
+
config.optimize,
|
|
314
270
|
.Debug => "debug",
|
|
315
271
|
.ReleaseSafe => "release-safe",
|
|
316
272
|
.ReleaseFast => "release-fast",
|
|
317
273
|
.ReleaseSmall => "release-small"
|
|
318
274
|
);
|
|
319
|
-
alloc_str :: match(
|
|
275
|
+
alloc_str :: match(
|
|
276
|
+
config.allocator,
|
|
320
277
|
.Mimalloc => "mimalloc",
|
|
321
278
|
.Libc => "libc"
|
|
322
279
|
);
|
|
323
|
-
san_str :: match(
|
|
280
|
+
san_str :: match(
|
|
281
|
+
config.sanitize,
|
|
324
282
|
.None => "none",
|
|
325
283
|
.Address => "address",
|
|
326
284
|
.Leak => "leak"
|
|
327
285
|
);
|
|
328
286
|
__yo_build_executable(config.name, config.root, config.target, opt_str, alloc_str, san_str);
|
|
329
|
-
Step(name: config.name, kind: StepKind.Executable)
|
|
330
|
-
};
|
|
331
|
-
export
|
|
332
|
-
|
|
287
|
+
Step(name : config.name, kind : StepKind.Executable)
|
|
288
|
+
});
|
|
289
|
+
export(executable);
|
|
333
290
|
/// Register a static library artifact. Returns a `Step` for dependency wiring.
|
|
334
|
-
static_library :: (fn(comptime(config) : StaticLibrary) -> comptime(Step))
|
|
335
|
-
opt_str :: match(
|
|
291
|
+
static_library :: (fn(comptime(config) : StaticLibrary) -> comptime(Step))({
|
|
292
|
+
opt_str :: match(
|
|
293
|
+
config.optimize,
|
|
336
294
|
.Debug => "debug",
|
|
337
295
|
.ReleaseSafe => "release-safe",
|
|
338
296
|
.ReleaseFast => "release-fast",
|
|
339
297
|
.ReleaseSmall => "release-small"
|
|
340
298
|
);
|
|
341
299
|
__yo_build_static_library(config.name, config.root, config.target, opt_str);
|
|
342
|
-
Step(name: config.name, kind: StepKind.StaticLibrary)
|
|
343
|
-
};
|
|
344
|
-
export
|
|
345
|
-
|
|
300
|
+
Step(name : config.name, kind : StepKind.StaticLibrary)
|
|
301
|
+
});
|
|
302
|
+
export(static_library);
|
|
346
303
|
/// Register a shared/dynamic library artifact. Returns a `Step` for dependency wiring.
|
|
347
|
-
shared_library :: (fn(comptime(config) : SharedLibrary) -> comptime(Step))
|
|
348
|
-
opt_str :: match(
|
|
304
|
+
shared_library :: (fn(comptime(config) : SharedLibrary) -> comptime(Step))({
|
|
305
|
+
opt_str :: match(
|
|
306
|
+
config.optimize,
|
|
349
307
|
.Debug => "debug",
|
|
350
308
|
.ReleaseSafe => "release-safe",
|
|
351
309
|
.ReleaseFast => "release-fast",
|
|
352
310
|
.ReleaseSmall => "release-small"
|
|
353
311
|
);
|
|
354
312
|
__yo_build_shared_library(config.name, config.root, config.target, opt_str);
|
|
355
|
-
Step(name: config.name, kind: StepKind.SharedLibrary)
|
|
356
|
-
};
|
|
357
|
-
export
|
|
358
|
-
|
|
313
|
+
Step(name : config.name, kind : StepKind.SharedLibrary)
|
|
314
|
+
});
|
|
315
|
+
export(shared_library);
|
|
359
316
|
/// Register a test-suite artifact. Returns a `Step` for dependency wiring.
|
|
360
|
-
test :: (fn(comptime(config) : TestSuite) -> comptime(Step))
|
|
317
|
+
test :: (fn(comptime(config) : TestSuite) -> comptime(Step))({
|
|
361
318
|
__yo_build_test(config.name, config.root, config.target);
|
|
362
|
-
Step(name: config.name, kind: StepKind.TestSuite)
|
|
363
|
-
};
|
|
364
|
-
export
|
|
365
|
-
|
|
319
|
+
Step(name : config.name, kind : StepKind.TestSuite)
|
|
320
|
+
});
|
|
321
|
+
export(test);
|
|
366
322
|
/// Create a run step (compile + execute an artifact). Returns a `Step`.
|
|
367
|
-
run :: (fn(comptime(artifact) : Step) -> comptime(Step))
|
|
323
|
+
run :: (fn(comptime(artifact) : Step) -> comptime(Step))({
|
|
368
324
|
__yo_build_run(artifact.name);
|
|
369
|
-
Step(name: artifact.name, kind: StepKind.Run)
|
|
370
|
-
};
|
|
371
|
-
export
|
|
372
|
-
|
|
325
|
+
Step(name : artifact.name, kind : StepKind.Run)
|
|
326
|
+
});
|
|
327
|
+
export(run);
|
|
373
328
|
/// Register a named build step. Use `step.depend_on(dep)` to add dependencies.
|
|
374
|
-
step :: (
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
329
|
+
step :: (
|
|
330
|
+
fn(
|
|
331
|
+
comptime(name) : comptime_string,
|
|
332
|
+
comptime(description) : comptime_string
|
|
333
|
+
) -> comptime(Step)
|
|
334
|
+
)({
|
|
378
335
|
__yo_build_step(name, description);
|
|
379
|
-
Step(name: name, kind: StepKind.Custom)
|
|
380
|
-
};
|
|
381
|
-
export
|
|
382
|
-
|
|
336
|
+
Step(name : name, kind : StepKind.Custom)
|
|
337
|
+
});
|
|
338
|
+
export(step);
|
|
383
339
|
/// Register a git-hosted dependency. Returns a `Dependency` handle for accessing artifacts.
|
|
384
|
-
dependency :: (fn(comptime(config) : GitDependency) -> comptime(Dependency))
|
|
340
|
+
dependency :: (fn(comptime(config) : GitDependency) -> comptime(Dependency))({
|
|
385
341
|
__yo_build_dependency(config.name, config.url, config.ref, config.path);
|
|
386
|
-
Dependency(name: config.name)
|
|
387
|
-
};
|
|
388
|
-
export
|
|
389
|
-
|
|
342
|
+
Dependency(name : config.name)
|
|
343
|
+
});
|
|
344
|
+
export(dependency);
|
|
390
345
|
/// Register a local path dependency. Returns a `Dependency` handle for accessing artifacts.
|
|
391
|
-
path_dependency :: (fn(comptime(config) : PathDependency) -> comptime(Dependency))
|
|
346
|
+
path_dependency :: (fn(comptime(config) : PathDependency) -> comptime(Dependency))({
|
|
392
347
|
__yo_build_path_dependency(config.name, config.path);
|
|
393
|
-
Dependency(name: config.name)
|
|
394
|
-
};
|
|
395
|
-
export
|
|
396
|
-
|
|
348
|
+
Dependency(name : config.name)
|
|
349
|
+
});
|
|
350
|
+
export(path_dependency);
|
|
397
351
|
/// Register a system C library discovered via `pkg-config`. Returns a `Step` for linking.
|
|
398
|
-
system_library :: (fn(comptime(config) : SystemLibrary) -> comptime(Step))
|
|
352
|
+
system_library :: (fn(comptime(config) : SystemLibrary) -> comptime(Step))({
|
|
399
353
|
__yo_build_system_library(config.name, config.fallback_include, config.fallback_lib, config.fallback_link, config.defines);
|
|
400
|
-
Step(name: config.name, kind: StepKind.SystemLibrary)
|
|
401
|
-
};
|
|
402
|
-
export
|
|
403
|
-
|
|
354
|
+
Step(name : config.name, kind : StepKind.SystemLibrary)
|
|
355
|
+
});
|
|
356
|
+
export(system_library);
|
|
404
357
|
/// Module configuration for shared compilation units.
|
|
405
358
|
ModuleConfig :: struct(
|
|
406
359
|
/// Module name.
|
|
@@ -408,16 +361,14 @@ ModuleConfig :: struct(
|
|
|
408
361
|
/// Root source file for the module.
|
|
409
362
|
root : comptime_string
|
|
410
363
|
);
|
|
411
|
-
export
|
|
412
|
-
|
|
364
|
+
export(ModuleConfig);
|
|
413
365
|
/// Register a named module. Returns a `BuildModule` for linking system libraries
|
|
414
366
|
/// and importing into executables/libraries.
|
|
415
|
-
_module :: (fn(comptime(config) : ModuleConfig) -> comptime(BuildModule))
|
|
367
|
+
_module :: (fn(comptime(config) : ModuleConfig) -> comptime(BuildModule))({
|
|
416
368
|
__yo_build_module(config.name, config.root);
|
|
417
|
-
BuildModule(name: config.name, root: config.root, _dep: "")
|
|
418
|
-
};
|
|
419
|
-
export
|
|
420
|
-
|
|
369
|
+
BuildModule(name : config.name, root : config.root, _dep : "")
|
|
370
|
+
});
|
|
371
|
+
export(module : _module);
|
|
421
372
|
/// Declare a user-configurable build option.
|
|
422
373
|
/// Returns the option value (from CLI `-Dname=value`, or the default).
|
|
423
374
|
///
|
|
@@ -432,18 +383,15 @@ export module : _module;
|
|
|
432
383
|
option :: (fn(comptime(config) : BuildOption) -> comptime(str))(
|
|
433
384
|
__yo_build_option(config.name, config.description, config.default)
|
|
434
385
|
);
|
|
435
|
-
export
|
|
436
|
-
|
|
386
|
+
export(option);
|
|
437
387
|
// ── Documentation generation ─────────────────────────────────────────
|
|
438
|
-
|
|
439
388
|
/// Output format for documentation generation.
|
|
440
389
|
DocFormat :: enum(
|
|
441
390
|
Html,
|
|
442
391
|
Markdown,
|
|
443
392
|
Json
|
|
444
393
|
);
|
|
445
|
-
export
|
|
446
|
-
|
|
394
|
+
export(DocFormat);
|
|
447
395
|
/// Configuration for documentation generation.
|
|
448
396
|
DocConfig :: struct(
|
|
449
397
|
/// Step name (e.g., "doc").
|
|
@@ -468,8 +416,7 @@ DocConfig :: struct(
|
|
|
468
416
|
/// Path to favicon.
|
|
469
417
|
(favicon : comptime_string) ?= ""
|
|
470
418
|
);
|
|
471
|
-
export
|
|
472
|
-
|
|
419
|
+
export(DocConfig);
|
|
473
420
|
/// Register a documentation generation step. Returns a Step for dependency wiring.
|
|
474
421
|
///
|
|
475
422
|
/// # Examples
|
|
@@ -493,18 +440,25 @@ export DocConfig;
|
|
|
493
440
|
/// install :: build.step("install", "Build all artifacts");
|
|
494
441
|
/// install.depend_on(doc_step);
|
|
495
442
|
/// ```
|
|
496
|
-
doc :: (fn(comptime(config) : DocConfig) -> comptime(Step))
|
|
497
|
-
fmt_str :: match(
|
|
443
|
+
doc :: (fn(comptime(config) : DocConfig) -> comptime(Step))({
|
|
444
|
+
fmt_str :: match(
|
|
445
|
+
config.format,
|
|
498
446
|
.Html => "html",
|
|
499
447
|
.Markdown => "markdown",
|
|
500
448
|
.Json => "json"
|
|
501
449
|
);
|
|
502
450
|
__yo_build_doc(
|
|
503
|
-
config.name,
|
|
504
|
-
config.
|
|
505
|
-
config.
|
|
451
|
+
config.name,
|
|
452
|
+
config.root,
|
|
453
|
+
config.output,
|
|
454
|
+
fmt_str,
|
|
455
|
+
config.include_private,
|
|
456
|
+
config.include_deps,
|
|
457
|
+
config.title,
|
|
458
|
+
config.logo,
|
|
459
|
+
config.favicon,
|
|
506
460
|
config.version
|
|
507
461
|
);
|
|
508
|
-
Step(name: config.name, kind: StepKind.Documentation)
|
|
509
|
-
};
|
|
510
|
-
export
|
|
462
|
+
Step(name : config.name, kind : StepKind.Documentation)
|
|
463
|
+
});
|
|
464
|
+
export(doc);
|