diff options
author | 2016-12-15 23:10:55 +0000 | |
---|---|---|
committer | 2016-12-16 15:35:45 +0000 | |
commit | cf1c437c03588b3271d3fd786982fa2e51cd866f (patch) | |
tree | fa9d0307f801103326ad511d3ae62213bf498c24 /tools | |
parent | 2d87bf1937c81ef84358fd5f6a372875f6c6fabf (diff) |
Expose apple_generate_dsym value to Skylark and use in swift_library
--
PiperOrigin-RevId: 142194378
MOS_MIGRATED_REVID=142194378
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/apple/swift.bzl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/build_defs/apple/swift.bzl b/tools/build_defs/apple/swift.bzl index abee93da44..d45a447d82 100644 --- a/tools/build_defs/apple/swift.bzl +++ b/tools/build_defs/apple/swift.bzl @@ -47,12 +47,20 @@ def _swift_target(cpu, platform, sdk_version): def _swift_compilation_mode_flags(ctx): """Returns additional swiftc flags for the current compilation mode.""" mode = ctx.var["COMPILATION_MODE"] + + flags = [] if mode == "dbg": - return ["-Onone", "-DDEBUG", "-g", "-enable-testing"] + flags += ["-Onone", "-DDEBUG", "-enable-testing"] elif mode == "fastbuild": - return ["-Onone", "-DDEBUG", "-enable-testing"] + flags += ["-Onone", "-DDEBUG", "-enable-testing"] elif mode == "opt": - return ["-O", "-DNDEBUG"] + flags += ["-O", "-DNDEBUG"] + + if mode == "dbg" or (hasattr(ctx.fragments.objc, "generate_dsym") and + getattr(ctx.fragments.objc, "generate_dsym")): + flags.append("-g") + + return flags def _clang_compilation_mode_flags(ctx): |