Rename all example tests/companions to the XXXX-category-test-name scheme (per-category 100-blocks: basic 0010, types 0100, ... errors 1000, diagnostics 1100, ffi 1200, ffi-objc 1300, ffi-jni 1400, vectors 1500, platform 1600). Companions and dir/C fixtures move in lockstep with their parent test; #import/#source/#include paths rewritten to match. Expected output now lives in examples/expected/ (a sibling dir of the tests) split into three streams per the new convention: <name>.exit / <name>.stdout / <name>.stderr (+ optional <name>.ir) run_examples.sh rewritten: scans examples/ and issues/ for an expected/<name>.exit marker, captures stdout and stderr separately (no more 2>&1), compares each stream + exit + optional IR snapshot. Behavior validated unchanged: every renamed test reproduces its prior merged output + exit (diffs limited to file paths/basenames embedded in diagnostics + traces, which correctly reflect the new names). Suite: 292 passed, 0 failed. 50-smoke.sx split + issue relocation + docs follow in subsequent commits.
32 lines
1.4 KiB
Plaintext
32 lines
1.4 KiB
Plaintext
// `#jni_main` pipeline slice 2 (PLAN-FFI.md): the compiler renders a
|
|
// `.java` source for a `#jni_main #jni_class("...")` declaration, runs
|
|
// `javac` + `d8`, and bundles `classes.dex` into the APK.
|
|
//
|
|
// Slice 2 only wires the plumbing — the manifest still points at
|
|
// `android.app.NativeActivity`, so the user's class isn't loaded at
|
|
// runtime. Slice 3 (manifest synthesis) and slice 4 (RegisterNatives)
|
|
// land in follow-up commits.
|
|
//
|
|
// Build to inspect APK contents (requires Android SDK + JDK):
|
|
// /Users/agra/projects/sx/zig-out/bin/sx build --target android \
|
|
// --apk /tmp/sxjnimain.apk --bundle-id co.swipelab.sxjnimain \
|
|
// -o /tmp/libsxjnimain.so examples/ffi-jni-main-01-emit.sx
|
|
// unzip -l /tmp/sxjnimain.apk | grep classes.dex
|
|
|
|
#import "modules/std.sx";
|
|
#import "modules/compiler.sx";
|
|
|
|
// `*Bundle` resolves through the class registry to `android.os.Bundle`
|
|
// in the emitted Java — needed for `onCreate`'s @Override to match
|
|
// NativeActivity's superclass signature.
|
|
Bundle :: #foreign #jni_class("android/os/Bundle") { }
|
|
|
|
// `#jni_main` flags this as the launchable Android Activity class. The
|
|
// `onCreate` body is empty for now — slice 4 wires `RegisterNatives`
|
|
// so the `sx_onCreate` native delegate actually binds to a sx-side fn.
|
|
SxApp :: #jni_main #jni_class("co/swipelab/sxjnimain/SxApp") {
|
|
onCreate :: (self: *Self, b: *Bundle) { }
|
|
}
|
|
|
|
main :: () -> s32 { 0; }
|