mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This adds an Android target for the stdlib. It is also the first example of cross-compiling outside of Darwin. Mailing list discussions: 1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html 2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html The Android variant of Swift may be built using the following `build-script` invocation: ``` $ utils/build-script \ -R \ # Build in ReleaseAssert mode. --android \ # Build for Android. --android-ndk ~/android-ndk-r10e \ # Path to an Android NDK. --android-ndk-version 21 \ --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \ --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \ --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \ --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/ ``` Android builds have the following dependencies, as can be seen in the build script invocation: 1. An Android NDK of version 21 or greater, available to download here: http://developer.android.com/ndk/downloads/index.html. 2. A libicu compatible with android-armv7.
27 lines
665 B
Swift
27 lines
665 B
Swift
// RUN: %target-run-stdlib-swift | FileCheck %s
|
|
// REQUIRES: executable_test
|
|
|
|
import Swift
|
|
import StdlibUnittest
|
|
|
|
|
|
_setOverrideOSVersion(.android)
|
|
_setTestSuiteFailedCallback() { print("abort()") }
|
|
|
|
var XFailsAndroid = TestSuite("XFailsAndroid")
|
|
|
|
// CHECK: [ UXPASS ] XFailsAndroid.xfail Android passes{{$}}
|
|
XFailsAndroid.test("xfail Android passes").xfail(.androidAny(reason: "")).code {
|
|
expectEqual(1, 1)
|
|
}
|
|
|
|
// CHECK: [ XFAIL ] XFailsAndroid.xfail Android fails{{$}}
|
|
XFailsAndroid.test("xfail Android fails").xfail(.androidAny(reason: "")).code {
|
|
expectEqual(1, 2)
|
|
}
|
|
|
|
// CHECK: XFailsAndroid: Some tests failed, aborting
|
|
// CHECK: abort()
|
|
|
|
runAllTests()
|