Skip to content

Commit

Permalink
Add option to specify entitlements and allow script to autodetect them
Browse files Browse the repository at this point in the history
For non-trivial project setup with more than 1 target, there's also more than 1 entitlements file
For example, MyAppProd.entitlements and MyAppTest.Entitlements
The default implementation of  will find _first_ matchint file, which is not the one really needed
In my case I had it picking up Test entitlements while I was resigning Prod target.

Second change is related to passing argumetns to resigh.sh script
We should not use find_entitlements at all
The script has support for reading entitlements from provisioning profile and usign them
As a matter a fact, that's quite a common setup, developers would put keychain group, APN and some other things, but not
the :application-identifier or :com.apple.developer.team-identifier
Those are normally missing in Code Signign Entitlements, but present in provisioning profile
It's a common thing and is covered here: https://developer.apple.com/library/ios/technotes/tn2319/_index.html
  • Loading branch information
Maksym Grebenets authored and Maksym Grebenets committed Apr 25, 2016
1 parent f982ad9 commit 47e052e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Metrics/MethodLength:
- '**/lib/fastlane/actions/*.rb'
- '**/bin/fastlane'
- '**/lib/*/options.rb'
- '**/bin/sigh'
Max: 60

AllCops:
Expand Down
1 change: 1 addition & 0 deletions sigh/bin/sigh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class SighApplication
'The path may be prefixed with a identifier in order to determine which provisioning profile should be used on which app.',
&multiple_values_option_proc(c, "provisioning_profile", &proc { |value| value.split('=', 2) })
c.option '-d', '--display_name STRING', String, 'Display name to use'
c.option '-e', '--entitlements PATH', String, 'The path to the entitlements file to use.'

c.action do |args, options|
Sigh::Resign.new.run(options, args)
Expand Down
6 changes: 1 addition & 5 deletions sigh/lib/sigh/resign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_inputs(options, args)
ipa = args.first || find_ipa || ask('Path to ipa file: ')
signing_identity = options.signing_identity || ask_for_signing_identity
provisioning_profiles = options.provisioning_profile || find_provisioning_profile || ask('Path to provisioning file: ')
entitlements = options.entitlements || find_entitlements
entitlements = options.entitlements || nil
version = options.version_number || nil
display_name = options.display_name || nil

Expand All @@ -82,10 +82,6 @@ def find_provisioning_profile
Dir[File.join(Dir.pwd, '*.mobileprovision')].sort { |a, b| File.mtime(a) <=> File.mtime(b) }.first
end

def find_entitlements
Dir[File.join(Dir.pwd, '*.entitlements')].sort { |a, b| File.mtime(a) <=> File.mtime(b) }.first
end

def find_signing_identity(signing_identity)
until installed_identies.include?(signing_identity)
UI.error "Couldn't find signing identity '#{signing_identity}'."
Expand Down

0 comments on commit 47e052e

Please sign in to comment.