mirror of
https://github.com/apple/swift.git
synced 2026-12-04 11:15:15 +01:00
`__system_property_get` and `PROP_VALUE_MAX` from `<sys/system_properties.h>` aren't visible through `import Android`. swift-testing includes the header in its C shim (`_TestingInternals/include/Includes.h`), and swift-foundation would need to do the same to read the device time zone (swiftlang/swift-foundation#2354, where @jmschonfeld asked whether this belongs in the `Android` module). This adds the header to `SwiftAndroidNDK.h` and an `android_apis.system_properties` submodule, like `sys_xattr` in #74742, and a typecheck test for Android. Testing: with the Android SDK from swift-6.4.1-RELEASE, the code in the new test fails to build with "cannot find 'PROP_VALUE_MAX' in scope". With these two files replaced in the SDK, it builds for aarch64, x86_64 and armv7 without warnings. I didn't run the lit test itself, which needs an Android build of the compiler.
9 lines
327 B
Swift
9 lines
327 B
Swift
// RUN: %target-swift-frontend -typecheck %s -verify
|
|
// REQUIRES: OS=linux-android || OS=linux-androideabi
|
|
|
|
import Android
|
|
|
|
// The system property API from `sys/system_properties.h` is part of the module.
|
|
let _: Int32 = PROP_VALUE_MAX
|
|
let _: (UnsafePointer<CChar>, UnsafeMutablePointer<CChar>) -> Int32 = __system_property_get
|