aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Dmitry Shevchenko <dmishe@google.com>2016-10-19 18:31:40 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-10-19 19:21:01 +0000
commitfc0b635652c566c8f4db00fe317377803a9211d1 (patch)
treeba163c4a31cd4275b7ed2a71eb31b9de4e806a09 /src
parentd0a08e5c64b7ce9f5d4c6a83c8398bb42b26cdb2 (diff)
Add swiftmodule outputs to the linking step.
* This change enables most of LLDB functionality on binaries built by swift_library. It makes the linker record references to the .swiftmodule outputs, which then can be read by LLDB to deserialize Swift modules and provide debug info. -- MOS_MIGRATED_REVID=136620475
Diffstat (limited to 'src')
-rwxr-xr-xsrc/test/shell/bazel/apple/bazel_apple_test.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/shell/bazel/apple/bazel_apple_test.sh b/src/test/shell/bazel/apple/bazel_apple_test.sh
index a2546b3de7..9831b319f7 100755
--- a/src/test/shell/bazel/apple/bazel_apple_test.sh
+++ b/src/test/shell/bazel/apple/bazel_apple_test.sh
@@ -740,4 +740,42 @@ EOF
expect_log "Error in target '//ios:bad-dep'"
}
+function test_swift_ast_is_recorded() {
+ rm -rf ios
+ mkdir -p ios
+
+ touch ios/main.swift
+ touch ios/dep.swift
+
+ cat >ios/main.m <<EOF
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, nil);
+ }
+}
+EOF
+
+ cat >ios/BUILD <<EOF
+load("//tools/build_defs/apple:swift.bzl", "swift_library")
+
+swift_library(name = "dep",
+ srcs = ["dep.swift"])
+
+swift_library(name = "swift_lib",
+ srcs = ["main.swift"],
+ deps = [":dep"])
+objc_binary(name = "bin",
+ srcs = ["main.m"],
+ deps = [":swift_lib"])
+EOF
+
+ bazel build --verbose_failures --ios_sdk_version=$IOS_SDK_VERSION \
+ --xcode_version=$XCODE_VERSION -s \
+ //ios:bin >$TEST_log 2>&1 || fail "should build"
+ expect_log "-Xlinker -add_ast_path -Xlinker bazel-out/local-fastbuild/genfiles/ios/dep/_objs/ios_dep.swiftmodule"
+ expect_log "-Xlinker -add_ast_path -Xlinker bazel-out/local-fastbuild/genfiles/ios/swift_lib/_objs/ios_swift_lib.swiftmodule"
+}
+
run_suite "apple_tests"