Files
sx/examples/platform/1666-platform-android-apk-smoke.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

34 lines
1.3 KiB
Plaintext

// Android `.apk` bundle smoke test — the corpus's first Android bundler
// coverage.
//
// `sx build --target android --apk <out.apk> --bundle-id <id> -o <lib.so>`
// cross-compiles for aarch64-linux-android and runs the sx default_pipeline
// → bundle_main, which drives javac/d8/aapt2/zipalign/apksigner to produce a
// signed APK containing `AndroidManifest.xml`, `classes.dex`,
// `lib/arm64-v8a/<lib.so>`, and `META-INF/` signatures. The `.build` `apk`
// directive builds + inspects the zip entries, then cleans up.
//
// GATED on the Android SDK (auto-discovered at $ANDROID_HOME /
// $ANDROID_SDK_ROOT / ~/Library/Android/sdk) + a real JDK on PATH — the macOS
// `/usr/bin/javac` stub is not enough. When either is missing the example
// SKIPS cleanly so a plain `zig build test` stays green.
//
// Build-only: `--target android` is a cross-compile, so the APK can't run on
// the build host. Runtime launch is validated manually on an emulator/device.
//
// Shape mirrors 1424 (a `#jni_main` Activity whose `onCreate` calls
// `super.onCreate(b)`, so the app is well-formed).
#import "modules/std.sx";
#import "modules/build.sx";
Bundle :: #jni_class("android/os/Bundle") extern { }
SxApp :: #jni_main #jni_class("co/swipelab/sxapksmoke/SxApp") {
onCreate :: (self: *Self, b: *Bundle) {
super.onCreate(b);
}
}
main :: () -> i32 { 0 }