diff options
author | Dmitry Shevchenko <dmishe@google.com> | 2016-06-29 21:53:03 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-06-30 11:40:59 +0000 |
commit | eb6e6afca74146393dedad9ce10a9e56d9f6cb1b (patch) | |
tree | ea1d1f2935ca958b3c14bcab1324401fb4d5abe2 /src | |
parent | cf4d3fba915cc4e48c8810e5692e96ab8a9d3494 (diff) |
Add compilation mode handling to swift_library.
--
MOS_MIGRATED_REVID=126235788
Diffstat (limited to 'src')
-rwxr-xr-x | src/test/shell/bazel/bazel_apple_test.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_apple_test.sh b/src/test/shell/bazel/bazel_apple_test.sh index fa4de04ff8..4f2eeb6d8b 100755 --- a/src/test/shell/bazel/bazel_apple_test.sh +++ b/src/test/shell/bazel/bazel_apple_test.sh @@ -419,4 +419,33 @@ EOF } +function test_swift_compilation_mode_flags() { + rm -rf ios + mkdir -p ios + + cat >ios/debug.swift <<EOF +// A trick to break compilation when DEBUG is not set. +func foo() { + #if DEBUG + var x: Int + #endif + x = 3 +} +EOF + + cat >ios/BUILD <<EOF +load("//tools/build_defs/apple:swift.bzl", "swift_library") + +swift_library(name = "swift_lib", + srcs = ["debug.swift"]) +EOF + + ! bazel build --verbose_failures --ios_sdk_version=$IOS_SDK_VERSION -c opt \ + //ios:swift_lib >$TEST_log 2>&1 || fail "should not build" + expect_log "error: use of unresolved identifier 'x'" + + bazel build --verbose_failures --ios_sdk_version=$IOS_SDK_VERSION -c dbg \ + //ios:swift_lib >$TEST_log 2>&1 || fail "should build" +} + run_suite "apple_tests" |