in tools/plisttool/plisttool.py [0:0]
def __init__(self, target, options):
super(EntitlementsTask, self).__init__(target, options)
self._extra_raw_subs = {}
self._extra_var_subs = {}
self._unknown_var_msg_addtions = {}
self._profile_metadata = {}
self._validation_mode = self.options.get('validation_mode', 'error')
assert self._validation_mode in ('error', 'warn', 'skip')
# Load the metadata so the content can be used for substitutions and
# validations.
profile_metadata_file = self.options.get('profile_metadata_file')
if profile_metadata_file:
self._profile_metadata = PlistIO.get_dict(profile_metadata_file, target)
ver = self._profile_metadata.get('Version')
if ver != 1:
# Just log the message incase something else goes wrong.
print(('WARNING: On target "%s", got a provisioning profile with a ' +
'"Version" other than "1" (%s).') % (self.target, ver))
if self._profile_metadata:
# Even though the provisioning profile had a TeamIdentifier, the previous
# entitlements code used ApplicationIdentifierPrefix:0, so use that to
# maintain behavior in case it was important.
team_prefix_list = self._profile_metadata.get('ApplicationIdentifierPrefix')
team_prefix = team_prefix_list[0] if team_prefix_list else None
if team_prefix:
# Note: These subs must be set up by plisttool (and not passed in)
# via the *_substitutions keys in the control because it takes an
# action running to extract them from the provisioning profile, so
# the starlark for the rule doesn't have access to the values.
#
# Set up the subs using the info extracted from the provisioning
# profile:
# - "PREFIX.*" -> "PREFIX.BUNDLE_ID"
bundle_id = self.options.get('bundle_id')
if bundle_id:
self._extra_raw_subs['%s.*' % team_prefix] = "%s.%s" % (
team_prefix, bundle_id)
# - "$(AppIdentifierPrefix)" -> "PREFIX."
self._extra_var_subs['AppIdentifierPrefix'] = '%s.' % team_prefix
else:
self._unknown_var_msg_addtions.update({
'AppIdentifierPrefix':
UNKNOWN_SUBSTITUTION_ADDITION_AppIdentifierPrefix_MSG,
})