Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: pylib/gyp/mac_tool.py

Issue 1907523002: [ios-ninja] Support xctests for devices in release. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Simpler mac_tool changes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | pylib/gyp/xcode_emulation.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 Google Inc. All rights reserved. 2 # Copyright (c) 2012 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utility functions to perform Xcode-style build steps. 6 """Utility functions to perform Xcode-style build steps.
7 7
8 These functions are executed via gyp-mac-tool when using the Makefile generator. 8 These functions are executed via gyp-mac-tool when using the Makefile generator.
9 """ 9 """
10 10
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 subprocess.check_call(command_line) 398 subprocess.check_call(command_line)
399 399
400 def ExecMergeInfoPlist(self, output, *inputs): 400 def ExecMergeInfoPlist(self, output, *inputs):
401 """Merge multiple .plist files into a single .plist file.""" 401 """Merge multiple .plist files into a single .plist file."""
402 merged_plist = {} 402 merged_plist = {}
403 for path in inputs: 403 for path in inputs:
404 plist = self._LoadPlistMaybeBinary(path) 404 plist = self._LoadPlistMaybeBinary(path)
405 self._MergePlist(merged_plist, plist) 405 self._MergePlist(merged_plist, plist)
406 plistlib.writePlist(merged_plist, output) 406 plistlib.writePlist(merged_plist, output)
407 407
408 def ExecCodeSignBundle(self, key, entitlements, provisioning): 408 def ExecCodeSignBundle(self, key, entitlements, provisioning, path, preserve):
409 """Code sign a bundle. 409 """Code sign a bundle.
410 410
411 This function tries to code sign an iOS bundle, following the same 411 This function tries to code sign an iOS bundle, following the same
412 algorithm as Xcode: 412 algorithm as Xcode:
413 1. pick the provisioning profile that best match the bundle identifier, 413 1. pick the provisioning profile that best match the bundle identifier,
414 and copy it into the bundle as embedded.mobileprovision, 414 and copy it into the bundle as embedded.mobileprovision,
415 2. copy Entitlements.plist from user or SDK next to the bundle, 415 2. copy Entitlements.plist from user or SDK next to the bundle,
416 3. code sign the bundle. 416 3. code sign the bundle.
417 """ 417 """
418 substitutions, overrides = self._InstallProvisioningProfile( 418 substitutions, overrides = self._InstallProvisioningProfile(
419 provisioning, self._GetCFBundleIdentifier()) 419 provisioning, self._GetCFBundleIdentifier())
420 entitlements_path = self._InstallEntitlements( 420 entitlements_path = self._InstallEntitlements(
421 entitlements, substitutions, overrides) 421 entitlements, substitutions, overrides)
422 subprocess.check_call([ 422
423 'codesign', '--force', '--sign', key, '--entitlements', 423 args = ['codesign', '--force', '--sign', key]
424 entitlements_path, '--timestamp=none', os.path.join( 424 if preserve == 'True':
425 os.environ['TARGET_BUILD_DIR'], 425 args.extend(['--deep', '--preserve-metadata=identifier,entitlements'])
426 os.environ['FULL_PRODUCT_NAME'])]) 426 else:
427 args.extend(['--entitlements', entitlements_path])
428 args.extend(['--timestamp=none', path])
429 subprocess.check_call(args)
427 430
428 def _InstallProvisioningProfile(self, profile, bundle_identifier): 431 def _InstallProvisioningProfile(self, profile, bundle_identifier):
429 """Installs embedded.mobileprovision into the bundle. 432 """Installs embedded.mobileprovision into the bundle.
430 433
431 Args: 434 Args:
432 profile: string, optional, short name of the .mobileprovision file 435 profile: string, optional, short name of the .mobileprovision file
433 to use, if empty or the file is missing, the best file installed 436 to use, if empty or the file is missing, the best file installed
434 will be used 437 will be used
435 bundle_identifier: string, value of CFBundleIdentifier from Info.plist 438 bundle_identifier: string, value of CFBundleIdentifier from Info.plist
436 439
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 out.write(struct.pack('<s', '\0')) 702 out.write(struct.pack('<s', '\0'))
700 base = os.path.dirname(path) + os.sep 703 base = os.path.dirname(path) + os.sep
701 out.write(struct.pack('<%ds' % len(base), base)) 704 out.write(struct.pack('<%ds' % len(base), base))
702 out.write(struct.pack('<s', '\0')) 705 out.write(struct.pack('<s', '\0'))
703 path = os.path.basename(path) 706 path = os.path.basename(path)
704 out.write(struct.pack('<%ds' % len(path), path)) 707 out.write(struct.pack('<%ds' % len(path), path))
705 out.write(struct.pack('<s', '\0')) 708 out.write(struct.pack('<s', '\0'))
706 709
707 if __name__ == '__main__': 710 if __name__ == '__main__':
708 sys.exit(main(sys.argv[1:])) 711 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | pylib/gyp/xcode_emulation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698