Skip to content

Commit

Permalink
Merge branch 'master' into ks/incompatible
Browse files Browse the repository at this point in the history
  • Loading branch information
keith authored Aug 5, 2019
2 parents 987d9b9 + aa3ebd1 commit 5d2a701
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
6 changes: 6 additions & 0 deletions apple/internal/rule_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "",
Expand Down Expand Up @@ -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
Expand All @@ -666,6 +671,7 @@ _RULE_TYPE_DESCRIPTORS = {
# Frameworks are packaged in Application.app/Frameworks
"@executable_path/../../Frameworks",
],
rule_transition = transition_support.apple_rule_transition,
),
},
}
Expand Down
2 changes: 1 addition & 1 deletion apple/internal/transition_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ _apple_rule_transition = transition(
)

transition_support = struct(
apple_rule_transition = _apple_rule_transition,
apple_rule_transition = None,
)
4 changes: 2 additions & 2 deletions apple/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
9 changes: 8 additions & 1 deletion tools/plisttool/plisttool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
12 changes: 10 additions & 2 deletions tools/provisioning_profile_tool/provisioning_profile_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 5d2a701

Please sign in to comment.