also looking at this
feat(android): a JNI runtime layer, and the discipline it has to carry
#136
2 files
+864
-0
| @@ -399,6 +399,20 @@ pub fn build(b: *std.Build) void { | ||
| 399 | 399 | .optimize = optimize, |
| 400 | 400 | }), |
| 401 | 401 | }); |
| 402 | // The JNI layer, on its own artifact because nothing on the iOS side | |
| 403 | // reaches it. It has no target gate: `JNIEnv` is a pointer to a table of | |
| 404 | // pointers, so the tests build one out of Zig functions and run anywhere — | |
| 405 | // no JVM, no emulator, no NDK. That is the whole reason the layer is shaped | |
| 406 | // the way it is. | |
| 407 | const jni_tests = b.addTest(.{ | |
| 408 | .root_module = b.createModule(.{ | |
| 409 | .root_source_file = b.path("src/jni_runtime.zig"), | |
| 410 | .target = target, | |
| 411 | .optimize = optimize, | |
| 412 | }), | |
| 413 | }); | |
| 414 | const run_jni_tests = b.addRunArtifact(jni_tests); | |
| 415 | ||
| 402 | 416 | ios_conformance_tests.root_module.addAnonymousImport("CraftApp.swift", .{ |
| 403 | 417 | .root_source_file = b.path("../ios/templates/CraftApp.swift"), |
| 404 | 418 | }); |
| @@ -1508,6 +1522,7 @@ pub fn build(b: *std.Build) void { | ||
| 1508 | 1522 | test_step.dependOn(&run_ios_module_tests.step); |
| 1509 | 1523 | } |
| 1510 | 1524 | test_step.dependOn(&run_ios_conformance_tests.step); |
| 1525 | test_step.dependOn(&run_jni_tests.step); | |
| 1511 | 1526 | test_step.dependOn(&run_menubar_tests.step); |
| 1512 | 1527 | test_step.dependOn(&run_components_tests.step); |
| 1513 | 1528 | test_step.dependOn(&run_gpu_tests.step); |
| @@ -2180,6 +2195,10 @@ pub fn build(b: *std.Build) void { | ||
| 2180 | 2195 | |
| 2181 | 2196 | const test_android_step = b.step("test:android", "Run Android tests"); |
| 2182 | 2197 | test_android_step.dependOn(&run_android_tests.step); |
| 2198 | // The JNI layer rides the existing Android step rather than adding a | |
| 2199 | // second one: `jni_runtime.zig` is the only way anything here reaches Java, | |
| 2200 | // so a run that skipped it would not be an Android test run. | |
| 2201 | test_android_step.dependOn(&run_jni_tests.step); | |
| 2183 | 2202 | |
| 2184 | 2203 | // Add Android tests to the main test step |
| 2185 | 2204 | test_step.dependOn(&run_android_tests.step); |