fastlane 2.139.0 → 2.144.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +85 -72
  4. data/cert/lib/cert/options.rb +12 -5
  5. data/cert/lib/cert/runner.rb +13 -0
  6. data/deliver/lib/deliver/options.rb +28 -2
  7. data/deliver/lib/deliver/runner.rb +13 -2
  8. data/fastlane/lib/fastlane/action.rb +1 -1
  9. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  10. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  11. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/README.md +2 -0
  13. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +13 -5
  14. data/fastlane/lib/fastlane/actions/automatic_code_signing.rb +7 -1
  15. data/fastlane/lib/fastlane/actions/build_app.rb +157 -6
  16. data/fastlane/lib/fastlane/actions/build_ios_app.rb +28 -132
  17. data/fastlane/lib/fastlane/actions/build_mac_app.rb +46 -0
  18. data/fastlane/lib/fastlane/actions/clean_build_artifacts.rb +3 -0
  19. data/fastlane/lib/fastlane/actions/cocoapods.rb +2 -2
  20. data/fastlane/lib/fastlane/actions/crashlytics.rb +14 -2
  21. data/fastlane/lib/fastlane/actions/create_pull_request.rb +29 -0
  22. data/fastlane/lib/fastlane/actions/docs/{build_ios_app.md → build_app.md} +1 -1
  23. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +22 -6
  24. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +22 -6
  25. data/fastlane/lib/fastlane/actions/ensure_git_branch.rb +1 -1
  26. data/fastlane/lib/fastlane/actions/ensure_xcode_version.rb +35 -7
  27. data/fastlane/lib/fastlane/actions/frame_screenshots.rb +2 -1
  28. data/fastlane/lib/fastlane/actions/get_github_release.rb +3 -0
  29. data/fastlane/lib/fastlane/actions/gradle.rb +43 -2
  30. data/fastlane/lib/fastlane/actions/gym.rb +3 -7
  31. data/fastlane/lib/fastlane/actions/import_from_git.rb +4 -0
  32. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +9 -3
  33. data/fastlane/lib/fastlane/actions/notarize.rb +183 -0
  34. data/fastlane/lib/fastlane/actions/pod_lib_lint.rb +7 -1
  35. data/fastlane/lib/fastlane/actions/run_tests.rb +5 -22
  36. data/fastlane/lib/fastlane/actions/s3.rb +5 -291
  37. data/fastlane/lib/fastlane/actions/set_github_release.rb +1 -1
  38. data/fastlane/lib/fastlane/actions/spm.rb +8 -0
  39. data/fastlane/lib/fastlane/actions/swiftlint.rb +45 -9
  40. data/fastlane/lib/fastlane/actions/update_code_signing_settings.rb +190 -0
  41. data/fastlane/lib/fastlane/actions/update_plist.rb +37 -2
  42. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +13 -3
  43. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +1 -0
  44. data/fastlane/lib/fastlane/fast_file.rb +13 -3
  45. data/fastlane/lib/fastlane/helper/adb_helper.rb +1 -1
  46. data/fastlane/lib/fastlane/helper/s3_client_helper.rb +56 -0
  47. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -1
  48. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -0
  49. data/fastlane/lib/fastlane/runner.rb +23 -18
  50. data/fastlane/lib/fastlane/server/socket_server_action_command_executor.rb +1 -1
  51. data/fastlane/lib/fastlane/version.rb +1 -1
  52. data/fastlane/swift/Deliverfile.swift +1 -1
  53. data/fastlane/swift/DeliverfileProtocol.swift +3 -3
  54. data/fastlane/swift/Fastlane.swift +422 -45
  55. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  56. data/fastlane/swift/Gymfile.swift +1 -1
  57. data/fastlane/swift/GymfileProtocol.swift +17 -1
  58. data/fastlane/swift/Matchfile.swift +1 -1
  59. data/fastlane/swift/MatchfileProtocol.swift +23 -3
  60. data/fastlane/swift/Precheckfile.swift +1 -1
  61. data/fastlane/swift/RubyCommand.swift +1 -1
  62. data/fastlane/swift/Scanfile.swift +1 -1
  63. data/fastlane/swift/ScanfileProtocol.swift +21 -1
  64. data/fastlane/swift/Screengrabfile.swift +1 -1
  65. data/fastlane/swift/Snapshotfile.swift +1 -1
  66. data/fastlane/swift/SnapshotfileProtocol.swift +9 -1
  67. data/fastlane_core/lib/fastlane_core/cert_checker.rb +28 -0
  68. data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
  69. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +1 -0
  70. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +2 -0
  71. data/fastlane_core/lib/fastlane_core/project.rb +27 -0
  72. data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +15 -2
  73. data/frameit/lib/frameit/commands_generator.rb +25 -0
  74. data/frameit/lib/frameit/config_parser.rb +31 -9
  75. data/frameit/lib/frameit/device.rb +90 -0
  76. data/frameit/lib/frameit/device_types.rb +121 -5
  77. data/frameit/lib/frameit/editor.rb +28 -40
  78. data/frameit/lib/frameit/offsets.rb +8 -1
  79. data/frameit/lib/frameit/options.rb +81 -54
  80. data/frameit/lib/frameit/runner.rb +17 -7
  81. data/frameit/lib/frameit/screenshot.rb +35 -47
  82. data/frameit/lib/frameit/template_finder.rb +15 -12
  83. data/gym/lib/gym/code_signing_mapping.rb +32 -3
  84. data/gym/lib/gym/detect_values.rb +34 -2
  85. data/gym/lib/gym/generators/package_command_generator.rb +8 -0
  86. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +52 -17
  87. data/gym/lib/gym/module.rb +8 -0
  88. data/gym/lib/gym/options.rb +25 -1
  89. data/gym/lib/gym/runner.rb +70 -21
  90. data/match/lib/match/change_password.rb +1 -1
  91. data/match/lib/match/encryption.rb +4 -0
  92. data/match/lib/match/encryption/openssl.rb +1 -1
  93. data/match/lib/match/generator.rb +17 -3
  94. data/match/lib/match/importer.rb +35 -20
  95. data/match/lib/match/module.rb +5 -2
  96. data/match/lib/match/nuke.rb +59 -17
  97. data/match/lib/match/options.rb +38 -15
  98. data/match/lib/match/runner.rb +24 -8
  99. data/match/lib/match/setup.rb +1 -1
  100. data/match/lib/match/spaceship_ensure.rb +19 -9
  101. data/match/lib/match/storage.rb +4 -0
  102. data/match/lib/match/storage/git_storage.rb +5 -2
  103. data/match/lib/match/storage/google_cloud_storage.rb +2 -2
  104. data/match/lib/match/storage/s3_storage.rb +162 -0
  105. data/pilot/lib/pilot/.manager.rb.swp +0 -0
  106. data/pilot/lib/pilot/build_manager.rb +24 -9
  107. data/scan/lib/scan/detect_values.rb +6 -1
  108. data/scan/lib/scan/manager.rb +18 -1
  109. data/scan/lib/scan/options.rb +28 -1
  110. data/scan/lib/scan/runner.rb +9 -7
  111. data/scan/lib/scan/slack_poster.rb +1 -1
  112. data/scan/lib/scan/test_command_generator.rb +12 -5
  113. data/screengrab/lib/screengrab/runner.rb +31 -18
  114. data/sigh/lib/sigh/.runner.rb.swp +0 -0
  115. data/snapshot/lib/snapshot/fixes/simulator_shared_pasteboard.rb +16 -0
  116. data/snapshot/lib/snapshot/options.rb +12 -1
  117. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  118. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +13 -0
  119. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
  120. data/spaceship/lib/spaceship/connect_api/models/.bundle_id.rb.swp +0 -0
  121. data/{gym/lib/gym/.runner.rb.swp → spaceship/lib/spaceship/connect_api/models/.bundle_id_capability.rb.swp} +0 -0
  122. data/spaceship/lib/spaceship/connect_api/models/app.rb +11 -0
  123. data/spaceship/lib/spaceship/connect_api/models/beta_feedback.rb +4 -0
  124. data/spaceship/lib/spaceship/connect_api/models/build.rb +1 -2
  125. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +2 -0
  126. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +29 -0
  127. data/spaceship/lib/spaceship/portal/app.rb +11 -2
  128. data/spaceship/lib/spaceship/tunes/app_version.rb +6 -1
  129. data/spaceship/lib/spaceship/tunes/iap.rb +11 -11
  130. data/spaceship/lib/spaceship/tunes/iap_detail.rb +7 -3
  131. data/spaceship/lib/spaceship/tunes/iap_families.rb +12 -1
  132. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +26 -17
  133. data/spaceship/lib/spaceship/tunes/iap_status.rb +5 -1
  134. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  135. data/supply/lib/supply/client.rb +1 -1
  136. metadata +63 -18
@@ -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],
@@ -110,7 +110,7 @@ module Fastlane
110
110
 
111
111
  # Is printed out in the Steps: output in the terminal
112
112
  # Return nil if you don't want any logging in the terminal/JUnit Report
113
- def self.step_text
113
+ def self.step_text(params)
114
114
  self.action_name
115
115
  end
116
116
 
@@ -1,3 +1,5 @@
1
1
  All built-in integrations are available in this directory. Use the `fastlane new_action` command to create a new action.
2
2
 
3
3
  _fastlane_ will automatically detect the files in this folder
4
+
5
+ All available actions are listed and documented on https://docs.fastlane.tools/actions/. Documentation for individual actions is available on https://docs.fastlane.tools/actions/%action_name%, e.g. https://docs.fastlane.tools/actions/copy_artifacts/.
@@ -1,14 +1,18 @@
1
+ require 'ostruct'
2
+
1
3
  module Fastlane
2
4
  module Actions
3
5
  module SharedValues
4
6
  LATEST_BUILD_NUMBER = :LATEST_BUILD_NUMBER
7
+ LATEST_VERSION = :LATEST_VERSION
5
8
  end
6
9
 
7
10
  class AppStoreBuildNumberAction < Action
8
11
  def self.run(params)
9
12
  require 'spaceship'
10
13
 
11
- build_nr = get_build_number(params)
14
+ result = get_build_number(params)
15
+ build_nr = result.build_nr
12
16
 
13
17
  # Convert build_nr to int (for legacy use) if no "." in string
14
18
  if build_nr.kind_of?(String) && !build_nr.include?(".")
@@ -16,6 +20,9 @@ module Fastlane
16
20
  end
17
21
 
18
22
  Actions.lane_context[SharedValues::LATEST_BUILD_NUMBER] = build_nr
23
+ Actions.lane_context[SharedValues::LATEST_VERSION] = result.build_v
24
+
25
+ return build_nr
19
26
  end
20
27
 
21
28
  def self.get_build_number(params)
@@ -33,7 +40,7 @@ module Fastlane
33
40
 
34
41
  UI.message("Latest upload for live-version #{app.live_version.version} is build: #{build_nr}")
35
42
 
36
- return build_nr
43
+ return OpenStruct.new({ build_nr: build_nr, build_v: app.live_version.version })
37
44
  else
38
45
  version_number = params[:version]
39
46
  platform = params[:platform]
@@ -61,7 +68,7 @@ module Fastlane
61
68
  if build
62
69
  build_nr = build.version
63
70
  UI.message("Latest upload for version #{build.app_version} on #{platform_message} is build: #{build_nr}")
64
- return build_nr
71
+ return OpenStruct.new({ build_nr: build_nr, build_v: build.app_version })
65
72
  end
66
73
 
67
74
  # Let user know that build couldn't be found
@@ -72,7 +79,7 @@ module Fastlane
72
79
  else
73
80
  build_nr = params[:initial_build_number]
74
81
  UI.message("Using initial build number of #{build_nr}")
75
- return build_nr
82
+ return OpenStruct.new({ build_nr: build_nr, build_v: version_number })
76
83
  end
77
84
  end
78
85
  end
@@ -159,7 +166,8 @@ module Fastlane
159
166
 
160
167
  def self.output
161
168
  [
162
- ['LATEST_BUILD_NUMBER', 'The latest build number of either live or testflight version']
169
+ ['LATEST_BUILD_NUMBER', 'The latest build number of either live or testflight version'],
170
+ ['LATEST_VERSION', 'The version of the latest build number']
163
171
  ]
164
172
  end
165
173
 
@@ -3,6 +3,8 @@ module Fastlane
3
3
  module Actions
4
4
  class AutomaticCodeSigningAction < Action
5
5
  def self.run(params)
6
+ UI.deprecated("The `automatic_code_signing` action has been deprecated,")
7
+ UI.deprecated("Please use `update_code_signing_settings` action instead.")
6
8
  FastlaneCore::PrintTable.print_values(config: params, title: "Summary for Automatic Codesigning")
7
9
  path = params[:path]
8
10
  path = File.join(File.expand_path(path), "project.pbxproj")
@@ -201,7 +203,11 @@ module Fastlane
201
203
  end
202
204
 
203
205
  def self.category
204
- :code_signing
206
+ :deprecated
207
+ end
208
+
209
+ def self.deprecated_notes
210
+ "Please use `update_code_signing_settings` action instead."
205
211
  end
206
212
 
207
213
  def self.return_value
@@ -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
@@ -1,150 +1,46 @@
1
1
  module Fastlane
2
2
  module Actions
3
- module SharedValues
4
- IPA_OUTPUT_PATH ||= :IPA_OUTPUT_PATH
5
- DSYM_OUTPUT_PATH ||= :DSYM_OUTPUT_PATH
6
- XCODEBUILD_ARCHIVE ||= :XCODEBUILD_ARCHIVE # originally defined in XcodebuildAction
7
- end
8
-
9
- class BuildIosAppAction < Action
10
- def self.run(values)
11
- require 'gym'
12
-
13
- unless Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE].to_s == "development"
14
- values[:export_method] ||= Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE]
15
- end
16
-
17
- if Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
18
- # Since Xcode 9 you need to explicitly provide the provisioning profile per app target
19
- # If the user is smart and uses match and gym together with fastlane, we can do all
20
- # the heavy lifting for them
21
- values[:export_options] ||= {}
22
- # It's not always a hash, because the user might have passed a string path to a ready plist file
23
- # If that's the case, we won't set the provisioning profiles
24
- # see https://github.com/fastlane/fastlane/issues/9490
25
- if values[:export_options].kind_of?(Hash)
26
- match_mapping = (Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING] || {}).dup
27
- existing_mapping = (values[:export_options][:provisioningProfiles] || {}).dup
28
-
29
- # Be smart about how we merge those mappings in case there are conflicts
30
- mapping_object = Gym::CodeSigningMapping.new
31
- hash_to_use = mapping_object.merge_profile_mapping(primary_mapping: existing_mapping,
32
- secondary_mapping: match_mapping,
33
- export_method: values[:export_method])
34
-
35
- values[:export_options][:provisioningProfiles] = hash_to_use
36
- else
37
- self.show_xcode_9_warning
38
- end
39
- elsif Actions.lane_context[SharedValues::SIGH_PROFILE_PATHS]
40
- # Since Xcode 9 you need to explicitly provide the provisioning profile per app target
41
- # If the user used sigh we can match the profiles from sigh
42
- values[:export_options] ||= {}
43
- if values[:export_options].kind_of?(Hash)
44
- # It's not always a hash, because the user might have passed a string path to a ready plist file
45
- # If that's the case, we won't set the provisioning profiles
46
- # see https://github.com/fastlane/fastlane/issues/9684
47
- values[:export_options][:provisioningProfiles] ||= {}
48
- Actions.lane_context[SharedValues::SIGH_PROFILE_PATHS].each do |profile_path|
49
- begin
50
- profile = FastlaneCore::ProvisioningProfile.parse(profile_path)
51
- app_id_prefix = profile["ApplicationIdentifierPrefix"].first
52
- bundle_id = profile["Entitlements"]["application-identifier"].gsub("#{app_id_prefix}.", "")
53
- values[:export_options][:provisioningProfiles][bundle_id] = profile["Name"]
54
- rescue => ex
55
- UI.error("Couldn't load profile at path: #{profile_path}")
56
- UI.error(ex)
57
- UI.verbose(ex.backtrace.join("\n"))
58
- end
59
- end
60
- else
61
- self.show_xcode_9_warning
62
- end
3
+ require 'fastlane/actions/build_app'
4
+ class BuildIosAppAction < BuildAppAction
5
+ # Gym::Options.available_options keys that don't apply to ios apps.
6
+ REJECT_OPTIONS = [
7
+ :pkg,
8
+ :skip_package_pkg,
9
+ :catalyst_platform,
10
+ :installer_cert_name
11
+ ]
12
+
13
+ def self.run(params)
14
+ # Adding reject options back in so gym has everything it needs
15
+ params.available_options += Gym::Options.available_options.select do |option|
16
+ REJECT_OPTIONS.include?(option.key)
63
17
  end
64
18
 
65
- gym_output_path = Gym::Manager.new.work(values)
66
- if gym_output_path.nil?
67
- UI.important("No output path received from gym")
68
- return nil
69
- end
70
-
71
- absolute_ipa_path = File.expand_path(gym_output_path)
72
- absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip")
73
-
74
- # This might be the mac app path, so we don't want to set it here
75
- # https://github.com/fastlane/fastlane/issues/5757
76
- if absolute_ipa_path.include?(".ipa")
77
- Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path
78
- ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver
79
- end
80
-
81
- Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path if File.exist?(absolute_dsym_path)
82
- Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] = Gym::BuildCommandGenerator.archive_path
83
- ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path if File.exist?(absolute_dsym_path)
84
-
85
- return absolute_ipa_path
86
- end
87
-
88
- def self.description
89
- "Easily build and sign your app (via _gym_)"
90
- end
91
-
92
- def self.details
93
- "More information: https://fastlane.tools/gym"
94
- end
95
-
96
- def self.output
97
- [
98
- ['IPA_OUTPUT_PATH', 'The path to the newly generated ipa file'],
99
- ['DSYM_OUTPUT_PATH', 'The path to the dSYM files'],
100
- ['XCODEBUILD_ARCHIVE', 'The path to the xcodebuild archive']
101
- ]
102
- end
19
+ # Defaulting to ios specific values
20
+ params[:catalyst_platform] = "ios"
103
21
 
104
- def self.return_value
105
- "The absolute path to the generated ipa file"
22
+ super(params)
106
23
  end
107
24
 
108
- def self.author
109
- "KrauseFx"
110
- end
25
+ #####################################################
26
+ # @!group Documentation
27
+ #####################################################
111
28
 
112
29
  def self.available_options
113
30
  require 'gym'
114
- Gym::Options.available_options
115
- end
116
-
117
- def self.is_supported?(platform)
118
- [:ios, :mac].include?(platform)
119
- end
31
+ require 'gym/options'
120
32
 
121
- def self.example_code
122
- [
123
- 'build_ios_app(scheme: "MyApp", workspace: "MyApp.xcworkspace")',
124
- 'build_ios_app(
125
- workspace: "MyApp.xcworkspace",
126
- configuration: "Debug",
127
- scheme: "MyApp",
128
- silent: true,
129
- clean: true,
130
- output_directory: "path/to/dir", # Destination directory. Defaults to current directory.
131
- output_name: "my-app.ipa", # specify the name of the .ipa file to generate (including file extension)
132
- sdk: "iOS 11.1" # use SDK as the name or path of the base SDK when building the project.
133
- )',
134
- 'gym # alias for "build_ios_app"',
135
- 'build_app # alias for "build_ios_app"'
136
- ]
33
+ Gym::Options.available_options.reject do |option|
34
+ REJECT_OPTIONS.include?(option.key)
35
+ end
137
36
  end
138
37
 
139
- def self.category
140
- :building
38
+ def self.is_supported?(platform)
39
+ [:ios].include?(platform)
141
40
  end
142
41
 
143
- def self.show_xcode_9_warning
144
- return unless Helper.xcode_at_least?("9.0")
145
- UI.message("You passed a path to a custom plist file for exporting the binary.")
146
- UI.message("Make sure to include information about what provisioning profiles to use with Xcode 9")
147
- UI.message("More information: https://docs.fastlane.tools/codesigning/xcode-project/#xcode-9-and-up")
42
+ def self.description
43
+ "Alias for the `build_app` action but only for iOS"
148
44
  end
149
45
  end
150
46
  end