From e8b87858b4cb25f719efc534dc824ec5a8c90231 Mon Sep 17 00:00:00 2001 From: Sergio Campama Date: Wed, 31 Jul 2019 16:20:30 -0700 Subject: [PATCH 1/3] Use transition support for watchOS rules, but keep disabled while support in Bazel rolls out. RELNOTES: None PiperOrigin-RevId: 261020222 --- apple/internal/rule_support.bzl | 6 ++++++ apple/internal/transition_support.bzl | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apple/internal/rule_support.bzl b/apple/internal/rule_support.bzl index febdefa7a7..19d13c7811 100644 --- a/apple/internal/rule_support.bzl +++ b/apple/internal/rule_support.bzl @@ -25,6 +25,10 @@ load( "@build_bazel_rules_apple//apple/internal:apple_product_type.bzl", "apple_product_type", ) +load( + "@build_bazel_rules_apple//apple/internal:transition_support.bzl", + "transition_support", +) def _describe_bundle_locations( archive_relative = "", @@ -649,6 +653,7 @@ _RULE_TYPE_DESCRIPTORS = { product_type = apple_product_type.watch2_application, requires_deps = False, requires_pkginfo = True, + rule_transition = transition_support.apple_rule_transition, stub_binary_path = "Library/Application Support/WatchKit/WK", ), # watchos_extension @@ -666,6 +671,7 @@ _RULE_TYPE_DESCRIPTORS = { # Frameworks are packaged in Application.app/Frameworks "@executable_path/../../Frameworks", ], + rule_transition = transition_support.apple_rule_transition, ), }, } diff --git a/apple/internal/transition_support.bzl b/apple/internal/transition_support.bzl index 2484396750..6944622fc7 100644 --- a/apple/internal/transition_support.bzl +++ b/apple/internal/transition_support.bzl @@ -99,5 +99,5 @@ _apple_rule_transition = transition( ) transition_support = struct( - apple_rule_transition = _apple_rule_transition, + apple_rule_transition = None, ) From 75805e081d27839010b1ba535d4ebba61400a849 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 5 Aug 2019 09:12:18 -0700 Subject: [PATCH 2/3] Use plistlib.dump over plistlib.writePlist. For PY2, plistlib.writePlist is still needed, but use plistlib.dump if it is available instead to avoid deprecation output at runtime. RELNOTES: None PiperOrigin-RevId: 261699009 --- tools/plisttool/plisttool.py | 9 ++++++++- .../provisioning_profile_tool.py | 12 ++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/plisttool/plisttool.py b/tools/plisttool/plisttool.py index e5787ec778..dcd10499bb 100644 --- a/tools/plisttool/plisttool.py +++ b/tools/plisttool/plisttool.py @@ -754,7 +754,14 @@ def write(self, plist, path_or_file, binary=False): binary: If True and path_or_file was a file name, reformat the file in binary form. """ - plistlib.writePlist(plist, path_or_file) + if hasattr(plistlib, 'dump'): + if isinstance(path_or_file, _string_types): + with open(path_or_file, 'wb') as fp: + plistlib.dump(plist, fp) + else: + plistlib.dump(plist, path_or_file) + else: + plistlib.writePlist(plist, path_or_file) if binary and isinstance(path_or_file, _string_types): subprocess.check_call(['plutil', '-convert', 'binary1', path_or_file]) diff --git a/tools/provisioning_profile_tool/provisioning_profile_tool.py b/tools/provisioning_profile_tool/provisioning_profile_tool.py index 8998abfec8..0a45c83d16 100644 --- a/tools/provisioning_profile_tool/provisioning_profile_tool.py +++ b/tools/provisioning_profile_tool/provisioning_profile_tool.py @@ -139,7 +139,11 @@ def _write_default_entitlements(self, output_path, provisioning_profile): provisioning_profile: The provisioning profile. """ entitlements = provisioning_profile['Entitlements'] - plistlib.writePlist(entitlements, output_path) + if hasattr(plistlib, 'dump'): + with open(output_path, 'wb') as fp: + plistlib.dump(entitlements, fp) + else: + plistlib.writePlist(entitlements, output_path) @classmethod def _write_metadata(self, output_path, provisioning_profile): @@ -161,7 +165,11 @@ def _write_metadata(self, output_path, provisioning_profile): 'TimeToLive', 'UUID', 'Version', ) output_data = {k: provisioning_profile[k] for k in keys} - plistlib.writePlist(output_data, output_path) + if hasattr(plistlib, 'dump'): + with open(output_path, 'wb') as fp: + plistlib.dump(output_data, fp) + else: + plistlib.writePlist(output_data, output_path) @classmethod def _extract_raw_plist(self, target, profile_path): From aa3ebd15725461562138085386ed84eca594d8d7 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 5 Aug 2019 10:02:16 -0700 Subject: [PATCH 3/3] Bump apple_support to 0.7.0. RELNOTES: None PiperOrigin-RevId: 261708760 --- apple/repositories.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apple/repositories.bzl b/apple/repositories.bzl index 2bc7ed10fd..57ceaf7de9 100644 --- a/apple/repositories.bzl +++ b/apple/repositories.bzl @@ -108,9 +108,9 @@ def apple_rules_dependencies(ignore_version_differences = False): http_archive, name = "build_bazel_apple_support", urls = [ - "https://github.com/bazelbuild/apple_support/releases/download/0.6.0/apple_support.0.6.0.tar.gz", + "https://github.com/bazelbuild/apple_support/releases/download/0.7.0/apple_support.0.7.0.tar.gz", ], - sha256 = "7356dbd44dea71570a929d1d4731e870622151a5f27164d966dda97305f33471", + sha256 = "a078cbb882fabc22be103019851d1395977bcad8a044da8153817b3eea9d2eec", ignore_version_differences = ignore_version_differences, )