aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs/apple/swift.bzl
diff options
context:
space:
mode:
authorGravatar Dmitry Shevchenko <dmishe@google.com>2016-09-22 17:01:43 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-09-22 17:52:46 +0000
commit502728844b4e0e6e753dc52152580464f1fd06a1 (patch)
tree6af170c5bb189765540aee64754389c343c76062 /tools/build_defs/apple/swift.bzl
parent754ece1a8599ec16f01ff3b7ea592c99aee2531f (diff)
Cleanup swift_library after Blaze release.
* Removes iOS specific platform/cpu calls in favor of platform-agnostic counterparts. -- MOS_MIGRATED_REVID=133966024
Diffstat (limited to 'tools/build_defs/apple/swift.bzl')
-rw-r--r--tools/build_defs/apple/swift.bzl29
1 files changed, 8 insertions, 21 deletions
diff --git a/tools/build_defs/apple/swift.bzl b/tools/build_defs/apple/swift.bzl
index d68c0d017c..8b50377bfc 100644
--- a/tools/build_defs/apple/swift.bzl
+++ b/tools/build_defs/apple/swift.bzl
@@ -35,14 +35,9 @@ def _intersperse(separator, iterable):
def _swift_target(cpu, platform, sdk_version):
"""Returns a target triplet for Swift compiler."""
- # TODO(dmishe): Use PlatformType object when available.
- platform_string = None
- if str(platform).startswith("IOS_"):
- platform_string = "ios"
- elif str(platform).startswith("WATCHOS_"):
- platform_string = "watchos"
- else:
- fail("Platform %s is not supported")
+ platform_string = str(platform.platform_type)
+ if platform_string not in ["ios", "watchos"]:
+ fail("Platform '%s' is not supported" % platform_string)
return "%s-apple-%s%s" % (cpu, platform_string, sdk_version)
@@ -74,18 +69,10 @@ def _module_name(ctx):
def _swift_library_impl(ctx):
"""Implementation for swift_library Skylark rule."""
# TODO(b/29772303): Assert xcode version.
- apple_fm = ctx.fragments.apple
-
- # TODO(dmishe): Use single_arch_cpu and single_arch_platform when available.
- if (hasattr(apple_fm, "single_arch_cpu")
- and hasattr(apple_fm, "single_arch_platform")):
- cpu = apple_fm.single_arch_cpu
- platform = apple_fm.single_arch_platform
- else:
- # TODO(dmishe): Remove this branch when single_arch_platform is available
- # by default.
- cpu = apple_fm.ios_cpu()
- platform = apple_fm.ios_cpu_platform()
+ apple_fragment = ctx.fragments.apple
+
+ cpu = apple_fragment.single_arch_cpu
+ platform = apple_fragment.single_arch_platform
target_os = ctx.fragments.objc.ios_minimum_os
target = _swift_target(cpu, platform, target_os)
@@ -95,7 +82,7 @@ def _swift_library_impl(ctx):
# A list of paths to pass with -F flag.
framework_dirs = set([
- apple_toolchain.platform_developer_framework_dir(apple_fm)])
+ apple_toolchain.platform_developer_framework_dir(apple_fragment)])
# Collect transitive dependecies.
dep_modules = []