I'm trying to scope out how hard it would be to have an option to build the test runner as a shared object file rather than an executable. E.g., instead of:
$ ~/Library/Developer/Toolchains/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-15-a.xctoolchain/usr/bin/swift build --swift-sdk aarch64-unknown-linux-android28 --build-tests
[134/134] Linking swift-android-nativePackageTests.xctest
Build complete! (10.87s)
$ file .build/aarch64-unknown-linux-android28/debug/swift-android-nativePackageTests.xctest
.build/aarch64-unknown-linux-android28/debug/swift-android-nativePackageTests.xctest: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[sha1]=247b4af289578f215fd136d07815ef2eb3a874db, with debug_info, not stripped
…I would rather have a swift-android-nativePackageTests.so
with a testingMain()
function that I can invoke within the context of an Android app.
The reason I need this is that while the test executable runs fine from an Android adb
shell (modulo some quirks), to have access to the full Android Java SDK, it needs to be run in the context of a proper .apk
app rather than a command-line tool.
And guidance or suggestions for where I might start my investigation would be appreciated.