@native-sdk/cli 0.8.3 → 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 +905 -61
- package/build.zig +674 -373
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +6 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +455 -3
- 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 +214 -2
- package/packages/core/sdk/core.ts +715 -42
- package/packages/core/sdk/events.d.ts +50 -0
- package/packages/core/sdk/events.ts +75 -0
- package/packages/core/src/checker.ts +528 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1849 -18
- 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 +84 -18
- 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/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +3 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +55 -8
- package/skill-data/ts-core/SKILL.md +92 -40
- 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 +268 -4
- 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 +115 -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 +121 -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 +41 -18
- package/src/platform/macos/appkit_host.h +26 -3
- package/src/platform/macos/appkit_host.m +1051 -129
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +270 -36
- package/src/platform/macos/root.zig +312 -34
- package/src/platform/null_platform.zig +281 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +16 -0
- package/src/platform/types.zig +279 -15
- package/src/platform/windows/root.zig +243 -21
- package/src/platform/windows/webview2_host.cpp +464 -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 +34 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/primitives/canvas/code_tests.zig +9 -9
- package/src/primitives/canvas/events.zig +12 -11
- package/src/primitives/canvas/frame.zig +44 -9
- package/src/primitives/canvas/icons/mic.svg +1 -0
- package/src/primitives/canvas/icons.zig +2 -0
- package/src/primitives/canvas/root.zig +8 -0
- package/src/primitives/canvas/text_span_tests.zig +39 -0
- package/src/primitives/canvas/ui.zig +23 -4
- package/src/primitives/canvas/ui_markup.zig +15 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
- package/src/primitives/canvas/ui_markup_tests.zig +5 -0
- package/src/primitives/canvas/ui_markup_view.zig +9 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
- package/src/primitives/canvas/ui_schema.zig +19 -10
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +18 -4
- package/src/primitives/canvas/widget_invalidation.zig +9 -2
- package/src/primitives/canvas/widget_render.zig +296 -114
- package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
- package/src/primitives/canvas/widget_text_input.zig +10 -10
- package/src/primitives/canvas/widget_tree.zig +1 -1
- package/src/primitives/canvas/widgets.zig +29 -5
- package/src/root.zig +56 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +31 -13
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
- package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
- package/src/runtime/canvas_widget_events.zig +69 -24
- package/src/runtime/canvas_widget_runtime.zig +101 -6
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
- package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
- package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +112 -3
- 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 +2568 -75
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- 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 +52 -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 +5 -0
- package/src/runtime/ts_core_host.zig +1189 -118
- package/src/runtime/ts_core_host_tests.zig +638 -11
- package/src/runtime/ts_ui_app.zig +537 -1
- package/src/runtime/ui_app.zig +160 -19
- package/src/runtime/ui_app_tests.zig +203 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +11 -0
- package/src/runtime/view_widget_scroll.zig +56 -5
- package/src/runtime/view_widget_text.zig +24 -5
- package/src/runtime/view_widget_tree.zig +1 -1
- 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 +1248 -2
- package/src/tooling/package.zig +953 -6
- package/src/tooling/raw_manifest.zig +65 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +216 -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 +414 -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
|
@@ -10,6 +10,14 @@ pub const RawManifest = struct {
|
|
|
10
10
|
platforms: []const []const u8 = &.{},
|
|
11
11
|
permissions: []const []const u8 = &.{},
|
|
12
12
|
capabilities: []const []const u8 = &.{},
|
|
13
|
+
persist: ?RawPersist = null,
|
|
14
|
+
service_packages: []const RawServicePackage = &.{},
|
|
15
|
+
/// Which carrier runs src/services operations: "auto" (the default child
|
|
16
|
+
/// carrier), "in_process", or "child".
|
|
17
|
+
service_carrier: []const u8 = "auto",
|
|
18
|
+
/// In-process service pool width (1-16); 0 keeps the runtime default
|
|
19
|
+
/// (min(4, cores)).
|
|
20
|
+
service_pool_size: u8 = 0,
|
|
13
21
|
bridge: RawBridge = .{},
|
|
14
22
|
web_engine: []const u8 = @tagName(web_engine.default_engine),
|
|
15
23
|
webview_layer: []const u8 = "auto",
|
|
@@ -30,6 +38,25 @@ pub const RawManifest = struct {
|
|
|
30
38
|
shortcuts: []const RawShortcut = &.{},
|
|
31
39
|
file_associations: []const RawFileAssociation = &.{},
|
|
32
40
|
url_schemes: []const RawUrlScheme = &.{},
|
|
41
|
+
dmg: RawDmg = .{},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
pub const RawServicePackage = struct {
|
|
45
|
+
name: []const u8,
|
|
46
|
+
version: []const u8,
|
|
47
|
+
content_hash: []const u8,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
pub const RawPersist = struct {
|
|
51
|
+
version: u64,
|
|
52
|
+
debounce_ms: u32 = 500,
|
|
53
|
+
restore: RawPersistRestore,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
pub const RawPersistRestore = struct {
|
|
57
|
+
ok: []const u8,
|
|
58
|
+
none: []const u8,
|
|
59
|
+
err: []const u8,
|
|
33
60
|
};
|
|
34
61
|
|
|
35
62
|
pub const RawCef = struct {
|
|
@@ -102,6 +129,8 @@ pub const RawWindow = struct {
|
|
|
102
129
|
always_on_top: bool = false,
|
|
103
130
|
click_through: bool = false,
|
|
104
131
|
activate_on_show: bool = true,
|
|
132
|
+
initially_hidden: bool = false,
|
|
133
|
+
allows_fullscreen: bool = true,
|
|
105
134
|
min_width: f32 = 0,
|
|
106
135
|
min_height: f32 = 0,
|
|
107
136
|
close_policy: []const u8 = "quit",
|
|
@@ -144,6 +173,8 @@ pub const RawShellWindow = struct {
|
|
|
144
173
|
always_on_top: bool = false,
|
|
145
174
|
click_through: bool = false,
|
|
146
175
|
activate_on_show: bool = true,
|
|
176
|
+
initially_hidden: bool = false,
|
|
177
|
+
allows_fullscreen: bool = true,
|
|
147
178
|
min_width: f32 = 0,
|
|
148
179
|
min_height: f32 = 0,
|
|
149
180
|
close_policy: []const u8 = "quit",
|
|
@@ -221,3 +252,37 @@ pub const RawUrlScheme = struct {
|
|
|
221
252
|
scheme: []const u8,
|
|
222
253
|
role: []const u8 = "viewer",
|
|
223
254
|
};
|
|
255
|
+
|
|
256
|
+
pub const RawDmgPosition = struct {
|
|
257
|
+
x: u16,
|
|
258
|
+
y: u16,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/// One visible Finder item in an explicitly art-directed DMG. `app` names
|
|
262
|
+
/// the packaged bundle (and may override its DMG-only display name),
|
|
263
|
+
/// `applications` creates the conventional alias,
|
|
264
|
+
/// `file` copies a project-relative file or directory, and `link` creates a
|
|
265
|
+
/// symlink to an absolute path. An explicit list replaces the legacy fixed
|
|
266
|
+
/// app/Applications pair.
|
|
267
|
+
pub const RawDmgItem = struct {
|
|
268
|
+
kind: []const u8,
|
|
269
|
+
path: ?[]const u8 = null,
|
|
270
|
+
name: ?[]const u8 = null,
|
|
271
|
+
position: RawDmgPosition,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/// Finder presentation for the macOS archive produced by
|
|
275
|
+
/// `native package --target macos --archive`. The defaults are a complete
|
|
276
|
+
/// drag-to-Applications layout; apps only declare this block when they want
|
|
277
|
+
/// to art-direct it.
|
|
278
|
+
pub const RawDmg = struct {
|
|
279
|
+
volume_name: ?[]const u8 = null,
|
|
280
|
+
background: ?[]const u8 = null,
|
|
281
|
+
window_width: u16 = 660,
|
|
282
|
+
window_height: u16 = 400,
|
|
283
|
+
icon_size: u16 = 128,
|
|
284
|
+
app_position: RawDmgPosition = .{ .x = 166, .y = 182 },
|
|
285
|
+
applications_position: RawDmgPosition = .{ .x = 486, .y = 182 },
|
|
286
|
+
applications_link: bool = true,
|
|
287
|
+
items: []const RawDmgItem = &.{},
|
|
288
|
+
};
|
package/src/tooling/root.zig
CHANGED
|
@@ -18,6 +18,7 @@ pub const ts_core = @import("ts_core.zig");
|
|
|
18
18
|
pub const ios = @import("ios.zig");
|
|
19
19
|
pub const android = @import("android.zig");
|
|
20
20
|
pub const xcodeproj = @import("xcodeproj.zig");
|
|
21
|
+
pub const db = @import("db.zig");
|
|
21
22
|
|
|
22
23
|
test {
|
|
23
24
|
@import("std").testing.refAllDecls(@This());
|
|
@@ -1444,6 +1444,10 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1444
1444
|
\\ const web_layer = resolveWebLayer(app_config, web_engine, web_layer_override);
|
|
1445
1445
|
\\
|
|
1446
1446
|
\\ const native_sdk_mod = nativeSdkModule(b, target, optimize, native_sdk_path);
|
|
1447
|
+
\\ const relational_migrations_source = if (app_config.relational_capability)
|
|
1448
|
+
\\ sqliteMigrationsSource(b, native_sdk_path)
|
|
1449
|
+
\\ else
|
|
1450
|
+
\\ nativeSdkPath(b, native_sdk_path, "src/app_runner/no_migrations.zig");
|
|
1447
1451
|
\\ const options = b.addOptions();
|
|
1448
1452
|
\\ options.addOption([]const u8, "platform", switch (selected_platform) {
|
|
1449
1453
|
\\ .auto => unreachable,
|
|
@@ -1464,10 +1468,15 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1464
1468
|
\\ runner_mod.addImport("native_sdk", native_sdk_mod);
|
|
1465
1469
|
\\ runner_mod.addImport("build_options", options_mod);
|
|
1466
1470
|
\\ runner_mod.addImport("app_manifest_zon", b.createModule(.{ .root_source_file = b.path("app.zon") }));
|
|
1471
|
+
\\ const migrations_mod = b.createModule(.{ .root_source_file = relational_migrations_source, .target = target, .optimize = optimize });
|
|
1472
|
+
\\ migrations_mod.addImport("native_sdk", native_sdk_mod);
|
|
1473
|
+
\\ runner_mod.addImport("relational_migrations", migrations_mod);
|
|
1467
1474
|
\\
|
|
1468
1475
|
\\ const app_mod = localModule(b, target, optimize, "src/main.zig");
|
|
1469
1476
|
\\ app_mod.addImport("native_sdk", native_sdk_mod);
|
|
1470
1477
|
\\ app_mod.addImport("runner", runner_mod);
|
|
1478
|
+
\\ if (app_config.sqlite_capability) addSqliteEngine(b, app_mod, native_sdk_path);
|
|
1479
|
+
\\ addMacosPrivacyInfoPlist(b, app_mod, target, app_config);
|
|
1471
1480
|
\\ const exe = b.addExecutable(.{
|
|
1472
1481
|
\\ .name = app_exe_name,
|
|
1473
1482
|
\\ .root_module = app_mod,
|
|
@@ -1526,9 +1535,14 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1526
1535
|
\\ package_runner_mod.addImport("native_sdk", package_sdk_mod);
|
|
1527
1536
|
\\ package_runner_mod.addImport("build_options", options_mod);
|
|
1528
1537
|
\\ package_runner_mod.addImport("app_manifest_zon", b.createModule(.{ .root_source_file = b.path("app.zon") }));
|
|
1538
|
+
\\ const package_migrations_mod = b.createModule(.{ .root_source_file = relational_migrations_source, .target = target, .optimize = package_optimize });
|
|
1539
|
+
\\ package_migrations_mod.addImport("native_sdk", package_sdk_mod);
|
|
1540
|
+
\\ package_runner_mod.addImport("relational_migrations", package_migrations_mod);
|
|
1529
1541
|
\\ const package_app_mod = localModule(b, target, package_optimize, "src/main.zig");
|
|
1530
1542
|
\\ package_app_mod.addImport("native_sdk", package_sdk_mod);
|
|
1531
1543
|
\\ package_app_mod.addImport("runner", package_runner_mod);
|
|
1544
|
+
\\ if (app_config.sqlite_capability) addSqliteEngine(b, package_app_mod, native_sdk_path);
|
|
1545
|
+
\\ addMacosPrivacyInfoPlist(b, package_app_mod, target, app_config);
|
|
1532
1546
|
\\ const built = b.addExecutable(.{
|
|
1533
1547
|
\\ .name = app_exe_name,
|
|
1534
1548
|
\\ .root_module = package_app_mod,
|
|
@@ -1600,6 +1614,33 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1600
1614
|
\\ return if (target.result.cpu.arch == .x86_64) true else null;
|
|
1601
1615
|
\\}
|
|
1602
1616
|
\\
|
|
1617
|
+
\\/// Bare Mach-O dev executables have no bundle Info.plist. Embed the
|
|
1618
|
+
\\/// capture usage strings derived from app.zon so macOS can present
|
|
1619
|
+
\\/// consent instead of terminating the process. Packaged apps also
|
|
1620
|
+
\\/// receive the richer external plist from the package command.
|
|
1621
|
+
\\fn addMacosPrivacyInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: std.Build.ResolvedTarget, config: AppManifestBuildConfig) void {
|
|
1622
|
+
\\ if (target.result.os.tag != .macos) return;
|
|
1623
|
+
\\ if (!config.microphone_permission and !config.system_audio_permission) return;
|
|
1624
|
+
\\
|
|
1625
|
+
\\ const microphone = if (config.microphone_permission)
|
|
1626
|
+
\\ " <key>NSMicrophoneUsageDescription</key>\\n <string>This app captures microphone audio when you start recording.</string>\\n"
|
|
1627
|
+
\\ else
|
|
1628
|
+
\\ "";
|
|
1629
|
+
\\ const system_audio = if (config.system_audio_permission)
|
|
1630
|
+
\\ " <key>NSAudioCaptureUsageDescription</key>\\n <string>This app captures system audio when you start recording.</string>\\n" ++
|
|
1631
|
+
\\ " <key>NSScreenCaptureUsageDescription</key>\\n <string>This app captures system audio when you start recording.</string>\\n"
|
|
1632
|
+
\\ else
|
|
1633
|
+
\\ "";
|
|
1634
|
+
\\ const source = b.fmt(
|
|
1635
|
+
\\ \\#define NATIVE_SDK_INFO_PLIST "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n<dict>\n{s}{s}</dict>\n</plist>\n"
|
|
1636
|
+
\\ \\__attribute__((used, section("__TEXT,__info_plist")))
|
|
1637
|
+
\\ \\static const unsigned char native_sdk_info_plist[sizeof(NATIVE_SDK_INFO_PLIST) - 1] = NATIVE_SDK_INFO_PLIST;
|
|
1638
|
+
\\ \\
|
|
1639
|
+
\\ , .{ microphone, system_audio });
|
|
1640
|
+
\\ const generated = b.addWriteFiles().add("native_sdk_macos_info_plist.c", source);
|
|
1641
|
+
\\ app_mod.addCSourceFile(.{ .file = generated, .flags = &.{} });
|
|
1642
|
+
\\}
|
|
1643
|
+
\\
|
|
1603
1644
|
\\// Resolve the optimize mode for one exe role (mirrors the Native SDK
|
|
1604
1645
|
\\// build graph): an explicit -Doptimize wins for every role, --release
|
|
1605
1646
|
\\// resolves through zig's release_mode, and only when neither was
|
|
@@ -1676,6 +1717,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1676
1717
|
\\ debug_mod.addImport("trace", trace_mod);
|
|
1677
1718
|
\\
|
|
1678
1719
|
\\ const native_sdk_mod = externalModule(b, target, optimize, native_sdk_path, "src/root.zig");
|
|
1720
|
+
\\ native_sdk_mod.addIncludePath(nativeSdkPath(b, native_sdk_path, "third_party/sqlite"));
|
|
1679
1721
|
\\ native_sdk_mod.addImport("geometry", geometry_mod);
|
|
1680
1722
|
\\ native_sdk_mod.addImport("assets", assets_mod);
|
|
1681
1723
|
\\ native_sdk_mod.addImport("app_dirs", app_dirs_mod);
|
|
@@ -1688,6 +1730,44 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1688
1730
|
\\ return native_sdk_mod;
|
|
1689
1731
|
\\}
|
|
1690
1732
|
\\
|
|
1733
|
+
\\fn sqliteMigrationsSource(b: *std.Build, native_sdk_path: []const u8) std.Build.LazyPath {
|
|
1734
|
+
\\ const generate = b.addSystemCommand(&.{ "node" });
|
|
1735
|
+
\\ generate.addFileArg(nativeSdkPath(b, native_sdk_path, "build/ts_run.mjs"));
|
|
1736
|
+
\\ generate.addFileArg(nativeSdkPath(b, native_sdk_path, "packages/core/src/sqlite_cli.ts"));
|
|
1737
|
+
\\ generate.addArg("--src");
|
|
1738
|
+
\\ generate.addDirectoryArg(b.path("src"));
|
|
1739
|
+
\\ generate.addArg("--zig-out");
|
|
1740
|
+
\\ const migrations = generate.addOutputFileArg("migrations.zig");
|
|
1741
|
+
\\ generate.addArgs(&.{ "--state", "src/schema/migrations.lock.json" });
|
|
1742
|
+
\\ if (b.build_root.handle.access(b.graph.io, "src/schema/migrations.lock.json", .{})) |_| {
|
|
1743
|
+
\\ generate.addFileInput(b.path("src/schema/migrations.lock.json"));
|
|
1744
|
+
\\ } else |_| {}
|
|
1745
|
+
\\ generate.addFileInput(nativeSdkPath(b, native_sdk_path, "packages/core/src/sqlite_codegen.ts"));
|
|
1746
|
+
\\ generate.addFileInput(nativeSdkPath(b, native_sdk_path, "packages/core/src/sqlite_runtime_policy.ts"));
|
|
1747
|
+
\\ addAppSqlDirInputs(b, generate, "src");
|
|
1748
|
+
\\ return migrations;
|
|
1749
|
+
\\}
|
|
1750
|
+
\\
|
|
1751
|
+
\\fn addAppSqlDirInputs(b: *std.Build, run: *std.Build.Step.Run, src_path: []const u8) void {
|
|
1752
|
+
\\ var dir = b.build_root.handle.openDir(b.graph.io, src_path, .{ .iterate = true }) catch return;
|
|
1753
|
+
\\ defer dir.close(b.graph.io);
|
|
1754
|
+
\\ var walker = dir.walk(b.allocator) catch return;
|
|
1755
|
+
\\ defer walker.deinit();
|
|
1756
|
+
\\ while (walker.next(b.graph.io) catch null) |entry| {
|
|
1757
|
+
\\ if (entry.kind != .file or !std.mem.endsWith(u8, entry.basename, ".sql")) continue;
|
|
1758
|
+
\\ run.addFileInput(b.path(b.fmt("{s}/{s}", .{ src_path, entry.path })));
|
|
1759
|
+
\\ }
|
|
1760
|
+
\\}
|
|
1761
|
+
\\
|
|
1762
|
+
\\fn addSqliteEngine(b: *std.Build, app_mod: *std.Build.Module, native_sdk_path: []const u8) void {
|
|
1763
|
+
\\ app_mod.addIncludePath(nativeSdkPath(b, native_sdk_path, "third_party/sqlite"));
|
|
1764
|
+
\\ app_mod.addCSourceFile(.{
|
|
1765
|
+
\\ .file = nativeSdkPath(b, native_sdk_path, "third_party/sqlite/sqlite3.c"),
|
|
1766
|
+
\\ .flags = &.{ "-DSQLITE_THREADSAFE=2", "-DSQLITE_OMIT_LOAD_EXTENSION", "-DSQLITE_DQS=0", "-DSQLITE_ENABLE_FTS5", "-DSQLITE_ENABLE_JSON1", "-DSQLITE_ENABLE_UPDATE_HOOK", "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "-DSQLITE_DEFAULT_MEMSTATUS=0" },
|
|
1767
|
+
\\ });
|
|
1768
|
+
\\ app_mod.link_libc = true;
|
|
1769
|
+
\\}
|
|
1770
|
+
\\
|
|
1691
1771
|
\\fn externalModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, native_sdk_path: []const u8, path: []const u8) *std.Build.Module {
|
|
1692
1772
|
\\ return b.createModule(.{
|
|
1693
1773
|
\\ .root_source_file = nativeSdkPath(b, native_sdk_path, path),
|
|
@@ -1731,6 +1811,8 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1731
1811
|
\\ }
|
|
1732
1812
|
\\ app_mod.linkFramework("AppKit", .{});
|
|
1733
1813
|
\\ app_mod.linkFramework("AVFoundation", .{});
|
|
1814
|
+
\\ app_mod.linkFramework("CoreMedia", .{});
|
|
1815
|
+
\\ app_mod.linkFramework("ScreenCaptureKit", .{ .weak = true });
|
|
1734
1816
|
\\ app_mod.linkFramework("CoreVideo", .{});
|
|
1735
1817
|
\\ app_mod.linkFramework("MediaToolbox", .{});
|
|
1736
1818
|
\\ app_mod.linkFramework("Accelerate", .{});
|
|
@@ -1846,6 +1928,10 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1846
1928
|
\\ app_mod.linkSystemLibrary("ole32", .{});
|
|
1847
1929
|
\\ app_mod.linkSystemLibrary("oleacc", .{});
|
|
1848
1930
|
\\ app_mod.linkSystemLibrary("shell32", .{});
|
|
1931
|
+
\\ // TypeScript cores link ScriptC's host runtime, whose network-interface
|
|
1932
|
+
\\ // helpers use GetAdaptersAddresses and Winsock address conversion.
|
|
1933
|
+
\\ app_mod.linkSystemLibrary("iphlpapi", .{});
|
|
1934
|
+
\\ app_mod.linkSystemLibrary("ws2_32", .{});
|
|
1849
1935
|
\\ // The audio backend: Media Foundation (session + source resolver
|
|
1850
1936
|
\\ // + streaming audio renderer) and WinHTTP (the cache fill).
|
|
1851
1937
|
\\ app_mod.linkSystemLibrary("mf", .{});
|
|
@@ -1955,6 +2041,10 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1955
2041
|
\\ cef_dir: []const u8 = "third_party/cef/macos",
|
|
1956
2042
|
\\ cef_auto_install: bool = false,
|
|
1957
2043
|
\\ webview_layer: WebLayerOption = .auto,
|
|
2044
|
+
\\ microphone_permission: bool = false,
|
|
2045
|
+
\\ system_audio_permission: bool = false,
|
|
2046
|
+
\\ sqlite_capability: bool = false,
|
|
2047
|
+
\\ relational_capability: bool = false,
|
|
1958
2048
|
\\ /// The first web declaration found (for teaching messages), or
|
|
1959
2049
|
\\ /// null when app.zon declares no web use. `web_engine = "system"`
|
|
1960
2050
|
\\ /// alone is NOT web intent — it is the default in many canvas
|
|
@@ -1967,6 +2057,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1967
2057
|
\\/// ignored. Full schema validation stays with `native validate`.
|
|
1968
2058
|
\\const InferenceManifest = struct {
|
|
1969
2059
|
\\ capabilities: []const []const u8 = &.{},
|
|
2060
|
+
\\ permissions: []const []const u8 = &.{},
|
|
1970
2061
|
\\ web_engine: []const u8 = "system",
|
|
1971
2062
|
\\ webview_layer: []const u8 = "auto",
|
|
1972
2063
|
\\ cef: struct {
|
|
@@ -2005,6 +2096,10 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
2005
2096
|
\\ .cef_dir = raw.cef.dir,
|
|
2006
2097
|
\\ .cef_auto_install = raw.cef.auto_install,
|
|
2007
2098
|
\\ .webview_layer = parseWebLayer(raw.webview_layer) orelse @panic("app.zon .webview_layer must be \"auto\", \"include\", or \"exclude\""),
|
|
2099
|
+
\\ .microphone_permission = hasManifestPermission(raw.permissions, "microphone"),
|
|
2100
|
+
\\ .system_audio_permission = hasManifestPermission(raw.permissions, "system_audio"),
|
|
2101
|
+
\\ .sqlite_capability = hasManifestCapability(raw.capabilities, "store") or hasManifestCapability(raw.capabilities, "sqlite"),
|
|
2102
|
+
\\ .relational_capability = hasManifestCapability(raw.capabilities, "sqlite"),
|
|
2008
2103
|
\\ };
|
|
2009
2104
|
\\ config.web_declaration = blk: {
|
|
2010
2105
|
\\ if (raw.frontend != null) break :blk "a .frontend block";
|
|
@@ -2021,6 +2116,20 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
2021
2116
|
\\ return config;
|
|
2022
2117
|
\\}
|
|
2023
2118
|
\\
|
|
2119
|
+
\\fn hasManifestPermission(permissions: []const []const u8, name: []const u8) bool {
|
|
2120
|
+
\\ for (permissions) |permission| {
|
|
2121
|
+
\\ if (std.mem.eql(u8, permission, name)) return true;
|
|
2122
|
+
\\ }
|
|
2123
|
+
\\ return false;
|
|
2124
|
+
\\}
|
|
2125
|
+
\\
|
|
2126
|
+
\\fn hasManifestCapability(capabilities: []const []const u8, name: []const u8) bool {
|
|
2127
|
+
\\ for (capabilities) |capability| {
|
|
2128
|
+
\\ if (std.mem.eql(u8, capability, name)) return true;
|
|
2129
|
+
\\ }
|
|
2130
|
+
\\ return false;
|
|
2131
|
+
\\}
|
|
2132
|
+
\\
|
|
2024
2133
|
\\/// The web-layer decision for this build — the same declare-to-use
|
|
2025
2134
|
\\/// contract the Native SDK's standard build graph, CLI, and runner
|
|
2026
2135
|
\\/// apply: an app is WEB when app.zon declares web use (a .frontend
|
|
@@ -2193,6 +2302,7 @@ fn runnerZig() []const u8 {
|
|
|
2193
2302
|
\\const build_options = @import("build_options");
|
|
2194
2303
|
\\const native_sdk = @import("native_sdk");
|
|
2195
2304
|
\\const app_manifest = @import("app_manifest_zon");
|
|
2305
|
+
\\const built_relational_migrations = @import("relational_migrations");
|
|
2196
2306
|
\\const manifest_commands = if (@hasField(@TypeOf(app_manifest), "commands")) app_manifest.commands else .{};
|
|
2197
2307
|
\\const manifest_shortcuts = if (@hasField(@TypeOf(app_manifest), "shortcuts")) app_manifest.shortcuts else .{};
|
|
2198
2308
|
\\const manifest_menus = if (@hasField(@TypeOf(app_manifest), "menus")) app_manifest.menus else .{};
|
|
@@ -2225,6 +2335,9 @@ fn runnerZig() []const u8 {
|
|
|
2225
2335
|
\\ commands: ?[]const native_sdk.Command = null,
|
|
2226
2336
|
\\ menus: ?[]const native_sdk.Menu = null,
|
|
2227
2337
|
\\ shortcuts: ?[]const native_sdk.Shortcut = null,
|
|
2338
|
+
\\ record_store: ?native_sdk.RecordStoreBinding = null,
|
|
2339
|
+
\\ relational_store: ?native_sdk.RelationalStoreBinding = null,
|
|
2340
|
+
\\ relational_migrations: []const native_sdk.relational_store.Migration = &built_relational_migrations.migrations,
|
|
2228
2341
|
\\
|
|
2229
2342
|
\\ fn appInfo(self: RunOptions, buffers: *StateBuffers) native_sdk.AppInfo {
|
|
2230
2343
|
\\ var info: native_sdk.AppInfo = .{
|
|
@@ -2255,6 +2368,7 @@ fn runnerZig() []const u8 {
|
|
|
2255
2368
|
\\ info.main_window.always_on_top = manifestShellStartupBool("always_on_top", false);
|
|
2256
2369
|
\\ info.main_window.click_through = manifestShellStartupBool("click_through", false);
|
|
2257
2370
|
\\ info.main_window.activate_on_show = manifestShellStartupBool("activate_on_show", true);
|
|
2371
|
+
\\ info.main_window.allows_fullscreen = manifestShellStartupBool("allows_fullscreen", true);
|
|
2258
2372
|
\\ // Min-size floors ride the create call like the titlebar:
|
|
2259
2373
|
\\ // the scene re-applies size/title later, but the window's
|
|
2260
2374
|
\\ // enforced floor is host state from the first frame on.
|
|
@@ -2387,10 +2501,12 @@ fn runnerZig() []const u8 {
|
|
|
2387
2501
|
\\ .restore_state = windowBool(window, "restore_state", true),
|
|
2388
2502
|
\\ .restore_policy = windowRestorePolicy(window),
|
|
2389
2503
|
\\ .titlebar = windowTitlebarStyle(window),
|
|
2504
|
+
\\ .show = if (windowBool(window, "initially_hidden", false)) .hidden else .immediate,
|
|
2390
2505
|
\\ .transparent = windowBool(window, "transparent", false),
|
|
2391
2506
|
\\ .always_on_top = windowBool(window, "always_on_top", false),
|
|
2392
2507
|
\\ .click_through = windowBool(window, "click_through", false),
|
|
2393
2508
|
\\ .activate_on_show = windowBool(window, "activate_on_show", true),
|
|
2509
|
+
\\ .allows_fullscreen = windowBool(window, "allows_fullscreen", true),
|
|
2394
2510
|
\\ .min_width = windowMinSize(window, "min_width"),
|
|
2395
2511
|
\\ .min_height = windowMinSize(window, "min_height"),
|
|
2396
2512
|
\\ .close_policy = windowClosePolicy(window),
|
|
@@ -2510,6 +2626,7 @@ fn runnerZig() []const u8 {
|
|
|
2510
2626
|
\\ if (comptime !@hasField(@TypeOf(shell), "windows")) return .immediate;
|
|
2511
2627
|
\\ if (comptime shell.windows.len == 0) return .immediate;
|
|
2512
2628
|
\\ const window = shell.windows[0];
|
|
2629
|
+
\\ if (comptime windowBool(window, "initially_hidden", false)) return .hidden;
|
|
2513
2630
|
\\ if (comptime !@hasField(@TypeOf(window), "views")) return .immediate;
|
|
2514
2631
|
\\ inline for (window.views) |view| {
|
|
2515
2632
|
\\ if (comptime @hasField(@TypeOf(view), "kind")) {
|
|
@@ -2555,6 +2672,24 @@ fn runnerZig() []const u8 {
|
|
|
2555
2672
|
\\ return false;
|
|
2556
2673
|
\\}
|
|
2557
2674
|
\\
|
|
2675
|
+
\\fn manifestDeclaresStore() bool {
|
|
2676
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest), "capabilities")) return false;
|
|
2677
|
+
\\ inline for (app_manifest.capabilities) |capability| {
|
|
2678
|
+
\\ const name: []const u8 = capability;
|
|
2679
|
+
\\ if (comptime std.mem.eql(u8, name, "store")) return true;
|
|
2680
|
+
\\ }
|
|
2681
|
+
\\ return false;
|
|
2682
|
+
\\}
|
|
2683
|
+
\\
|
|
2684
|
+
\\fn manifestDeclaresSqlite() bool {
|
|
2685
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest), "capabilities")) return false;
|
|
2686
|
+
\\ inline for (app_manifest.capabilities) |capability| {
|
|
2687
|
+
\\ const name: []const u8 = capability;
|
|
2688
|
+
\\ if (comptime std.mem.eql(u8, name, "sqlite")) return true;
|
|
2689
|
+
\\ }
|
|
2690
|
+
\\ return false;
|
|
2691
|
+
\\}
|
|
2692
|
+
\\
|
|
2558
2693
|
\\fn menuItem(comptime item: anytype) native_sdk.MenuItem {
|
|
2559
2694
|
\\ return .{
|
|
2560
2695
|
\\ .label = if (@hasField(@TypeOf(item), "label")) item.label else "",
|
|
@@ -2593,14 +2728,60 @@ fn runnerZig() []const u8 {
|
|
|
2593
2728
|
\\ if (build_options.debug_overlay) {
|
|
2594
2729
|
\\ std.debug.print("debug-overlay=true backend={s} web-engine={s} trace={s}\n", .{ build_options.platform, build_options.web_engine, build_options.trace });
|
|
2595
2730
|
\\ }
|
|
2731
|
+
\\ const RecordStoreType = if (comptime manifestDeclaresStore()) native_sdk.RecordStore else void;
|
|
2732
|
+
\\ var record_store_value: RecordStoreType = undefined;
|
|
2733
|
+
\\ var record_store_open = false;
|
|
2734
|
+
\\ var resolved_options = options;
|
|
2735
|
+
\\ if (comptime manifestDeclaresStore()) {
|
|
2736
|
+
\\ var data_dir_buffer: [512]u8 = undefined;
|
|
2737
|
+
\\ const app_data_dir = native_sdk.app_dirs.resolveOne(
|
|
2738
|
+
\\ .{ .name = options.bundle_id },
|
|
2739
|
+
\\ native_sdk.app_dirs.currentPlatform(),
|
|
2740
|
+
\\ native_sdk.debug.envFromMap(init.environ_map),
|
|
2741
|
+
\\ .data,
|
|
2742
|
+
\\ &data_dir_buffer,
|
|
2743
|
+
\\ ) catch return error.StoreDataDirUnavailable;
|
|
2744
|
+
\\ try std.Io.Dir.cwd().createDirPath(init.io, app_data_dir);
|
|
2745
|
+
\\ record_store_value = try native_sdk.RecordStore.open(std.heap.page_allocator, app_data_dir);
|
|
2746
|
+
\\ record_store_open = true;
|
|
2747
|
+
\\ resolved_options.record_store = record_store_value.binding();
|
|
2748
|
+
\\ }
|
|
2749
|
+
\\ defer if (comptime manifestDeclaresStore()) {
|
|
2750
|
+
\\ if (record_store_open) record_store_value.deinit();
|
|
2751
|
+
\\ };
|
|
2752
|
+
\\ const RelationalStoreType = if (comptime manifestDeclaresSqlite()) native_sdk.RelationalStore else void;
|
|
2753
|
+
\\ var relational_store_value: RelationalStoreType = undefined;
|
|
2754
|
+
\\ var relational_store_open = false;
|
|
2755
|
+
\\ if (comptime manifestDeclaresSqlite()) {
|
|
2756
|
+
\\ var data_dir_buffer: [512]u8 = undefined;
|
|
2757
|
+
\\ const app_data_dir = native_sdk.app_dirs.resolveOne(
|
|
2758
|
+
\\ .{ .name = options.bundle_id },
|
|
2759
|
+
\\ native_sdk.app_dirs.currentPlatform(),
|
|
2760
|
+
\\ native_sdk.debug.envFromMap(init.environ_map),
|
|
2761
|
+
\\ .data,
|
|
2762
|
+
\\ &data_dir_buffer,
|
|
2763
|
+
\\ ) catch return error.SqliteDataDirUnavailable;
|
|
2764
|
+
\\ try std.Io.Dir.cwd().createDirPath(init.io, app_data_dir);
|
|
2765
|
+
\\ const open_result = try native_sdk.RelationalStore.openMigrated(std.heap.page_allocator, app_data_dir, options.relational_migrations);
|
|
2766
|
+
\\ relational_store_value = switch (open_result.outcome) {
|
|
2767
|
+
\\ .ok => open_result.database.?,
|
|
2768
|
+
\\ .migrate_failed => return error.SqliteMigrationFailed,
|
|
2769
|
+
\\ .version_unknown => return error.SqliteVersionUnknown,
|
|
2770
|
+
\\ };
|
|
2771
|
+
\\ relational_store_open = true;
|
|
2772
|
+
\\ resolved_options.relational_store = relational_store_value.binding();
|
|
2773
|
+
\\ }
|
|
2774
|
+
\\ defer if (comptime manifestDeclaresSqlite()) {
|
|
2775
|
+
\\ if (relational_store_open) relational_store_value.deinit();
|
|
2776
|
+
\\ };
|
|
2596
2777
|
\\ if (comptime std.mem.eql(u8, build_options.platform, "macos")) {
|
|
2597
|
-
\\ try runMacos(app,
|
|
2778
|
+
\\ try runMacos(app, resolved_options, init);
|
|
2598
2779
|
\\ } else if (comptime std.mem.eql(u8, build_options.platform, "linux")) {
|
|
2599
|
-
\\ try runLinux(app,
|
|
2780
|
+
\\ try runLinux(app, resolved_options, init);
|
|
2600
2781
|
\\ } else if (comptime std.mem.eql(u8, build_options.platform, "windows")) {
|
|
2601
|
-
\\ try runWindows(app,
|
|
2782
|
+
\\ try runWindows(app, resolved_options, init);
|
|
2602
2783
|
\\ } else {
|
|
2603
|
-
\\ try runNull(app,
|
|
2784
|
+
\\ try runNull(app, resolved_options, init);
|
|
2604
2785
|
\\ }
|
|
2605
2786
|
\\}
|
|
2606
2787
|
\\
|
|
@@ -2652,6 +2833,8 @@ fn runnerZig() []const u8 {
|
|
|
2652
2833
|
\\ .shortcuts = shortcuts,
|
|
2653
2834
|
\\ .automation = if (build_options.automation) native_sdk.automation.Server.init(init.io, ".zig-cache/native-sdk-automation", app_info.resolvedWindowTitle()) else null,
|
|
2654
2835
|
\\ .window_state_store = store,
|
|
2836
|
+
\\ .record_store = options.record_store,
|
|
2837
|
+
\\ .relational_store = options.relational_store,
|
|
2655
2838
|
\\ .environ = init.minimal.environ,
|
|
2656
2839
|
\\ });
|
|
2657
2840
|
\\
|
|
@@ -2706,6 +2889,8 @@ fn runnerZig() []const u8 {
|
|
|
2706
2889
|
\\ .shortcuts = shortcuts,
|
|
2707
2890
|
\\ .automation = if (build_options.automation) native_sdk.automation.Server.init(init.io, ".zig-cache/native-sdk-automation", app_info.resolvedWindowTitle()) else null,
|
|
2708
2891
|
\\ .window_state_store = store,
|
|
2892
|
+
\\ .record_store = options.record_store,
|
|
2893
|
+
\\ .relational_store = options.relational_store,
|
|
2709
2894
|
\\ .environ = init.minimal.environ,
|
|
2710
2895
|
\\ });
|
|
2711
2896
|
\\
|
|
@@ -2760,6 +2945,8 @@ fn runnerZig() []const u8 {
|
|
|
2760
2945
|
\\ .shortcuts = shortcuts,
|
|
2761
2946
|
\\ .automation = if (build_options.automation) native_sdk.automation.Server.init(init.io, ".zig-cache/native-sdk-automation", app_info.resolvedWindowTitle()) else null,
|
|
2762
2947
|
\\ .window_state_store = store,
|
|
2948
|
+
\\ .record_store = options.record_store,
|
|
2949
|
+
\\ .relational_store = options.relational_store,
|
|
2763
2950
|
\\ .environ = init.minimal.environ,
|
|
2764
2951
|
\\ });
|
|
2765
2952
|
\\
|
|
@@ -2814,6 +3001,8 @@ fn runnerZig() []const u8 {
|
|
|
2814
3001
|
\\ .shortcuts = shortcuts,
|
|
2815
3002
|
\\ .automation = if (build_options.automation) native_sdk.automation.Server.init(init.io, ".zig-cache/native-sdk-automation", app_info.resolvedWindowTitle()) else null,
|
|
2816
3003
|
\\ .window_state_store = store,
|
|
3004
|
+
\\ .record_store = options.record_store,
|
|
3005
|
+
\\ .relational_store = options.relational_store,
|
|
2817
3006
|
\\ .environ = init.minimal.environ,
|
|
2818
3007
|
\\ });
|
|
2819
3008
|
\\
|
|
@@ -3820,6 +4009,21 @@ test "writeDefaultApp emits Vite project files" {
|
|
|
3820
4009
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "src/platform/macos/cef_host.mm") != null);
|
|
3821
4010
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "src/platform/linux/gtk_host.c") != null);
|
|
3822
4011
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "app_manifest_zon") != null);
|
|
4012
|
+
// Standalone frontend builds launch a bare Mach-O during development,
|
|
4013
|
+
// so capture permissions must produce the same embedded usage strings
|
|
4014
|
+
// as the managed graph (for both dev and the separately optimized exe).
|
|
4015
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "permissions: []const []const u8") != null);
|
|
4016
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "hasManifestPermission(raw.permissions, \"microphone\")") != null);
|
|
4017
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "hasManifestCapability(raw.capabilities, \"store\")") != null);
|
|
4018
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "addSqliteEngine(b, app_mod, native_sdk_path)") != null);
|
|
4019
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "sqliteMigrationsSource(b, native_sdk_path)") != null);
|
|
4020
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "sqlite_runtime_policy.ts") != null);
|
|
4021
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "addAppSqlDirInputs(b, generate, \"src\")") != null);
|
|
4022
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "run.addFileInput(b.path(b.fmt") != null);
|
|
4023
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "runner_mod.addImport(\"relational_migrations\", migrations_mod)") != null);
|
|
4024
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "NSMicrophoneUsageDescription") != null);
|
|
4025
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "NSAudioCaptureUsageDescription") != null);
|
|
4026
|
+
try std.testing.expect(std.mem.count(u8, build_zig_text, "addMacosPrivacyInfoPlist(b, ") == 2);
|
|
3823
4027
|
// The generated graph carries the whole web-layer feature: the
|
|
3824
4028
|
// override option, the app.zon inference with its conflict panic,
|
|
3825
4029
|
// the option handed to the runner, and the conditional WebView2
|
|
@@ -3865,11 +4069,19 @@ test "writeDefaultApp emits Vite project files" {
|
|
|
3865
4069
|
try std.testing.expect(std.mem.indexOf(u8, main_zig_text, "frontend/dist") != null);
|
|
3866
4070
|
try std.testing.expect(std.mem.indexOf(u8, main_zig_text, "127.0.0.1:5173") != null);
|
|
3867
4071
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "@import(\"app_manifest_zon\")") != null);
|
|
4072
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "@import(\"relational_migrations\")") != null);
|
|
4073
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "RelationalStore.openMigrated") != null);
|
|
3868
4074
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "commands: ?[]const native_sdk.Command = null") != null);
|
|
3869
4075
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "resolvedCommands") != null);
|
|
3870
4076
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "menus: ?[]const native_sdk.Menu = null") != null);
|
|
3871
4077
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "resolvedMenus") != null);
|
|
3872
4078
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "shortcuts: ?[]const native_sdk.Shortcut = null") != null);
|
|
4079
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "record_store: ?native_sdk.RecordStoreBinding = null") != null);
|
|
4080
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn manifestDeclaresStore()") != null);
|
|
4081
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".record_store = options.record_store") != null);
|
|
4082
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "relational_store: ?native_sdk.RelationalStoreBinding = null") != null);
|
|
4083
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn manifestDeclaresSqlite()") != null);
|
|
4084
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".relational_store = options.relational_store") != null);
|
|
3873
4085
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "resolvedShortcuts") != null);
|
|
3874
4086
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "const manifest_windows") != null);
|
|
3875
4087
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn appInfo(self: RunOptions, buffers: *StateBuffers)") != null);
|