@native-sdk/cli 0.8.4 → 0.9.0
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/build/app.zig +859 -62
- package/build.zig +543 -13
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +2 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +365 -2
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +149 -0
- package/packages/core/sdk/core.ts +529 -12
- package/packages/core/sdk/events.d.ts +36 -0
- package/packages/core/sdk/events.ts +57 -0
- package/packages/core/src/checker.ts +468 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1847 -16
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +82 -16
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/references/project-anatomy.md +1 -1
- package/skill-data/native-ui/SKILL.md +47 -0
- package/skill-data/ts-core/SKILL.md +80 -31
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +249 -8
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +109 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +119 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +40 -18
- package/src/platform/macos/appkit_host.h +16 -3
- package/src/platform/macos/appkit_host.m +536 -36
- package/src/platform/macos/cef_host.mm +248 -36
- package/src/platform/macos/root.zig +244 -34
- package/src/platform/null_platform.zig +223 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +9 -0
- package/src/platform/types.zig +179 -15
- package/src/platform/windows/root.zig +187 -21
- package/src/platform/windows/webview2_host.cpp +293 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/root.zig +46 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +18 -11
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2295 -113
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +49 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +4 -0
- package/src/runtime/ts_core_host.zig +788 -86
- package/src/runtime/ts_core_host_tests.zig +231 -11
- package/src/runtime/ts_ui_app.zig +499 -1
- package/src/runtime/ui_app.zig +142 -16
- package/src/runtime/ui_app_tests.zig +155 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +9 -0
- package/src/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +214 -2
- package/src/tooling/package.zig +116 -0
- package/src/tooling/raw_manifest.zig +30 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +161 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +378 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
package/build.zig
CHANGED
|
@@ -43,6 +43,60 @@ pub const MobileLibOptions = @import("build/app.zig").MobileLibOptions;
|
|
|
43
43
|
pub const addMobileLib = @import("build/app.zig").addMobileLib;
|
|
44
44
|
const mobile_export_symbol_names = @import("build/app.zig").mobile_export_symbol_names;
|
|
45
45
|
|
|
46
|
+
test "service archive support matches ScriptC localized object formats" {
|
|
47
|
+
const app_build = @import("build/app.zig");
|
|
48
|
+
const host = @import("builtin").target;
|
|
49
|
+
const resolved = struct {
|
|
50
|
+
fn target(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch, abi: std.Target.Abi) std.Build.ResolvedTarget {
|
|
51
|
+
var result = host;
|
|
52
|
+
result.os.tag = os;
|
|
53
|
+
result.cpu.arch = arch;
|
|
54
|
+
result.abi = abi;
|
|
55
|
+
return .{
|
|
56
|
+
.query = .{ .os_tag = os, .cpu_arch = arch, .abi = abi },
|
|
57
|
+
.result = result,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}.target;
|
|
61
|
+
|
|
62
|
+
var macos_host = host;
|
|
63
|
+
macos_host.os.tag = .macos;
|
|
64
|
+
macos_host.cpu.arch = .aarch64;
|
|
65
|
+
macos_host.abi = .none;
|
|
66
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.windows, .x86_64, .gnu)));
|
|
67
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.windows, .x86_64, .msvc)));
|
|
68
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.windows, .aarch64, .gnu)));
|
|
69
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.linux, .x86_64, .musl)));
|
|
70
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.linux, .aarch64, .musl)));
|
|
71
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.linux, .riscv64, .musl)));
|
|
72
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.macos, .x86_64, .none)));
|
|
73
|
+
|
|
74
|
+
var linux_host = host;
|
|
75
|
+
linux_host.os.tag = .linux;
|
|
76
|
+
linux_host.cpu.arch = .riscv64;
|
|
77
|
+
linux_host.abi = .musl;
|
|
78
|
+
try std.testing.expect(app_build.serviceArchiveSupported(linux_host, .{ .query = .{}, .result = linux_host }));
|
|
79
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(linux_host, resolved(.macos, .aarch64, .none)));
|
|
80
|
+
|
|
81
|
+
var gnu_linux_host = host;
|
|
82
|
+
gnu_linux_host.os.tag = .linux;
|
|
83
|
+
gnu_linux_host.cpu.arch = .x86_64;
|
|
84
|
+
gnu_linux_host.abi = .gnu;
|
|
85
|
+
const explicit_same_triple_gnu = resolved(.linux, .x86_64, .gnu);
|
|
86
|
+
try std.testing.expect(!app_build.scriptcTargetIsCross(gnu_linux_host, explicit_same_triple_gnu));
|
|
87
|
+
try std.testing.expect(app_build.linuxGlibcSpellingHitsDefaultFloor(explicit_same_triple_gnu));
|
|
88
|
+
try std.testing.expect(!app_build.linuxGlibcSpellingHitsDefaultFloor(.{ .query = .{}, .result = gnu_linux_host }));
|
|
89
|
+
|
|
90
|
+
var windows_host = host;
|
|
91
|
+
windows_host.os.tag = .windows;
|
|
92
|
+
windows_host.cpu.arch = .x86_64;
|
|
93
|
+
windows_host.abi = .gnu;
|
|
94
|
+
const native_windows_msvc = resolved(.windows, .x86_64, .msvc);
|
|
95
|
+
try std.testing.expect(!app_build.scriptcTargetIsCross(windows_host, native_windows_msvc));
|
|
96
|
+
try std.testing.expect(app_build.scriptcCompileSupported(windows_host, native_windows_msvc));
|
|
97
|
+
try std.testing.expect(app_build.serviceArchiveSupported(windows_host, native_windows_msvc));
|
|
98
|
+
}
|
|
99
|
+
|
|
46
100
|
pub fn build(b: *std.Build) void {
|
|
47
101
|
const target = b.standardTargetOptions(.{});
|
|
48
102
|
const host_target = b.graph.host;
|
|
@@ -141,9 +195,28 @@ pub fn build(b: *std.Build) void {
|
|
|
141
195
|
desktop_mod.addImport("json", json_mod);
|
|
142
196
|
desktop_mod.addImport("canvas", canvas_mod);
|
|
143
197
|
desktop_mod.addImport("terminal_vt", terminalVtModule(b, target, optimize));
|
|
198
|
+
desktop_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
199
|
+
desktop_mod.addCSourceFile(.{
|
|
200
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
201
|
+
.flags = sqliteCompileFlags(),
|
|
202
|
+
});
|
|
203
|
+
desktop_mod.link_libc = true;
|
|
144
204
|
const desktop_tests = testArtifact(b, desktop_mod);
|
|
145
205
|
const desktop_test_shards = desktopTestShardArtifacts(b, desktop_mod);
|
|
146
206
|
|
|
207
|
+
// SQLite is capability-shed from ordinary app artifacts. Its focused
|
|
208
|
+
// engine/store suite gets a dedicated module that explicitly compiles the
|
|
209
|
+
// vendored amalgamation, so framework tests cover it without making every
|
|
210
|
+
// unrelated example carry the database object.
|
|
211
|
+
const record_store_mod = module(b, target, optimize, "src/runtime/record_store.zig");
|
|
212
|
+
record_store_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
213
|
+
record_store_mod.addCSourceFile(.{
|
|
214
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
215
|
+
.flags = sqliteCompileFlags(),
|
|
216
|
+
});
|
|
217
|
+
record_store_mod.link_libc = true;
|
|
218
|
+
const record_store_tests = testArtifact(b, record_store_mod);
|
|
219
|
+
|
|
147
220
|
// The embeddable static library's root module carries only the C ABI
|
|
148
221
|
// exports (fixed WebView shell host); user-app canvas libraries are
|
|
149
222
|
// produced by `addMobileLib` from src/embed/app_exports.zig instead.
|
|
@@ -188,6 +261,13 @@ pub fn build(b: *std.Build) void {
|
|
|
188
261
|
tooling_mod.addImport("app_icon", app_icon_mod);
|
|
189
262
|
tooling_mod.addImport("ios_host", ios_host_mod);
|
|
190
263
|
tooling_mod.addImport("android_host", android_host_mod);
|
|
264
|
+
tooling_mod.addImport("sqlite_engine", module(b, target, optimize, "src/runtime/sqlite_engine.zig"));
|
|
265
|
+
tooling_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
266
|
+
tooling_mod.addCSourceFile(.{
|
|
267
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
268
|
+
.flags = sqliteCompileFlags(),
|
|
269
|
+
});
|
|
270
|
+
tooling_mod.link_libc = true;
|
|
191
271
|
const tooling_tests = testArtifact(b, tooling_mod);
|
|
192
272
|
|
|
193
273
|
// Ejected-component identity proofs: a separate test module because
|
|
@@ -209,6 +289,8 @@ pub fn build(b: *std.Build) void {
|
|
|
209
289
|
const corewire_emit_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit.zig"));
|
|
210
290
|
const corewire_facade_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_facade.zig"));
|
|
211
291
|
const corewire_profile_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_profile.zig"));
|
|
292
|
+
const corewire_service_contract_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/service_contract.zig"));
|
|
293
|
+
const corewire_service_emit_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_service.zig"));
|
|
212
294
|
const corewire_shim_rt_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/shim_rt.zig"));
|
|
213
295
|
|
|
214
296
|
// TypeScript-core end-to-end suite: each fixture core is compiled
|
|
@@ -245,6 +327,7 @@ pub fn build(b: *std.Build) void {
|
|
|
245
327
|
// where the failure reads as the graded app's, not the tooling's.
|
|
246
328
|
const evals_cmdview_mod = module(b, target, optimize, "evals/harness-lib/cmdview.zig");
|
|
247
329
|
const evals_cmdview_tests = testArtifact(b, evals_cmdview_mod);
|
|
330
|
+
const build_graph_tests = testArtifact(b, module(b, host_target, optimize, "build.zig"));
|
|
248
331
|
|
|
249
332
|
// `native version` names the commit the binary was built from, so
|
|
250
333
|
// binary/framework skew ("your native binary may be stale") is a
|
|
@@ -298,6 +381,13 @@ pub fn build(b: *std.Build) void {
|
|
|
298
381
|
host_tooling_mod.addImport("app_icon", host_app_icon_mod);
|
|
299
382
|
host_tooling_mod.addImport("ios_host", host_ios_host_mod);
|
|
300
383
|
host_tooling_mod.addImport("android_host", host_android_host_mod);
|
|
384
|
+
host_tooling_mod.addImport("sqlite_engine", module(b, host_target, optimize, "src/runtime/sqlite_engine.zig"));
|
|
385
|
+
host_tooling_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
386
|
+
host_tooling_mod.addCSourceFile(.{
|
|
387
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
388
|
+
.flags = sqliteCompileFlags(),
|
|
389
|
+
});
|
|
390
|
+
host_tooling_mod.link_libc = true;
|
|
301
391
|
const host_ui_markup_mod = module(b, host_target, optimize, "src/primitives/canvas/ui_markup.zig");
|
|
302
392
|
const host_markup_lsp_mod = module(b, host_target, optimize, "tools/native-sdk/markup_lsp.zig");
|
|
303
393
|
host_markup_lsp_mod.addImport("ui_markup", host_ui_markup_mod);
|
|
@@ -462,6 +552,7 @@ pub fn build(b: *std.Build) void {
|
|
|
462
552
|
};
|
|
463
553
|
|
|
464
554
|
const test_step = b.step("test", "Run package and framework tests");
|
|
555
|
+
test_step.dependOn(&b.addRunArtifact(build_graph_tests).step);
|
|
465
556
|
test_step.dependOn(&b.addRunArtifact(geometry_tests).step);
|
|
466
557
|
test_step.dependOn(&b.addRunArtifact(assets_tests).step);
|
|
467
558
|
test_step.dependOn(&b.addRunArtifact(app_dirs_tests).step);
|
|
@@ -472,6 +563,7 @@ pub fn build(b: *std.Build) void {
|
|
|
472
563
|
test_step.dependOn(&b.addRunArtifact(json_tests).step);
|
|
473
564
|
test_step.dependOn(&b.addRunArtifact(app_runner_assets_tests).step);
|
|
474
565
|
test_step.dependOn(&b.addRunArtifact(canvas_tests).step);
|
|
566
|
+
test_step.dependOn(&b.addRunArtifact(record_store_tests).step);
|
|
475
567
|
for (desktop_test_shards) |shard_tests| {
|
|
476
568
|
test_step.dependOn(&b.addRunArtifact(shard_tests).step);
|
|
477
569
|
}
|
|
@@ -482,10 +574,14 @@ pub fn build(b: *std.Build) void {
|
|
|
482
574
|
test_step.dependOn(&b.addRunArtifact(corewire_emit_tests).step);
|
|
483
575
|
test_step.dependOn(&b.addRunArtifact(corewire_facade_tests).step);
|
|
484
576
|
test_step.dependOn(&b.addRunArtifact(corewire_profile_tests).step);
|
|
577
|
+
test_step.dependOn(&b.addRunArtifact(corewire_service_contract_tests).step);
|
|
578
|
+
test_step.dependOn(&b.addRunArtifact(corewire_service_emit_tests).step);
|
|
485
579
|
test_step.dependOn(&b.addRunArtifact(corewire_shim_rt_tests).step);
|
|
580
|
+
const ts_services_e2e_step = b.step("test-ts-services-e2e", "Run both TypeScript service carriers end to end: the out-of-process child (crash recovery, timeout, replay) and the in-process pool (parallel keys, FIFO, trap isolation, replay)");
|
|
486
581
|
if (ts_core_e2e_tests) |ts_core_artifacts| {
|
|
487
582
|
const ts_core_e2e_step = b.step("test-ts-core-e2e", "Run the TypeScript-core end-to-end suites over externally compiled fixture cores (requires node and `npm ci` in packages/core)");
|
|
488
583
|
const host_e2e_run = b.addRunArtifact(ts_core_artifacts.host);
|
|
584
|
+
const persist_e2e_run = b.addRunArtifact(ts_core_artifacts.persist);
|
|
489
585
|
const markup_e2e_run = b.addRunArtifact(ts_core_artifacts.markup);
|
|
490
586
|
const kanban_e2e_run = b.addRunArtifact(ts_core_artifacts.kanban);
|
|
491
587
|
const soundboard_e2e_run = b.addRunArtifact(ts_core_artifacts.soundboard);
|
|
@@ -495,6 +591,30 @@ pub fn build(b: *std.Build) void {
|
|
|
495
591
|
// no build inputs/outputs to hash, so always run it.
|
|
496
592
|
scaffold_ide_e2e_run.has_side_effects = true;
|
|
497
593
|
const ai_chat_e2e_run = b.addRunArtifact(ts_core_artifacts.ai_chat);
|
|
594
|
+
const services_e2e_run = b.addRunArtifact(ts_core_artifacts.services);
|
|
595
|
+
ts_services_e2e_step.dependOn(&services_e2e_run.step);
|
|
596
|
+
// The same fixture through the in-process carrier (ServicePool over
|
|
597
|
+
// the linked service archive): parallel keys, per-key FIFO,
|
|
598
|
+
// cooperative cancellation/deadlines, trap isolation, streaming,
|
|
599
|
+
// and replay without initializing the archive.
|
|
600
|
+
const services_pool_e2e_run: ?*std.Build.Step.Run = if (ts_core_artifacts.services_pool) |pool_tests| pool: {
|
|
601
|
+
const run = b.addRunArtifact(pool_tests);
|
|
602
|
+
ts_services_e2e_step.dependOn(&run.step);
|
|
603
|
+
break :pool run;
|
|
604
|
+
} else null;
|
|
605
|
+
// Service carrier benchmark: cold start, warm round-trip latency
|
|
606
|
+
// for small and large payloads, and queued throughput, through the
|
|
607
|
+
// production carrier bindings of BOTH carriers — the out-of-process
|
|
608
|
+
// child and the in-process pool — against one bytes-echo service
|
|
609
|
+
// (see tools/bench_service_host.zig).
|
|
610
|
+
const bench_service_host_run = b.addRunArtifact(ts_core_artifacts.service_host_bench);
|
|
611
|
+
bench_service_host_run.has_side_effects = true;
|
|
612
|
+
// Repo root as cwd so the generated service executable path and the
|
|
613
|
+
// benchmark's scratch directory resolve regardless of where
|
|
614
|
+
// `zig build` ran from.
|
|
615
|
+
bench_service_host_run.setCwd(b.path("."));
|
|
616
|
+
const bench_service_host_step = b.step("bench-service-host", "Run the service carrier benchmark over both carriers (cold start, round-trip latency, queued throughput; requires node and `npm ci` in packages/core; pass -Doptimize=ReleaseFast for baselines)");
|
|
617
|
+
bench_service_host_step.dependOn(&bench_service_host_run.step);
|
|
498
618
|
const sidecar_conformance_run = b.addRunArtifact(ts_core_artifacts.sidecar_conformance);
|
|
499
619
|
const sidecar_conformance_step = b.step("sidecar-conformance", "Validate corewire-generated mirrors over every fixture's frontend-emitted contract (requires node)");
|
|
500
620
|
sidecar_conformance_step.dependOn(&sidecar_conformance_run.step);
|
|
@@ -505,6 +625,19 @@ pub fn build(b: *std.Build) void {
|
|
|
505
625
|
const abi_laws_step = b.step("test-external-core-abi", "Run the compiled-core ABI-law suite over the markup fixture's archive (requires node and `npm ci` in packages/core)");
|
|
506
626
|
abi_laws_step.dependOn(&abi_laws_run.step);
|
|
507
627
|
test_step.dependOn(&abi_laws_run.step);
|
|
628
|
+
// The cross-execution battery staging: the host-fixture and
|
|
629
|
+
// markup batteries (update/snapshot/effects and the markup view
|
|
630
|
+
// over genuinely compiled cores) plus, where the target admits
|
|
631
|
+
// the in-process archive, the service pool battery, installed
|
|
632
|
+
// under <prefix>/e2e for execution on the target machine. Pair
|
|
633
|
+
// with -Dtarget and -p; scripts/cross-e2e.sh is the driver.
|
|
634
|
+
const cross_e2e_step = b.step("stage-cross-e2e", "Install the TS-core e2e batteries under <prefix>/e2e for execution on the build target (pair with -Dtarget and -p; see scripts/cross-e2e.sh)");
|
|
635
|
+
const e2e_dir: std.Build.Step.InstallArtifact.Options.Dir = .{ .override = .{ .custom = "e2e" } };
|
|
636
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(ts_core_artifacts.host, .{ .dest_dir = e2e_dir }).step);
|
|
637
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(ts_core_artifacts.markup, .{ .dest_dir = e2e_dir }).step);
|
|
638
|
+
if (ts_core_artifacts.services_pool) |pool_tests| {
|
|
639
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(pool_tests, .{ .dest_dir = e2e_dir }).step);
|
|
640
|
+
}
|
|
508
641
|
// The corpus contract artifacts an external core toolchain
|
|
509
642
|
// consumes: per fixture, the frontend-emitted contract sidecar
|
|
510
643
|
// (after projection), the generated entry module, and the
|
|
@@ -517,19 +650,25 @@ pub fn build(b: *std.Build) void {
|
|
|
517
650
|
contracts_step.dependOn(&b.addInstallFileWithDir(contract.profile, dir, "core_profile.json").step);
|
|
518
651
|
}
|
|
519
652
|
ts_core_e2e_step.dependOn(&host_e2e_run.step);
|
|
653
|
+
ts_core_e2e_step.dependOn(&persist_e2e_run.step);
|
|
520
654
|
ts_core_e2e_step.dependOn(&markup_e2e_run.step);
|
|
521
655
|
ts_core_e2e_step.dependOn(&kanban_e2e_run.step);
|
|
522
656
|
ts_core_e2e_step.dependOn(&soundboard_e2e_run.step);
|
|
523
657
|
ts_core_e2e_step.dependOn(&monitor_e2e_run.step);
|
|
524
658
|
ts_core_e2e_step.dependOn(&scaffold_ide_e2e_run.step);
|
|
525
659
|
ts_core_e2e_step.dependOn(&ai_chat_e2e_run.step);
|
|
660
|
+
ts_core_e2e_step.dependOn(&services_e2e_run.step);
|
|
661
|
+
if (services_pool_e2e_run) |run| ts_core_e2e_step.dependOn(&run.step);
|
|
526
662
|
test_step.dependOn(&host_e2e_run.step);
|
|
663
|
+
test_step.dependOn(&persist_e2e_run.step);
|
|
527
664
|
test_step.dependOn(&markup_e2e_run.step);
|
|
528
665
|
test_step.dependOn(&kanban_e2e_run.step);
|
|
529
666
|
test_step.dependOn(&soundboard_e2e_run.step);
|
|
530
667
|
test_step.dependOn(&monitor_e2e_run.step);
|
|
531
668
|
test_step.dependOn(&scaffold_ide_e2e_run.step);
|
|
532
669
|
test_step.dependOn(&ai_chat_e2e_run.step);
|
|
670
|
+
test_step.dependOn(&services_e2e_run.step);
|
|
671
|
+
if (services_pool_e2e_run) |run| test_step.dependOn(&run.step);
|
|
533
672
|
test_step.dependOn(&sidecar_conformance_run.step);
|
|
534
673
|
}
|
|
535
674
|
test_step.dependOn(&b.addRunArtifact(markup_lsp_tests).step);
|
|
@@ -604,6 +743,28 @@ pub fn build(b: *std.Build) void {
|
|
|
604
743
|
.{ .path = "build/app.zig", .pattern = "npm ci --include=dev" },
|
|
605
744
|
.{ .path = "build/app.zig", .pattern = "cannot resolve its TypeScript toolchain" },
|
|
606
745
|
.{ .path = "build/app.zig", .pattern = "std.process.exit(1);" },
|
|
746
|
+
// SQLite schema generation shares node/toolchain resolution but
|
|
747
|
+
// never the TS-core-only src/app.native shape assertion: Zig cores
|
|
748
|
+
// may own their view in code while still embedding migrations.
|
|
749
|
+
.{ .path = "build/app.zig", .pattern = "return tsToolingPreflight(b, dep, .app_core);" },
|
|
750
|
+
.{ .path = "build/app.zig", .pattern = "const node = tsToolingPreflight(b, dep, .sqlite_schema);" },
|
|
751
|
+
});
|
|
752
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-scriptc-pin-cache-inputs", "Verify both TypeScript service build graphs invalidate frontend contracts when the exact scriptc pin changes", &.{
|
|
753
|
+
.{ .path = "build.zig", .pattern = "if (spec.emit_services) check.addFileInput(b.path(\"packages/core/package.json\"));" },
|
|
754
|
+
.{ .path = "build/app.zig", .pattern = "if (has_services) check.addFileInput(dep.path(\"packages/core/package.json\"));" },
|
|
755
|
+
});
|
|
756
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-scriptc-cross-target-plumbing", "Verify core and service archives share the target-aware ScriptC lane, and every direct Windows archive consumer links its runtime import libraries", &.{
|
|
757
|
+
.{ .path = "build/app.zig", .pattern = ".linux => !cross or target.result.cpu.arch == .x86_64 or target.result.cpu.arch == .aarch64" },
|
|
758
|
+
.{ .path = "build/app.zig", .pattern = ".windows => !cross or target.result.abi == .gnu" },
|
|
759
|
+
.{ .path = "build/app.zig", .pattern = ".windows => target.result.cpu.arch == .x86_64" },
|
|
760
|
+
.{ .path = "build/app.zig", .pattern = "if (linuxGlibcSpellingHitsDefaultFloor(target)) {" },
|
|
761
|
+
.{ .path = "build.zig", .pattern = "if (!app_build.linuxGlibcSpellingHitsDefaultFloor(target)) return;" },
|
|
762
|
+
.{ .path = "build/app.zig", .pattern = "scriptcPlatformTriple(b, target),\n // Keep the core and service archives on the same cross compiler" },
|
|
763
|
+
.{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe," },
|
|
764
|
+
.{ .path = "build.zig", .pattern = "compile.addArgs(&.{ \"--host-platform\", host_platform, \"--target-platform\", app_build.scriptcPlatformTriple(b, target), \"--zig-exe\", b.graph.zig_exe });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
|
|
765
|
+
.{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe,\n });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
|
|
766
|
+
.{ .path = "build.zig", .pattern = "abi_laws_mod.addObjectFile(markup_fixture.archive);\n addScriptcArchiveSystemLibs(abi_laws_mod, target);" },
|
|
767
|
+
.{ .path = "packages/core/scripts/run_external_core_compiler.mjs", .pattern = "SCRIPTC_TARGET: args[\"target-platform\"]" },
|
|
607
768
|
});
|
|
608
769
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-app-test-entry-analysis", "Verify the managed app test step force-analyzes the entry point (UiApp.create's Model-defaults rule must teach at `native test`, not ambush at `native build`)", &.{
|
|
609
770
|
.{ .path = "build/app.zig", .pattern = "app_analysis.zig" },
|
|
@@ -1415,6 +1576,8 @@ pub fn build(b: *std.Build) void {
|
|
|
1415
1576
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-surface", "Run GPU surface example tests", "examples/gpu-surface", .managed),
|
|
1416
1577
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-dashboard", "Run GPU dashboard example tests", "examples/gpu-dashboard", .managed),
|
|
1417
1578
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-components", "Run GPU components example tests", "examples/gpu-components", .managed),
|
|
1579
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-record-store", "Run record-store example tests", "examples/record-store", .managed),
|
|
1580
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-relational-notes", "Run relational notes example tests", "examples/relational-notes", .managed),
|
|
1418
1581
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-ui-inbox", "Run ui builder inbox example tests", "examples/ui-inbox", .owned),
|
|
1419
1582
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-kanban", "Run ui builder kanban example tests", "examples/kanban", .managed),
|
|
1420
1583
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-habits", "Run markup habits example tests", "examples/habits", .managed),
|
|
@@ -1436,6 +1599,7 @@ pub fn build(b: *std.Build) void {
|
|
|
1436
1599
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-channel-monitor", "Run channel monitor example tests", "examples/channel-monitor", .managed),
|
|
1437
1600
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-menu-bar", "Run menu-bar lifecycle example tests", "examples/menu-bar", .managed),
|
|
1438
1601
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-feed", "Run feed example tests", "examples/feed", .managed),
|
|
1602
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-service-feed-reader", "Run TypeScript service feed-reader example tests", "examples/service-feed-reader", .managed),
|
|
1439
1603
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-canvas-preview", "Run canvas preview example tests", "examples/canvas-preview", .managed),
|
|
1440
1604
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-capabilities", "Run capabilities example tests", "examples/capabilities", .owned),
|
|
1441
1605
|
};
|
|
@@ -1622,14 +1786,63 @@ pub fn build(b: *std.Build) void {
|
|
|
1622
1786
|
mobile_canvas_lib_step.dependOn(&build_mobile_canvas_lib.step);
|
|
1623
1787
|
mobile_examples_step.dependOn(&build_mobile_canvas_lib.step);
|
|
1624
1788
|
|
|
1625
|
-
|
|
1626
|
-
|
|
1789
|
+
const build_mobile_canvas_store_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dstore=true" });
|
|
1790
|
+
build_mobile_canvas_store_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1791
|
+
const mobile_canvas_store_lib_step = b.step("test-example-mobile-canvas-lib-store", "Build a record-store-capable mobile embed static library");
|
|
1792
|
+
mobile_canvas_store_lib_step.dependOn(&build_mobile_canvas_store_lib.step);
|
|
1793
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib.step);
|
|
1794
|
+
|
|
1795
|
+
const build_mobile_canvas_relational_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dsqlite=true", "--prefix", "zig-out/test-relational" });
|
|
1796
|
+
build_mobile_canvas_relational_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1797
|
+
const mobile_canvas_relational_lib_step = b.step("test-example-mobile-canvas-lib-sqlite", "Build a relational-SQLite-capable mobile embed static library");
|
|
1798
|
+
mobile_canvas_relational_lib_step.dependOn(&build_mobile_canvas_relational_lib.step);
|
|
1799
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_relational_lib.step);
|
|
1800
|
+
|
|
1801
|
+
const build_mobile_canvas_both_storage_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dstore=true", "-Dsqlite=true", "--prefix", "zig-out/test-both-storage" });
|
|
1802
|
+
build_mobile_canvas_both_storage_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1803
|
+
const mobile_canvas_both_storage_lib_step = b.step("test-example-mobile-canvas-lib-storage", "Build both SQLite-backed mobile tiers with one vendored engine object");
|
|
1804
|
+
mobile_canvas_both_storage_lib_step.dependOn(&build_mobile_canvas_both_storage_lib.step);
|
|
1805
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_both_storage_lib.step);
|
|
1806
|
+
|
|
1807
|
+
// Android cross-compile proofs: the capability-free archive remains pure
|
|
1808
|
+
// Zig, while the store variant must discover the NDK sysroot and compile
|
|
1809
|
+
// the vendored SQLite amalgamation for bionic. Keeping both catches a
|
|
1810
|
+
// capability branch that a host-only store build cannot exercise.
|
|
1627
1811
|
const build_mobile_canvas_lib_android = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dtarget=aarch64-linux-android" });
|
|
1628
1812
|
build_mobile_canvas_lib_android.setCwd(b.path("examples/mobile-canvas"));
|
|
1629
1813
|
const mobile_canvas_lib_android_step = b.step("test-example-mobile-canvas-lib-android", "Cross-compile the mobile-canvas embed static library for aarch64-linux-android");
|
|
1630
1814
|
mobile_canvas_lib_android_step.dependOn(&build_mobile_canvas_lib_android.step);
|
|
1631
1815
|
mobile_examples_step.dependOn(&build_mobile_canvas_lib_android.step);
|
|
1632
1816
|
|
|
1817
|
+
const build_mobile_canvas_store_lib_android = b.addSystemCommand(&.{
|
|
1818
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-linux-android",
|
|
1819
|
+
"--prefix", "zig-out/test-android-store",
|
|
1820
|
+
});
|
|
1821
|
+
build_mobile_canvas_store_lib_android.setCwd(b.path("examples/mobile-canvas"));
|
|
1822
|
+
const mobile_canvas_store_lib_android_step = b.step("test-example-mobile-canvas-lib-android-store", "Cross-compile SQLite-backed mobile storage for aarch64-linux-android");
|
|
1823
|
+
mobile_canvas_store_lib_android_step.dependOn(&build_mobile_canvas_store_lib_android.step);
|
|
1824
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_android.step);
|
|
1825
|
+
|
|
1826
|
+
// Apple SDK headers only exist on macOS. This is still part of the local
|
|
1827
|
+
// mobile aggregate there, and CI invokes the named step on its macOS tier.
|
|
1828
|
+
if (b.graph.host.result.os.tag == .macos) {
|
|
1829
|
+
const build_mobile_canvas_store_lib_ios = b.addSystemCommand(&.{
|
|
1830
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-ios-simulator",
|
|
1831
|
+
"--prefix", "zig-out/test-ios-store",
|
|
1832
|
+
});
|
|
1833
|
+
build_mobile_canvas_store_lib_ios.setCwd(b.path("examples/mobile-canvas"));
|
|
1834
|
+
const build_mobile_canvas_store_lib_ios_device = b.addSystemCommand(&.{
|
|
1835
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-ios",
|
|
1836
|
+
"--prefix", "zig-out/test-ios-device-store",
|
|
1837
|
+
});
|
|
1838
|
+
build_mobile_canvas_store_lib_ios_device.setCwd(b.path("examples/mobile-canvas"));
|
|
1839
|
+
const mobile_canvas_store_lib_ios_step = b.step("test-example-mobile-canvas-lib-ios-store", "Cross-compile SQLite-backed mobile storage for iOS simulator and device");
|
|
1840
|
+
mobile_canvas_store_lib_ios_step.dependOn(&build_mobile_canvas_store_lib_ios.step);
|
|
1841
|
+
mobile_canvas_store_lib_ios_step.dependOn(&build_mobile_canvas_store_lib_ios_device.step);
|
|
1842
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_ios.step);
|
|
1843
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_ios_device.step);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1633
1846
|
const examples_step = b.step("test-examples", "Run all example tests and layout checks");
|
|
1634
1847
|
examples_step.dependOn(frontend_examples_step);
|
|
1635
1848
|
examples_step.dependOn(native_examples_step);
|
|
@@ -2234,7 +2447,8 @@ pub fn build(b: *std.Build) void {
|
|
|
2234
2447
|
// numbers only mean something on a controlled machine. Runs via
|
|
2235
2448
|
// `scripts/gate.sh full --perf` locally and a dedicated macos-14 CI job.
|
|
2236
2449
|
// Knobs: NATIVE_SDK_PERF_LAUNCHES, NATIVE_SDK_PERF_INTERACTIONS, NATIVE_SDK_PERF_BUDGET_MS,
|
|
2237
|
-
// NATIVE_SDK_PERF_INPUT_BUDGET_MS — see
|
|
2450
|
+
// NATIVE_SDK_PERF_INPUT_BUDGET_MS, and NATIVE_SDK_PERF_ANIMATION_* — see
|
|
2451
|
+
// scripts/perf-gpu-dashboard.sh.
|
|
2238
2452
|
const gpu_dashboard_perf_step = b.step("test-gpu-dashboard-perf", "Run macOS GPU dashboard percentile performance check (N launches; slow)");
|
|
2239
2453
|
const gpu_dashboard_perf_build = managedExampleRun(b, cli_exe, &.{ "build", "-Dplatform=macos", "-Dweb-engine=system", "-Dautomation=true", "-Doptimize=Debug" });
|
|
2240
2454
|
gpu_dashboard_perf_build.setCwd(b.path("examples/gpu-dashboard"));
|
|
@@ -2705,6 +2919,19 @@ pub fn build(b: *std.Build) void {
|
|
|
2705
2919
|
cef_bundle_step.dependOn(&cef_bundle_script.step);
|
|
2706
2920
|
}
|
|
2707
2921
|
|
|
2922
|
+
fn sqliteCompileFlags() []const []const u8 {
|
|
2923
|
+
return &.{
|
|
2924
|
+
"-DSQLITE_THREADSAFE=2",
|
|
2925
|
+
"-DSQLITE_OMIT_LOAD_EXTENSION",
|
|
2926
|
+
"-DSQLITE_DQS=0",
|
|
2927
|
+
"-DSQLITE_ENABLE_FTS5",
|
|
2928
|
+
"-DSQLITE_ENABLE_JSON1",
|
|
2929
|
+
"-DSQLITE_ENABLE_UPDATE_HOOK",
|
|
2930
|
+
"-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1",
|
|
2931
|
+
"-DSQLITE_DEFAULT_MEMSTATUS=0",
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2708
2935
|
fn module(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, path: []const u8) *std.Build.Module {
|
|
2709
2936
|
return b.createModule(.{
|
|
2710
2937
|
.root_source_file = b.path(path),
|
|
@@ -2752,6 +2979,7 @@ fn testArtifact(b: *std.Build, mod: *std.Build.Module) *std.Build.Step.Compile {
|
|
|
2752
2979
|
/// installed dependency (`npm ci` in packages/core) is missing.
|
|
2753
2980
|
const TsCoreE2eArtifacts = struct {
|
|
2754
2981
|
host: *std.Build.Step.Compile,
|
|
2982
|
+
persist: *std.Build.Step.Compile,
|
|
2755
2983
|
/// The markup battery is its own binary: the compiled-core symbol
|
|
2756
2984
|
/// set is a fixed-prefix C ABI, so one process carries ONE archive
|
|
2757
2985
|
/// — every fixture battery links exactly its own core.
|
|
@@ -2764,6 +2992,20 @@ const TsCoreE2eArtifacts = struct {
|
|
|
2764
2992
|
/// paths, and builds keep working with node_modules deleted.
|
|
2765
2993
|
scaffold_ide: *std.Build.Step.Compile,
|
|
2766
2994
|
ai_chat: *std.Build.Step.Compile,
|
|
2995
|
+
/// The phase-1 service seam: a real compiled core plus a real plain-scriptc
|
|
2996
|
+
/// service executable driven through the out-of-process carrier.
|
|
2997
|
+
services: *std.Build.Step.Compile,
|
|
2998
|
+
/// The in-process service carrier: the same fixture compiled as a
|
|
2999
|
+
/// thread-instanced library archive, linked into this battery and driven
|
|
3000
|
+
/// through ServicePool (parallel keys, per-key FIFO, cooperative
|
|
3001
|
+
/// cancellation/deadlines, trap isolation, streaming, replay). Null when
|
|
3002
|
+
/// the target cannot carry the archive (cross or non-desktop builds).
|
|
3003
|
+
services_pool: ?*std.Build.Step.Compile,
|
|
3004
|
+
/// The service-host carrier benchmark: a bytes-echo service compiled
|
|
3005
|
+
/// through the same lane, driven directly through the production
|
|
3006
|
+
/// carrier bindings of BOTH carriers (cold start, round-trip latency,
|
|
3007
|
+
/// queued throughput).
|
|
3008
|
+
service_host_bench: *std.Build.Step.Compile,
|
|
2767
3009
|
/// Sidecar-shim conformance (tests/sidecar): every fixture's
|
|
2768
3010
|
/// generated mirror validated over its frontend-emitted contract
|
|
2769
3011
|
/// (plus the hand-written ground-truth sidecars), and every shim
|
|
@@ -2814,16 +3056,17 @@ fn tsCoreE2eArtifact(
|
|
|
2814
3056
|
|
|
2815
3057
|
// corewire (the contract-sidecar mirror/facade/profile generator),
|
|
2816
3058
|
// compiled for the build host: the fixture compiles and the
|
|
2817
|
-
// conformance shims all run it
|
|
3059
|
+
// conformance shims all run it, including under a cross -Dtarget
|
|
3060
|
+
// (the batteries compile for the target; this tool never does).
|
|
2818
3061
|
const corewire_mod = b.createModule(.{
|
|
2819
3062
|
.root_source_file = b.path("tools/corewire/main.zig"),
|
|
2820
|
-
.target =
|
|
3063
|
+
.target = b.graph.host,
|
|
2821
3064
|
.optimize = optimize,
|
|
2822
3065
|
});
|
|
2823
3066
|
const corewire_exe = b.addExecutable(.{
|
|
2824
3067
|
.name = "corewire",
|
|
2825
3068
|
.root_module = corewire_mod,
|
|
2826
|
-
.use_llvm = @import("build/app.zig").useLlvmWorkaround(
|
|
3069
|
+
.use_llvm = @import("build/app.zig").useLlvmWorkaround(b.graph.host),
|
|
2827
3070
|
});
|
|
2828
3071
|
|
|
2829
3072
|
// Each fixture core compiles through the external core compiler at
|
|
@@ -2839,12 +3082,26 @@ fn tsCoreE2eArtifact(
|
|
|
2839
3082
|
.entry = "tests/ts-core/fixture.ts",
|
|
2840
3083
|
.src_dir = host_src.getDirectory(),
|
|
2841
3084
|
.name = "host_fixture_core",
|
|
3085
|
+
.store_capability = true,
|
|
3086
|
+
.relational_capability = true,
|
|
3087
|
+
.credentials_capability = true,
|
|
2842
3088
|
// The fixture drives pastBytes to the f64-exact boundary (2^53):
|
|
2843
3089
|
// no honest i64 declaration exists there, so the compiled
|
|
2844
3090
|
// projection carries the slot as f64.
|
|
2845
3091
|
.f64_slots = &.{"Model.pastBytes"},
|
|
2846
3092
|
});
|
|
2847
3093
|
const fixture_mod = host_fixture.module;
|
|
3094
|
+
const persist_src = b.addWriteFiles();
|
|
3095
|
+
_ = persist_src.addCopyFile(b.path("tests/ts-core/persist_fixture.ts"), "persist_fixture.ts");
|
|
3096
|
+
const persist_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3097
|
+
.entry = "tests/ts-core/persist_fixture.ts",
|
|
3098
|
+
.src_dir = persist_src.getDirectory(),
|
|
3099
|
+
.name = "persist_fixture_core",
|
|
3100
|
+
.persist_capability = true,
|
|
3101
|
+
});
|
|
3102
|
+
const persist_mod = module(b, target, optimize, "tests/ts-core/persist_e2e_tests.zig");
|
|
3103
|
+
persist_mod.addImport("native_sdk", desktop_mod);
|
|
3104
|
+
persist_mod.addImport("ts_persist_core", persist_fixture.module);
|
|
2848
3105
|
const markup_src = b.addWriteFiles();
|
|
2849
3106
|
_ = markup_src.addCopyFile(b.path("tests/ts-core/markup_fixture.ts"), "markup_fixture.ts");
|
|
2850
3107
|
const markup_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
@@ -2954,6 +3211,93 @@ fn tsCoreE2eArtifact(
|
|
|
2954
3211
|
ai_chat_mod.addImport("native_sdk", desktop_mod);
|
|
2955
3212
|
ai_chat_mod.addImport("ts_ai_chat_core", ai_chat_core_mod);
|
|
2956
3213
|
|
|
3214
|
+
// Phase-1 TypeScript services, end to end: the frontend emits BOTH
|
|
3215
|
+
// sidecars from one checked two-class program; corewire derives the
|
|
3216
|
+
// registry/host only from the service sidecar; plain scriptc compiles the
|
|
3217
|
+
// child executable; and the Zig battery drives that executable through
|
|
3218
|
+
// the production ServiceHost + effects/session boundary.
|
|
3219
|
+
const services_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3220
|
+
.entry = "tests/ts-services/ok/src/core.ts",
|
|
3221
|
+
.src_dir = b.path("tests/ts-services/ok/src"),
|
|
3222
|
+
.name = "services_fixture_core",
|
|
3223
|
+
.emit_services = true,
|
|
3224
|
+
.service_packages = &.{"escape-string-regexp|5.0.0|705f4bb4b92fd3469e264a93f2a2e4b24cf7e663d73a5318abaf29ee72674f6d"},
|
|
3225
|
+
});
|
|
3226
|
+
const service_host_fixture = externalServiceFixture(
|
|
3227
|
+
b,
|
|
3228
|
+
target,
|
|
3229
|
+
optimize,
|
|
3230
|
+
node,
|
|
3231
|
+
corewire_exe,
|
|
3232
|
+
b.path("tests/ts-services/ok/src"),
|
|
3233
|
+
services_fixture.services_contract.?,
|
|
3234
|
+
"ts_services_fixture_services",
|
|
3235
|
+
);
|
|
3236
|
+
const services_e2e_mod = module(b, target, optimize, "tests/ts-services/service_e2e_tests.zig");
|
|
3237
|
+
services_e2e_mod.addImport("native_sdk", desktop_mod);
|
|
3238
|
+
services_e2e_mod.addImport("ts_services_core", services_fixture.module);
|
|
3239
|
+
services_e2e_mod.addImport("ts_services_registry", service_host_fixture.registry);
|
|
3240
|
+
const service_test_options = b.addOptions();
|
|
3241
|
+
service_test_options.addOptionPath("service_executable", service_host_fixture.executable);
|
|
3242
|
+
service_test_options.addOption([]const u8, "node_executable", node);
|
|
3243
|
+
services_e2e_mod.addOptions("ts_services_options", service_test_options);
|
|
3244
|
+
|
|
3245
|
+
// The same fixture against the in-process carrier: the service archive
|
|
3246
|
+
// links into the battery beside the fixture core's archive (distinct
|
|
3247
|
+
// symbol prefixes), and ServicePool drives it through the identical
|
|
3248
|
+
// TsUiApp/Effects seam.
|
|
3249
|
+
const services_pool_mod: ?*std.Build.Module = if (service_host_fixture.archive) |service_archive| pool: {
|
|
3250
|
+
const pool_mod = module(b, target, optimize, "tests/ts-services/service_pool_e2e_tests.zig");
|
|
3251
|
+
pool_mod.addImport("native_sdk", desktop_mod);
|
|
3252
|
+
pool_mod.addImport("ts_services_core", services_fixture.module);
|
|
3253
|
+
pool_mod.addImport("ts_services_registry", service_host_fixture.registry);
|
|
3254
|
+
pool_mod.link_libc = true;
|
|
3255
|
+
pool_mod.addObjectFile(service_archive);
|
|
3256
|
+
addScriptcArchiveSystemLibs(pool_mod, target);
|
|
3257
|
+
break :pool pool_mod;
|
|
3258
|
+
} else null;
|
|
3259
|
+
|
|
3260
|
+
// Service-host carrier benchmark: the same production service lane
|
|
3261
|
+
// (frontend contract -> corewire host/registry -> exact-pinned
|
|
3262
|
+
// plain-scriptc executable) over a bytes-echo operation that returns
|
|
3263
|
+
// its request unchanged, so tools/bench_service_host.zig measures the
|
|
3264
|
+
// carrier — lazy spawn, framing, pipes, worker queueing — and never a
|
|
3265
|
+
// workload.
|
|
3266
|
+
const service_bench_core = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3267
|
+
.entry = "tools/service-host-bench/src/core.ts",
|
|
3268
|
+
.src_dir = b.path("tools/service-host-bench/src"),
|
|
3269
|
+
.name = "service_host_bench_core",
|
|
3270
|
+
.emit_services = true,
|
|
3271
|
+
});
|
|
3272
|
+
const service_bench_fixture = externalServiceFixture(
|
|
3273
|
+
b,
|
|
3274
|
+
target,
|
|
3275
|
+
optimize,
|
|
3276
|
+
node,
|
|
3277
|
+
corewire_exe,
|
|
3278
|
+
b.path("tools/service-host-bench/src"),
|
|
3279
|
+
service_bench_core.services_contract.?,
|
|
3280
|
+
"service_host_bench_services",
|
|
3281
|
+
);
|
|
3282
|
+
const service_bench_mod = module(b, target, optimize, "tools/bench_service_host.zig");
|
|
3283
|
+
service_bench_mod.addImport("native_sdk", desktop_mod);
|
|
3284
|
+
service_bench_mod.addImport("service_registry", service_bench_fixture.registry);
|
|
3285
|
+
const service_bench_options = b.addOptions();
|
|
3286
|
+
service_bench_options.addOptionPath("service_executable", service_bench_fixture.executable);
|
|
3287
|
+
service_bench_options.addOption(bool, "has_archive", service_bench_fixture.archive != null);
|
|
3288
|
+
service_bench_mod.addOptions("bench_options", service_bench_options);
|
|
3289
|
+
if (service_bench_fixture.archive) |bench_archive| {
|
|
3290
|
+
// The in-process carrier's half of the benchmark: the same echo
|
|
3291
|
+
// service as a linked archive, driven through ServicePool.
|
|
3292
|
+
service_bench_mod.link_libc = true;
|
|
3293
|
+
service_bench_mod.addObjectFile(bench_archive);
|
|
3294
|
+
addScriptcArchiveSystemLibs(service_bench_mod, target);
|
|
3295
|
+
}
|
|
3296
|
+
const service_bench_exe = b.addExecutable(.{
|
|
3297
|
+
.name = "bench-service-host",
|
|
3298
|
+
.root_module = service_bench_mod,
|
|
3299
|
+
});
|
|
3300
|
+
|
|
2957
3301
|
// Sidecar-shim conformance: a corewire-generated mirror per corpus
|
|
2958
3302
|
// fixture. The markup fixture's sidecar is the committed
|
|
2959
3303
|
// hand-written one (independent ground truth for the schema); the
|
|
@@ -3023,21 +3367,152 @@ fn tsCoreE2eArtifact(
|
|
|
3023
3367
|
abi_laws_mod.addImport("core_abi", module(b, target, optimize, "tools/corewire/core_abi.zig"));
|
|
3024
3368
|
abi_laws_mod.addImport("shim_core", sidecarShimModule(b, target, optimize, corewire_exe, markup_fixture.sidecar));
|
|
3025
3369
|
abi_laws_mod.addObjectFile(markup_fixture.archive);
|
|
3370
|
+
addScriptcArchiveSystemLibs(abi_laws_mod, target);
|
|
3026
3371
|
|
|
3027
3372
|
return .{
|
|
3028
3373
|
.host = filteredTestArtifact(b, e2e_mod, "ts-core-e2e-tests", &.{}),
|
|
3374
|
+
.persist = filteredTestArtifact(b, persist_mod, "ts-persist-e2e-tests", &.{}),
|
|
3029
3375
|
.markup = filteredTestArtifact(b, markup_e2e_mod, "ts-markup-e2e-tests", &.{}),
|
|
3030
3376
|
.kanban = filteredTestArtifact(b, kanban_mod, "ts-kanban-e2e-tests", &.{}),
|
|
3031
3377
|
.soundboard = filteredTestArtifact(b, soundboard_mod, "ts-soundboard-e2e-tests", &.{}),
|
|
3032
3378
|
.system_monitor = filteredTestArtifact(b, monitor_mod, "ts-system-monitor-e2e-tests", &.{}),
|
|
3033
3379
|
.scaffold_ide = filteredTestArtifact(b, scaffold_ide_mod, "ts-scaffold-ide-e2e-tests", &.{}),
|
|
3034
3380
|
.ai_chat = filteredTestArtifact(b, ai_chat_mod, "ts-ai-chat-e2e-tests", &.{}),
|
|
3381
|
+
.services = filteredTestArtifact(b, services_e2e_mod, "ts-services-e2e-tests", &.{}),
|
|
3382
|
+
.services_pool = if (services_pool_mod) |pool_mod| filteredTestArtifact(b, pool_mod, "ts-services-pool-e2e-tests", &.{}) else null,
|
|
3383
|
+
.service_host_bench = service_bench_exe,
|
|
3035
3384
|
.sidecar_conformance = filteredTestArtifact(b, conformance_mod, "sidecar-conformance-tests", &.{}),
|
|
3036
3385
|
.external_core_abi_laws = filteredTestArtifact(b, abi_laws_mod, "external-core-abi-tests", &.{}),
|
|
3037
3386
|
.core_contracts = core_contracts.toOwnedSlice(b.allocator) catch @panic("OOM"),
|
|
3038
3387
|
};
|
|
3039
3388
|
}
|
|
3040
3389
|
|
|
3390
|
+
/// System import libraries scriptc's compiled-archive runtime reaches on
|
|
3391
|
+
/// Windows targets — core and service archives alike (Winsock, adapter
|
|
3392
|
+
/// enumeration, and crypto-backed randomness). No-op elsewhere; the
|
|
3393
|
+
/// archives' other dependencies are libc's. The app lane's twin is the
|
|
3394
|
+
/// Windows platform block in build/app.zig.
|
|
3395
|
+
fn addScriptcArchiveSystemLibs(mod: *std.Build.Module, target: std.Build.ResolvedTarget) void {
|
|
3396
|
+
if (target.result.os.tag != .windows) return;
|
|
3397
|
+
mod.linkSystemLibrary("ws2_32", .{});
|
|
3398
|
+
mod.linkSystemLibrary("iphlpapi", .{});
|
|
3399
|
+
mod.linkSystemLibrary("advapi32", .{});
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
/// Attach ScriptC's explicit-Linux-target glibc-floor teaching to an actual
|
|
3403
|
+
/// compile step. A target can match the host triple and still need the teaching
|
|
3404
|
+
/// because Zig's explicitly spelled `-gnu` target uses its default glibc floor.
|
|
3405
|
+
/// The root graph constructs fixture lanes even for unrelated selections such
|
|
3406
|
+
/// as the release pipeline's cross-compiled `zig build cli`; making the
|
|
3407
|
+
/// teaching a dependency preserves those CLI-only builds while still refusing
|
|
3408
|
+
/// the unsupported target before a selected ScriptC compile does any work.
|
|
3409
|
+
fn addScriptcGlibcFloorTeaching(b: *std.Build, target: std.Build.ResolvedTarget, step: *std.Build.Step) void {
|
|
3410
|
+
const app_build = @import("build/app.zig");
|
|
3411
|
+
if (!app_build.linuxGlibcSpellingHitsDefaultFloor(target)) return;
|
|
3412
|
+
step.dependOn(&b.addFail(app_build.scriptcLinuxGlibcSpellingTeaching(b, target)).step);
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
const ExternalServiceFixture = struct {
|
|
3416
|
+
executable: std.Build.LazyPath,
|
|
3417
|
+
/// The in-process carrier's library archive (thread-instanced,
|
|
3418
|
+
/// runtime-localized), compiled from the same staged tree. Present
|
|
3419
|
+
/// wherever the pinned compiler's localized-archive matrix covers the
|
|
3420
|
+
/// pairing (native Linux, cross-Linux x86_64/aarch64, Windows x86_64,
|
|
3421
|
+
/// or macOS from a macOS host — see build/app.zig
|
|
3422
|
+
/// serviceArchiveSupported); null elsewhere, and for explicitly spelled
|
|
3423
|
+
/// linux-gnu targets below the glibc 2.36 runtime floor.
|
|
3424
|
+
archive: ?std.Build.LazyPath,
|
|
3425
|
+
registry: *std.Build.Module,
|
|
3426
|
+
};
|
|
3427
|
+
|
|
3428
|
+
/// Compile one fixture's service class through the production phase-1 lane:
|
|
3429
|
+
/// service sidecar -> corewire host/registry -> ordinary source stage (plus
|
|
3430
|
+
/// the pinned compiler's tagged-throw compatibility lowering) -> exact pinned
|
|
3431
|
+
/// scriptc outputs (the child executable, plus the in-process library archive
|
|
3432
|
+
/// wherever the compiler's localized-archive matrix covers the host/target
|
|
3433
|
+
/// pairing). No author source is re-read for dispatch facts after the sidecar
|
|
3434
|
+
/// emission.
|
|
3435
|
+
fn externalServiceFixture(
|
|
3436
|
+
b: *std.Build,
|
|
3437
|
+
target: std.Build.ResolvedTarget,
|
|
3438
|
+
optimize: std.builtin.OptimizeMode,
|
|
3439
|
+
node: []const u8,
|
|
3440
|
+
corewire_exe: *std.Build.Step.Compile,
|
|
3441
|
+
src_dir: std.Build.LazyPath,
|
|
3442
|
+
contract: std.Build.LazyPath,
|
|
3443
|
+
name: []const u8,
|
|
3444
|
+
) ExternalServiceFixture {
|
|
3445
|
+
const app_build = @import("build/app.zig");
|
|
3446
|
+
const emit_archive = app_build.serviceArchiveSupported(b.graph.host.result, target);
|
|
3447
|
+
const project = b.addRunArtifact(corewire_exe);
|
|
3448
|
+
project.addArg("--services-sidecar");
|
|
3449
|
+
project.addFileArg(contract);
|
|
3450
|
+
project.addArg("--service-host-main");
|
|
3451
|
+
const host_main = project.addOutputFileArg("service_host_main.ts");
|
|
3452
|
+
project.addArg("--service-registry");
|
|
3453
|
+
const registry_source = project.addOutputFileArg("services.zig");
|
|
3454
|
+
project.addArg("--service-inproc-main");
|
|
3455
|
+
const inproc_main = project.addOutputFileArg("service_inproc_main.ts");
|
|
3456
|
+
project.addArg("--service-inproc-profile");
|
|
3457
|
+
const inproc_profile = project.addOutputFileArg("service_profile.json");
|
|
3458
|
+
|
|
3459
|
+
const stage = b.addSystemCommand(&.{node});
|
|
3460
|
+
stage.addFileArg(b.path("packages/core/scripts/stage_external_services.mjs"));
|
|
3461
|
+
stage.addArg("--src");
|
|
3462
|
+
stage.addDirectoryArg(src_dir);
|
|
3463
|
+
stage.addArg("--host-main");
|
|
3464
|
+
stage.addFileArg(host_main);
|
|
3465
|
+
stage.addArg("--inproc-main");
|
|
3466
|
+
stage.addFileArg(inproc_main);
|
|
3467
|
+
stage.addArg("--inproc-profile");
|
|
3468
|
+
stage.addFileArg(inproc_profile);
|
|
3469
|
+
stage.addArg("--contract");
|
|
3470
|
+
stage.addFileArg(contract);
|
|
3471
|
+
stage.addArg("--out");
|
|
3472
|
+
const stage_dir = stage.addOutputDirectoryArg("services-stage");
|
|
3473
|
+
// A LazyPath directory records only its producer dependency; source-tree
|
|
3474
|
+
// content does not otherwise participate in Run's cache key. Service
|
|
3475
|
+
// files are discovered recursively by the staging script, so rerun this
|
|
3476
|
+
// cheap copy step whenever the lane is requested rather than risk a stale
|
|
3477
|
+
// compiled host after an author edits a nested service module.
|
|
3478
|
+
stage.has_side_effects = true;
|
|
3479
|
+
|
|
3480
|
+
const compile = b.addSystemCommand(&.{node});
|
|
3481
|
+
compile.addFileArg(b.path("packages/core/scripts/run_external_service_compiler.mjs"));
|
|
3482
|
+
compile.addArg("--stage");
|
|
3483
|
+
compile.addDirectoryArg(stage_dir);
|
|
3484
|
+
compile.addArg("--manifest");
|
|
3485
|
+
compile.addFileArg(b.path("packages/core/package.json"));
|
|
3486
|
+
compile.addArg("--contract");
|
|
3487
|
+
compile.addFileArg(contract);
|
|
3488
|
+
compile.addArg("--out-exe");
|
|
3489
|
+
const suffix = if (target.result.os.tag == .windows) ".exe" else "";
|
|
3490
|
+
const executable = compile.addOutputFileArg(b.fmt("{s}{s}", .{ name, suffix }));
|
|
3491
|
+
const archive: ?std.Build.LazyPath = if (emit_archive) archive: {
|
|
3492
|
+
compile.addArg("--out-archive");
|
|
3493
|
+
break :archive compile.addOutputFileArg(b.fmt("lib{s}.a", .{name}));
|
|
3494
|
+
} else null;
|
|
3495
|
+
const host_platform = b.fmt("{t}-{t}-{t}", .{ b.graph.host.result.cpu.arch, b.graph.host.result.os.tag, b.graph.host.result.abi });
|
|
3496
|
+
compile.addArgs(&.{ "--host-platform", host_platform, "--target-platform", app_build.scriptcPlatformTriple(b, target), "--zig-exe", b.graph.zig_exe });
|
|
3497
|
+
addScriptcGlibcFloorTeaching(b, target, &compile.step);
|
|
3498
|
+
if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
|
|
3499
|
+
compile.addArgs(&.{ "--compiler", override });
|
|
3500
|
+
} else {
|
|
3501
|
+
compile.addArg("--compiler-js");
|
|
3502
|
+
compile.addFileArg(b.path("packages/core/node_modules/scriptc/dist/main.js"));
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
return .{
|
|
3506
|
+
.executable = executable,
|
|
3507
|
+
.archive = archive,
|
|
3508
|
+
.registry = b.createModule(.{
|
|
3509
|
+
.root_source_file = registry_source,
|
|
3510
|
+
.target = target,
|
|
3511
|
+
.optimize = optimize,
|
|
3512
|
+
}),
|
|
3513
|
+
};
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3041
3516
|
const FacadeProjections = struct {
|
|
3042
3517
|
sidecar: std.Build.LazyPath,
|
|
3043
3518
|
facade: std.Build.LazyPath,
|
|
@@ -3114,6 +3589,9 @@ const ExternalCoreFixture = struct {
|
|
|
3114
3589
|
/// The archive's OWN co-emitted contract sidecar — the document its
|
|
3115
3590
|
/// mirror must generate from (the boot identity fence pairs them).
|
|
3116
3591
|
sidecar: std.Build.LazyPath,
|
|
3592
|
+
/// Present only for a two-class fixture that asks the frontend to emit the
|
|
3593
|
+
/// service registry sidecar from the same checked program.
|
|
3594
|
+
services_contract: ?std.Build.LazyPath,
|
|
3117
3595
|
};
|
|
3118
3596
|
|
|
3119
3597
|
const ExternalCoreFixtureSpec = struct {
|
|
@@ -3125,11 +3603,22 @@ const ExternalCoreFixtureSpec = struct {
|
|
|
3125
3603
|
src_dir: std.Build.LazyPath,
|
|
3126
3604
|
/// The archive's symbol-safe stem (`lib<name>.a`).
|
|
3127
3605
|
name: []const u8,
|
|
3606
|
+
/// The fixture stands in for an app whose manifest declares Tier 1.
|
|
3607
|
+
persist_capability: bool = false,
|
|
3608
|
+
/// The fixture stands in for an app whose manifest declares Tier 2.
|
|
3609
|
+
store_capability: bool = false,
|
|
3610
|
+
/// The fixture stands in for an app whose manifest declares Tier 3.
|
|
3611
|
+
relational_capability: bool = false,
|
|
3612
|
+
/// The fixture stands in for an app whose manifest declares the Tier-4
|
|
3613
|
+
/// build capability and its matching core-effect permission.
|
|
3614
|
+
credentials_capability: bool = false,
|
|
3128
3615
|
/// Attested integer slots the compiled projection carries as f64
|
|
3129
3616
|
/// (values that reach the f64-exact boundary have no honest i64
|
|
3130
3617
|
/// declaration on that side) — corewire's --f64-slot demotions,
|
|
3131
3618
|
/// applied to the compile profile and every downstream projection.
|
|
3132
3619
|
f64_slots: []const []const u8 = &.{},
|
|
3620
|
+
emit_services: bool = false,
|
|
3621
|
+
service_packages: []const []const u8 = &.{},
|
|
3133
3622
|
};
|
|
3134
3623
|
|
|
3135
3624
|
/// Compile one TS fixture core through the external core compiler at
|
|
@@ -3145,6 +3634,7 @@ fn externalCoreFixtureModule(
|
|
|
3145
3634
|
corewire_exe: *std.Build.Step.Compile,
|
|
3146
3635
|
spec: ExternalCoreFixtureSpec,
|
|
3147
3636
|
) ExternalCoreFixture {
|
|
3637
|
+
const app_build = @import("build/app.zig");
|
|
3148
3638
|
// The frontend, in check-only mode: the subset checker gates the
|
|
3149
3639
|
// compile, and the contract sidecar states the build-root-relative
|
|
3150
3640
|
// entry spelling. The frontend reads its own sources, the SDK
|
|
@@ -3159,14 +3649,34 @@ fn externalCoreFixtureModule(
|
|
|
3159
3649
|
const contract = check.addOutputFileArg("core.contract.json");
|
|
3160
3650
|
check.addArg("--contract-entry");
|
|
3161
3651
|
check.addArg(spec.entry);
|
|
3652
|
+
const services_contract: ?std.Build.LazyPath = if (spec.emit_services) services: {
|
|
3653
|
+
check.addArg("--services-contract");
|
|
3654
|
+
break :services check.addOutputFileArg("services.contract.json");
|
|
3655
|
+
} else null;
|
|
3656
|
+
for (spec.service_packages) |package_entry| check.addArgs(&.{ "--service-package", package_entry });
|
|
3657
|
+
const services_client: ?std.Build.LazyPath = if (services_contract) |service_contract| client: {
|
|
3658
|
+
const service_project = b.addRunArtifact(corewire_exe);
|
|
3659
|
+
service_project.addArg("--services-sidecar");
|
|
3660
|
+
service_project.addFileArg(service_contract);
|
|
3661
|
+
service_project.addArg("--service-client");
|
|
3662
|
+
break :client service_project.addOutputFileArg("services.gen.ts");
|
|
3663
|
+
} else null;
|
|
3664
|
+
if (spec.persist_capability) check.addArgs(&.{ "--capability", "persist" });
|
|
3665
|
+
if (spec.store_capability) check.addArgs(&.{ "--capability", "store" });
|
|
3666
|
+
if (spec.relational_capability) check.addArgs(&.{ "--capability", "sqlite" });
|
|
3667
|
+
if (spec.credentials_capability) check.addArgs(&.{ "--capability", "credentials", "--permission", "credentials" });
|
|
3162
3668
|
tsCoreAddDirInputs(b, check, "packages/core/sdk");
|
|
3163
3669
|
tsCoreAddDirInputs(b, check, std.fs.path.dirname(spec.entry) orelse ".");
|
|
3164
3670
|
const frontend_sources = [_][]const u8{
|
|
3165
|
-
"checker.ts", "cli.ts", "contract.ts", "diagnostics.ts", "frontend.ts", "infer.ts", "modules.ts", "typed_ast.ts", "types.ts", "wyhash.ts",
|
|
3671
|
+
"checker.ts", "cli.ts", "contract.ts", "diagnostics.ts", "frontend.ts", "infer.ts", "modules.ts", "service_contract.ts", "sqlite_codegen.ts", "sqlite_cli.ts", "sqlite_runtime_policy.ts", "typed_ast.ts", "types.ts", "wyhash.ts",
|
|
3166
3672
|
};
|
|
3167
3673
|
for (frontend_sources) |source| {
|
|
3168
3674
|
check.addFileInput(b.path(b.fmt("packages/core/src/{s}", .{source})));
|
|
3169
3675
|
}
|
|
3676
|
+
// Service contracts echo the exact scriptc pin read from this manifest.
|
|
3677
|
+
// Declare that runtime read explicitly so a compiler bump invalidates a
|
|
3678
|
+
// warm build cache before the compile lane checks the echoed version.
|
|
3679
|
+
if (spec.emit_services) check.addFileInput(b.path("packages/core/package.json"));
|
|
3170
3680
|
|
|
3171
3681
|
// corewire projects the generated compile entry and its profile in
|
|
3172
3682
|
// one invocation, so the profile's entry spelling and the facade
|
|
@@ -3197,6 +3707,10 @@ fn externalCoreFixtureModule(
|
|
|
3197
3707
|
stage_run.addFileArg(facade);
|
|
3198
3708
|
stage_run.addArg("--profile");
|
|
3199
3709
|
stage_run.addFileArg(profile);
|
|
3710
|
+
if (services_client) |client| {
|
|
3711
|
+
stage_run.addArg("--services-client");
|
|
3712
|
+
stage_run.addFileArg(client);
|
|
3713
|
+
}
|
|
3200
3714
|
stage_run.addArg("--out");
|
|
3201
3715
|
const stage_dir = stage_run.addOutputDirectoryArg("stage");
|
|
3202
3716
|
|
|
@@ -3209,10 +3723,21 @@ fn externalCoreFixtureModule(
|
|
|
3209
3723
|
compile.addArgs(&.{ "--name", spec.name });
|
|
3210
3724
|
compile.addArg("--manifest");
|
|
3211
3725
|
compile.addFileArg(b.path("packages/core/package.json"));
|
|
3726
|
+
compile.addArg("--frontend-sidecar");
|
|
3727
|
+
compile.addFileArg(contract);
|
|
3212
3728
|
compile.addArg("--out-archive");
|
|
3213
3729
|
const archive = compile.addOutputFileArg(b.fmt("lib{s}.a", .{spec.name}));
|
|
3214
3730
|
compile.addArg("--out-sidecar");
|
|
3215
3731
|
const compiled_sidecar = compile.addOutputFileArg("core.contract.json");
|
|
3732
|
+
compile.addArgs(&.{
|
|
3733
|
+
"--host-platform",
|
|
3734
|
+
b.fmt("{t}-{t}-{t}", .{ b.graph.host.result.cpu.arch, b.graph.host.result.os.tag, b.graph.host.result.abi }),
|
|
3735
|
+
"--target-platform",
|
|
3736
|
+
app_build.scriptcPlatformTriple(b, target),
|
|
3737
|
+
"--zig-exe",
|
|
3738
|
+
b.graph.zig_exe,
|
|
3739
|
+
});
|
|
3740
|
+
addScriptcGlibcFloorTeaching(b, target, &compile.step);
|
|
3216
3741
|
if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
|
|
3217
3742
|
// The development override: point at any toolchain command; the
|
|
3218
3743
|
// driver still refuses a release other than the SDK's pin.
|
|
@@ -3241,24 +3766,29 @@ fn externalCoreFixtureModule(
|
|
|
3241
3766
|
});
|
|
3242
3767
|
mod.link_libc = true;
|
|
3243
3768
|
mod.addObjectFile(archive);
|
|
3769
|
+
addScriptcArchiveSystemLibs(mod, target);
|
|
3244
3770
|
return .{
|
|
3245
3771
|
.module = mod,
|
|
3246
3772
|
.contract = contract,
|
|
3247
3773
|
.archive = archive,
|
|
3248
3774
|
.sidecar = compiled_sidecar,
|
|
3775
|
+
.services_contract = services_contract,
|
|
3249
3776
|
};
|
|
3250
3777
|
}
|
|
3251
3778
|
|
|
3252
|
-
/// Declare every .ts file
|
|
3253
|
-
/// file input of the transpile step — the multi-file staleness set.
|
|
3779
|
+
/// Declare every .ts file under `dir_path` (relative to the build root) as a
|
|
3780
|
+
/// file input of the transpile step — the recursive multi-file staleness set.
|
|
3781
|
+
/// Service modules live below src/services/, so a flat scan would let their
|
|
3782
|
+
/// generated contract stay stale in a warm fixture build.
|
|
3254
3783
|
fn tsCoreAddDirInputs(b: *std.Build, transpile: *std.Build.Step.Run, dir_path: []const u8) void {
|
|
3255
3784
|
var dir = b.build_root.handle.openDir(b.graph.io, dir_path, .{ .iterate = true }) catch return;
|
|
3256
3785
|
defer dir.close(b.graph.io);
|
|
3257
|
-
var
|
|
3258
|
-
|
|
3786
|
+
var walker = dir.walk(b.allocator) catch return;
|
|
3787
|
+
defer walker.deinit();
|
|
3788
|
+
while (walker.next(b.graph.io) catch null) |entry| {
|
|
3259
3789
|
if (entry.kind != .file) continue;
|
|
3260
|
-
if (!std.mem.endsWith(u8, entry.
|
|
3261
|
-
transpile.addFileInput(b.path(b.fmt("{s}/{s}", .{ dir_path, entry.
|
|
3790
|
+
if (!std.mem.endsWith(u8, entry.basename, ".ts")) continue;
|
|
3791
|
+
transpile.addFileInput(b.path(b.fmt("{s}/{s}", .{ dir_path, entry.path })));
|
|
3262
3792
|
}
|
|
3263
3793
|
}
|
|
3264
3794
|
|