fastlane 2.140.0 → 2.141.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +81 -68
  3. data/cert/lib/cert/options.rb +12 -5
  4. data/cert/lib/cert/runner.rb +13 -0
  5. data/deliver/lib/deliver/options.rb +2 -2
  6. data/deliver/lib/deliver/runner.rb +13 -2
  7. data/fastlane/lib/fastlane/actions/build_app.rb +157 -6
  8. data/fastlane/lib/fastlane/actions/build_ios_app.rb +28 -132
  9. data/fastlane/lib/fastlane/actions/build_mac_app.rb +46 -0
  10. data/fastlane/lib/fastlane/actions/create_pull_request.rb +29 -0
  11. data/fastlane/lib/fastlane/actions/docs/{build_ios_app.md → build_app.md} +1 -1
  12. data/fastlane/lib/fastlane/actions/gym.rb +3 -7
  13. data/fastlane/lib/fastlane/actions/import_from_git.rb +4 -0
  14. data/fastlane/lib/fastlane/actions/set_github_release.rb +1 -1
  15. data/fastlane/lib/fastlane/actions/update_plist.rb +37 -2
  16. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +1 -0
  17. data/fastlane/lib/fastlane/fast_file.rb +13 -3
  18. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -0
  19. data/fastlane/lib/fastlane/version.rb +1 -1
  20. data/fastlane/swift/Deliverfile.swift +1 -1
  21. data/fastlane/swift/DeliverfileProtocol.swift +3 -3
  22. data/fastlane/swift/Fastlane.swift +239 -35
  23. data/fastlane/swift/Gymfile.swift +1 -1
  24. data/fastlane/swift/GymfileProtocol.swift +17 -1
  25. data/fastlane/swift/Matchfile.swift +1 -1
  26. data/fastlane/swift/MatchfileProtocol.swift +7 -3
  27. data/fastlane/swift/Precheckfile.swift +1 -1
  28. data/fastlane/swift/Scanfile.swift +1 -1
  29. data/fastlane/swift/ScanfileProtocol.swift +5 -1
  30. data/fastlane/swift/Screengrabfile.swift +1 -1
  31. data/fastlane/swift/Snapshotfile.swift +1 -1
  32. data/fastlane/swift/SnapshotfileProtocol.swift +9 -1
  33. data/fastlane_core/lib/fastlane_core/cert_checker.rb +28 -0
  34. data/fastlane_core/lib/fastlane_core/project.rb +23 -0
  35. data/gym/lib/gym/code_signing_mapping.rb +32 -3
  36. data/gym/lib/gym/detect_values.rb +34 -2
  37. data/gym/lib/gym/generators/package_command_generator.rb +4 -0
  38. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +47 -17
  39. data/gym/lib/gym/module.rb +8 -0
  40. data/gym/lib/gym/options.rb +25 -1
  41. data/gym/lib/gym/runner.rb +25 -4
  42. data/match/lib/match/encryption/openssl.rb +1 -1
  43. data/match/lib/match/generator.rb +17 -3
  44. data/match/lib/match/module.rb +4 -1
  45. data/match/lib/match/nuke.rb +54 -16
  46. data/match/lib/match/options.rb +20 -15
  47. data/match/lib/match/runner.rb +20 -8
  48. data/match/lib/match/spaceship_ensure.rb +19 -9
  49. data/match/lib/match/storage/git_storage.rb +5 -2
  50. data/scan/lib/scan/options.rb +6 -1
  51. data/snapshot/lib/snapshot/options.rb +12 -1
  52. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  53. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +11 -0
  54. data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +4 -0
  55. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +6 -0
  56. data/spaceship/lib/spaceship/portal/app.rb +11 -2
  57. data/spaceship/lib/spaceship/tunes/iap_status.rb +5 -1
  58. metadata +20 -25
  59. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  60. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  61. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  62. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  63. data/fastlane_core/lib/fastlane_core/.build_watcher.rb.swp +0 -0
  64. data/pilot/lib/pilot/.manager.rb.swp +0 -0
  65. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
  66. data/spaceship/lib/spaceship/portal/.certificate.rb.swp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8475d80e9f0452ef7ac3c90a50b82dc52b110235819d0d422783984a5a2e3241
4
- data.tar.gz: ccfd6ed3734d272250f69816ca5fa408af1102e83336f5e50d8a818ee81e569f
3
+ metadata.gz: d66ea0e82a638091cb2b4fba453027bd4deae45204e4b0060e371bcdfdd42377
4
+ data.tar.gz: 579a0b416a314bfbac2b5bce550d2788f9dae40a7fc9686cf47d5b20b8be3dda
5
5
  SHA512:
6
- metadata.gz: 723bba1783d4fcc2f466010f29d2becae0384549ba9593113cf543bc4642e485c25fa7be07a825d75102d14d0e058819ddb2af52ed026bc425f693310ca9d7e3
7
- data.tar.gz: 6ffd0b1013c0b31e2ce53789bc855f2a09809bdb8bbb1294f05be06bd356ce390e7b51a77fc61c1cd123b921a3af0ea65d8d36df471a0a72306e454eeb2e041b
6
+ metadata.gz: e59b4a106d204a597833eb62f3cacddb865f8c55702ec510331415c0efcb5de5d7d5442ca2e55c731bdc3a57be57331113dd626864792ca2c7722ffcca6b5649
7
+ data.tar.gz: 17f635afbd24dd656d231eb32f3fdd9240093715c0abdaaea3c39cbedec9475b6a8659baec933539b1a29585fccae9c4482f7e57af18bc648526728b3f61dcf5
data/README.md CHANGED
@@ -34,55 +34,49 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
34
34
  <!-- This table is regenerated and resorted on each release -->
35
35
  <table id='team'>
36
36
  <tr>
37
- <td id='olivier-halligon'>
38
- <a href='https://github.com/AliSoftware'>
39
- <img src='https://github.com/AliSoftware.png?size=140'>
37
+ <td id='jimmy-dee'>
38
+ <a href='https://github.com/jdee'>
39
+ <img src='https://github.com/jdee.png?size=140'>
40
40
  </a>
41
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
41
+ <h4 align='center'>Jimmy Dee</h4>
42
42
  </td>
43
- <td id='stefan-natchev'>
44
- <a href='https://github.com/snatchev'>
45
- <img src='https://github.com/snatchev.png?size=140'>
43
+ <td id='felix-krause'>
44
+ <a href='https://github.com/KrauseFx'>
45
+ <img src='https://github.com/KrauseFx.png?size=140'>
46
46
  </a>
47
- <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
47
+ <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
48
48
  </td>
49
- <td id='jorge-revuelta-h'>
50
- <a href='https://github.com/minuscorp'>
51
- <img src='https://github.com/minuscorp.png?size=140'>
49
+ <td id='andrew-mcburney'>
50
+ <a href='https://github.com/armcburney'>
51
+ <img src='https://github.com/armcburney.png?size=140'>
52
52
  </a>
53
- <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
53
+ <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
54
54
  </td>
55
- <td id='maksym-grebenets'>
56
- <a href='https://github.com/mgrebenets'>
57
- <img src='https://github.com/mgrebenets.png?size=140'>
55
+ <td id='jan-piotrowski'>
56
+ <a href='https://github.com/janpio'>
57
+ <img src='https://github.com/janpio.png?size=140'>
58
58
  </a>
59
- <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
59
+ <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
60
60
  </td>
61
- <td id='jérôme-lacoste'>
62
- <a href='https://github.com/lacostej'>
63
- <img src='https://github.com/lacostej.png?size=140'>
61
+ <td id='olivier-halligon'>
62
+ <a href='https://github.com/AliSoftware'>
63
+ <img src='https://github.com/AliSoftware.png?size=140'>
64
64
  </a>
65
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
65
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
66
66
  </td>
67
67
  </tr>
68
68
  <tr>
69
- <td id='josh-holtz'>
70
- <a href='https://github.com/joshdholtz'>
71
- <img src='https://github.com/joshdholtz.png?size=140'>
72
- </a>
73
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
74
- </td>
75
- <td id='felix-krause'>
76
- <a href='https://github.com/KrauseFx'>
77
- <img src='https://github.com/KrauseFx.png?size=140'>
69
+ <td id='matthew-ellis'>
70
+ <a href='https://github.com/matthewellis'>
71
+ <img src='https://github.com/matthewellis.png?size=140'>
78
72
  </a>
79
- <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
73
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
80
74
  </td>
81
- <td id='jan-piotrowski'>
82
- <a href='https://github.com/janpio'>
83
- <img src='https://github.com/janpio.png?size=140'>
75
+ <td id='stefan-natchev'>
76
+ <a href='https://github.com/snatchev'>
77
+ <img src='https://github.com/snatchev.png?size=140'>
84
78
  </a>
85
- <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
79
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
86
80
  </td>
87
81
  <td id='helmut-januschka'>
88
82
  <a href='https://github.com/hjanuschka'>
@@ -90,77 +84,96 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
90
84
  </a>
91
85
  <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
92
86
  </td>
93
- <td id='matthew-ellis'>
94
- <a href='https://github.com/matthewellis'>
95
- <img src='https://github.com/matthewellis.png?size=140'>
87
+ <td id='josh-holtz'>
88
+ <a href='https://github.com/joshdholtz'>
89
+ <img src='https://github.com/joshdholtz.png?size=140'>
96
90
  </a>
97
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
91
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
98
92
  </td>
99
- </tr>
100
- <tr>
101
- <td id='andrew-mcburney'>
102
- <a href='https://github.com/armcburney'>
103
- <img src='https://github.com/armcburney.png?size=140'>
93
+ <td id='jérôme-lacoste'>
94
+ <a href='https://github.com/lacostej'>
95
+ <img src='https://github.com/lacostej.png?size=140'>
104
96
  </a>
105
- <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
97
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
106
98
  </td>
99
+ </tr>
100
+ <tr>
107
101
  <td id='kohki-miki'>
108
102
  <a href='https://github.com/giginet'>
109
103
  <img src='https://github.com/giginet.png?size=140'>
110
104
  </a>
111
105
  <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
112
106
  </td>
113
- <td id='jimmy-dee'>
114
- <a href='https://github.com/jdee'>
115
- <img src='https://github.com/jdee.png?size=140'>
116
- </a>
117
- <h4 align='center'>Jimmy Dee</h4>
118
- </td>
119
107
  <td id='aaron-brager'>
120
108
  <a href='https://github.com/getaaron'>
121
109
  <img src='https://github.com/getaaron.png?size=140'>
122
110
  </a>
123
111
  <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
124
112
  </td>
125
- <td id='fumiya-nakamura'>
126
- <a href='https://github.com/nafu'>
127
- <img src='https://github.com/nafu.png?size=140'>
113
+ <td id='luka-mirosevic'>
114
+ <a href='https://github.com/lmirosevic'>
115
+ <img src='https://github.com/lmirosevic.png?size=140'>
128
116
  </a>
129
- <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
117
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
130
118
  </td>
131
- </tr>
132
- <tr>
133
119
  <td id='joshua-liebowitz'>
134
120
  <a href='https://github.com/taquitos'>
135
121
  <img src='https://github.com/taquitos.png?size=140'>
136
122
  </a>
137
123
  <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
138
124
  </td>
139
- <td id='iulian-onofrei'>
140
- <a href='https://github.com/revolter'>
141
- <img src='https://github.com/revolter.png?size=140'>
125
+ <td id='manu-wallner'>
126
+ <a href='https://github.com/milch'>
127
+ <img src='https://github.com/milch.png?size=140'>
142
128
  </a>
143
- <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
129
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
144
130
  </td>
131
+ </tr>
132
+ <tr>
145
133
  <td id='danielle-tomlinson'>
146
134
  <a href='https://github.com/endocrimes'>
147
135
  <img src='https://github.com/endocrimes.png?size=140'>
148
136
  </a>
149
137
  <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
150
138
  </td>
151
- <td id='manu-wallner'>
152
- <a href='https://github.com/milch'>
153
- <img src='https://github.com/milch.png?size=140'>
139
+ <td id='jorge-revuelta-h'>
140
+ <a href='https://github.com/minuscorp'>
141
+ <img src='https://github.com/minuscorp.png?size=140'>
154
142
  </a>
155
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
143
+ <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
156
144
  </td>
157
- <td id='luka-mirosevic'>
158
- <a href='https://github.com/lmirosevic'>
159
- <img src='https://github.com/lmirosevic.png?size=140'>
145
+ <td id='iulian-onofrei'>
146
+ <a href='https://github.com/revolter'>
147
+ <img src='https://github.com/revolter.png?size=140'>
160
148
  </a>
161
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
149
+ <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
150
+ </td>
151
+ <td id='daniel-jankowski'>
152
+ <a href='https://github.com/mollyIV'>
153
+ <img src='https://github.com/mollyIV.png?size=140'>
154
+ </a>
155
+ <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
156
+ </td>
157
+ <td id='max-ott'>
158
+ <a href='https://github.com/max-ott'>
159
+ <img src='https://github.com/max-ott.png?size=140'>
160
+ </a>
161
+ <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
162
162
  </td>
163
163
  </tr>
164
+ <tr>
165
+ <td id='maksym-grebenets'>
166
+ <a href='https://github.com/mgrebenets'>
167
+ <img src='https://github.com/mgrebenets.png?size=140'>
168
+ </a>
169
+ <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
170
+ </td>
171
+ <td id='fumiya-nakamura'>
172
+ <a href='https://github.com/nafu'>
173
+ <img src='https://github.com/nafu.png?size=140'>
174
+ </a>
175
+ <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
176
+ </td>
164
177
  </table>
165
178
 
166
179
  Special thanks to all [contributors](https://github.com/fastlane/fastlane/graphs/contributors) for extending and improving _fastlane_.
@@ -13,12 +13,21 @@ module Cert
13
13
  FastlaneCore::ConfigItem.new(key: :development,
14
14
  env_name: "CERT_DEVELOPMENT",
15
15
  description: "Create a development certificate instead of a distribution one",
16
- is_string: false,
16
+ type: Boolean,
17
17
  default_value: false),
18
+ FastlaneCore::ConfigItem.new(key: :type,
19
+ env_name: "CERT_TYPE",
20
+ description: "Create specific certificate type (takes precedence over :development)",
21
+ optional: true,
22
+ verify_block: proc do |value|
23
+ value = value.to_s
24
+ types = %w(mac_installer_distribution developer_id_installer developer_id_application)
25
+ UI.user_error!("Unsupported types, must be: #{types}") unless types.include?(value)
26
+ end),
18
27
  FastlaneCore::ConfigItem.new(key: :force,
19
28
  env_name: "CERT_FORCE",
20
29
  description: "Create a certificate even if an existing certificate exists",
21
- is_string: false,
30
+ type: Boolean,
22
31
  default_value: false),
23
32
  FastlaneCore::ConfigItem.new(key: :generate_apple_certs,
24
33
  env_name: "CERT_GENERATE_APPLE_CERTS",
@@ -58,8 +67,7 @@ module Cert
58
67
  short_option: "-q",
59
68
  env_name: "CERT_FILE_NAME",
60
69
  optional: true,
61
- description: "The filename of certificate to store",
62
- is_string: true),
70
+ description: "The filename of certificate to store"),
63
71
  FastlaneCore::ConfigItem.new(key: :output_path,
64
72
  short_option: "-o",
65
73
  env_name: "CERT_OUTPUT_PATH",
@@ -85,7 +93,6 @@ module Cert
85
93
  FastlaneCore::ConfigItem.new(key: :platform,
86
94
  env_name: "CERT_PLATFORM",
87
95
  description: "Set the provisioning profile's platform (ios, macos)",
88
- is_string: false,
89
96
  default_value: "ios",
90
97
  verify_block: proc do |value|
91
98
  value = value.to_s
@@ -134,6 +134,19 @@ module Cert
134
134
 
135
135
  # The kind of certificate we're interested in
136
136
  def certificate_type
137
+ if Cert.config[:type]
138
+ case Cert.config[:type].to_sym
139
+ when :mac_installer_distribution
140
+ return Spaceship.certificate.mac_installer_distribution
141
+ when :developer_id_application
142
+ return Spaceship.certificate.developer_id_application
143
+ when :developer_id_installer
144
+ return Spaceship.certificate.developer_id_installer
145
+ else
146
+ UI.user_error("Unaccepted value for :type - #{Cert.config[:type]}")
147
+ end
148
+ end
149
+
137
150
  # Check if apple certs (Xcode 11 and later) should be used
138
151
  if Cert.config[:generate_apple_certs]
139
152
  cert_type = Spaceship.certificate.apple_distribution
@@ -149,12 +149,12 @@ module Deliver
149
149
 
150
150
  # release
151
151
  FastlaneCore::ConfigItem.new(key: :automatic_release,
152
- description: "Should the app be automatically released once it's approved?",
152
+ description: "Should the app be automatically released once it's approved? (Can not be used together with `auto_release_date`)",
153
153
  is_string: false,
154
154
  default_value: false),
155
155
  FastlaneCore::ConfigItem.new(key: :auto_release_date,
156
156
  env_name: "DELIVER_AUTO_RELEASE_DATE",
157
- description: "Date in milliseconds for automatically releasing on pending approval",
157
+ description: "Date in milliseconds for automatically releasing on pending approval (Can not be used together with `automatic_release`)",
158
158
  is_string: false,
159
159
  optional: true,
160
160
  conflicting_options: [:automatic_release],
@@ -140,14 +140,25 @@ module Deliver
140
140
  # Upload the binary to App Store Connect
141
141
  def upload_binary
142
142
  UI.message("Uploading binary to App Store Connect")
143
- if options[:ipa]
143
+
144
+ upload_ipa = options[:ipa]
145
+ upload_pkg = options[:pkg]
146
+
147
+ # 2020-01-27
148
+ # Only verify platform if if both ipa and pkg exists (for backwards support)
149
+ if upload_ipa && upload_pkg
150
+ upload_ipa = ["ios", "appletvos"].include?(options[:platform])
151
+ upload_pkg = options[:platform] == "osx"
152
+ end
153
+
154
+ if upload_ipa
144
155
  package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
145
156
  app_id: options[:app].apple_id,
146
157
  ipa_path: options[:ipa],
147
158
  package_path: "/tmp",
148
159
  platform: options[:platform]
149
160
  )
150
- elsif options[:pkg]
161
+ elsif upload_pkg
151
162
  package_path = FastlaneCore::PkgUploadPackageBuilder.new.generate(
152
163
  app_id: options[:app].apple_id,
153
164
  pkg_path: options[:pkg],
@@ -1,13 +1,164 @@
1
1
  module Fastlane
2
2
  module Actions
3
- require 'fastlane/actions/build_ios_app'
4
- class BuildAppAction < BuildIosAppAction
5
- #####################################################
6
- # @!group Documentation
7
- #####################################################
3
+ module SharedValues
4
+ IPA_OUTPUT_PATH ||= :IPA_OUTPUT_PATH
5
+ PKG_OUTPUT_PATH ||= :PKG_OUTPUT_PATH
6
+ DSYM_OUTPUT_PATH ||= :DSYM_OUTPUT_PATH
7
+ XCODEBUILD_ARCHIVE ||= :XCODEBUILD_ARCHIVE # originally defined in XcodebuildAction
8
+ end
9
+
10
+ class BuildAppAction < Action
11
+ def self.run(values)
12
+ require 'gym'
13
+
14
+ unless Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE].to_s == "development"
15
+ values[:export_method] ||= Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE]
16
+ end
17
+
18
+ if Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
19
+ # Since Xcode 9 you need to explicitly provide the provisioning profile per app target
20
+ # If the user is smart and uses match and gym together with fastlane, we can do all
21
+ # the heavy lifting for them
22
+ values[:export_options] ||= {}
23
+ # It's not always a hash, because the user might have passed a string path to a ready plist file
24
+ # If that's the case, we won't set the provisioning profiles
25
+ # see https://github.com/fastlane/fastlane/issues/9490
26
+ if values[:export_options].kind_of?(Hash)
27
+ match_mapping = (Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING] || {}).dup
28
+ existing_mapping = (values[:export_options][:provisioningProfiles] || {}).dup
29
+
30
+ # Be smart about how we merge those mappings in case there are conflicts
31
+ mapping_object = Gym::CodeSigningMapping.new
32
+ hash_to_use = mapping_object.merge_profile_mapping(primary_mapping: existing_mapping,
33
+ secondary_mapping: match_mapping,
34
+ export_method: values[:export_method])
35
+
36
+ values[:export_options][:provisioningProfiles] = hash_to_use
37
+ else
38
+ self.show_xcode_9_warning
39
+ end
40
+ elsif Actions.lane_context[SharedValues::SIGH_PROFILE_PATHS]
41
+ # Since Xcode 9 you need to explicitly provide the provisioning profile per app target
42
+ # If the user used sigh we can match the profiles from sigh
43
+ values[:export_options] ||= {}
44
+ if values[:export_options].kind_of?(Hash)
45
+ # It's not always a hash, because the user might have passed a string path to a ready plist file
46
+ # If that's the case, we won't set the provisioning profiles
47
+ # see https://github.com/fastlane/fastlane/issues/9684
48
+ values[:export_options][:provisioningProfiles] ||= {}
49
+ Actions.lane_context[SharedValues::SIGH_PROFILE_PATHS].each do |profile_path|
50
+ begin
51
+ profile = FastlaneCore::ProvisioningProfile.parse(profile_path)
52
+ app_id_prefix = profile["ApplicationIdentifierPrefix"].first
53
+ bundle_id = profile["Entitlements"]["application-identifier"].gsub("#{app_id_prefix}.", "")
54
+ values[:export_options][:provisioningProfiles][bundle_id] = profile["Name"]
55
+ rescue => ex
56
+ UI.error("Couldn't load profile at path: #{profile_path}")
57
+ UI.error(ex)
58
+ UI.verbose(ex.backtrace.join("\n"))
59
+ end
60
+ end
61
+ else
62
+ self.show_xcode_9_warning
63
+ end
64
+ end
65
+
66
+ gym_output_path = Gym::Manager.new.work(values)
67
+ if gym_output_path.nil?
68
+ UI.important("No output path received from gym")
69
+ return nil
70
+ end
71
+
72
+ absolute_output_path = File.expand_path(gym_output_path)
73
+
74
+ # Binary path
75
+ if File.extname(absolute_output_path) == ".ipa"
76
+ absolute_dsym_path = absolute_output_path.gsub(/.ipa$/, ".app.dSYM.zip")
77
+
78
+ Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_output_path
79
+ ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_output_path # for deliver
80
+ elsif File.extname(absolute_output_path) == ".pkg"
81
+ absolute_dsym_path = absolute_output_path.gsub(/.pkg$/, ".dSYM.zip")
82
+
83
+ Actions.lane_context[SharedValues::PKG_OUTPUT_PATH] = absolute_output_path
84
+ ENV[SharedValues::PKG_OUTPUT_PATH.to_s] = absolute_output_path # for deliver
85
+ end
86
+
87
+ # xcarchive path
88
+ Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] = Gym::BuildCommandGenerator.archive_path
89
+
90
+ # dSYM path
91
+ if absolute_dsym_path && File.exist?(absolute_dsym_path)
92
+ Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path
93
+ ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path
94
+ end
95
+
96
+ return absolute_output_path
97
+ end
98
+ # rubocop:enable Metrics/PerceivedComplexity
8
99
 
9
100
  def self.description
10
- "Alias for the `build_ios_app` action"
101
+ "Easily build and sign your app (via _gym_)"
102
+ end
103
+
104
+ def self.details
105
+ "More information: https://fastlane.tools/gym"
106
+ end
107
+
108
+ def self.output
109
+ [
110
+ ['IPA_OUTPUT_PATH', 'The path to the newly generated ipa file'],
111
+ ['PKG_OUTPUT_PATH', 'The path to the newly generated pkg file'],
112
+ ['DSYM_OUTPUT_PATH', 'The path to the dSYM files'],
113
+ ['XCODEBUILD_ARCHIVE', 'The path to the xcodebuild archive']
114
+ ]
115
+ end
116
+
117
+ def self.return_value
118
+ "The absolute path to the generated ipa file"
119
+ end
120
+
121
+ def self.author
122
+ "KrauseFx"
123
+ end
124
+
125
+ def self.available_options
126
+ require 'gym'
127
+ Gym::Options.available_options
128
+ end
129
+
130
+ def self.is_supported?(platform)
131
+ [:ios, :mac].include?(platform)
132
+ end
133
+
134
+ def self.example_code
135
+ [
136
+ 'build_app(scheme: "MyApp", workspace: "MyApp.xcworkspace")',
137
+ 'build_app(
138
+ workspace: "MyApp.xcworkspace",
139
+ configuration: "Debug",
140
+ scheme: "MyApp",
141
+ silent: true,
142
+ clean: true,
143
+ output_directory: "path/to/dir", # Destination directory. Defaults to current directory.
144
+ output_name: "my-app.ipa", # specify the name of the .ipa file to generate (including file extension)
145
+ sdk: "iOS 11.1" # use SDK as the name or path of the base SDK when building the project.
146
+ )',
147
+ 'gym # alias for "build_app"',
148
+ 'build_ios_app # alias for "build_app (only iOS options)"',
149
+ 'build_mac_app # alias for "build_app (only macOS options)"'
150
+ ]
151
+ end
152
+
153
+ def self.category
154
+ :building
155
+ end
156
+
157
+ def self.show_xcode_9_warning
158
+ return unless Helper.xcode_at_least?("9.0")
159
+ UI.message("You passed a path to a custom plist file for exporting the binary.")
160
+ UI.message("Make sure to include information about what provisioning profiles to use with Xcode 9")
161
+ UI.message("More information: https://docs.fastlane.tools/codesigning/xcode-project/#xcode-9-and-up")
11
162
  end
12
163
  end
13
164
  end