fastlane-plugin-versioning 0.3.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c119d45866d925180dce8969f44e41a4fe594597
4
- data.tar.gz: 8720abaf2451bfb9adcfaceb3c6e32703e75175e
2
+ SHA256:
3
+ metadata.gz: a15732d1c4f161ba72f1c4a7622eae383fd8f43dedf4215b6fde8d90001c5ffc
4
+ data.tar.gz: 8e2ff2646f5f8789e4b4741592ae6875f67f6c41493b8fb28cfb8ca579202995
5
5
  SHA512:
6
- metadata.gz: 7946b575c0cfe92778678fbebe4b37b598987147a9b3ad7e5001a27e7fb72a19133a71e9267ca9dc3b8caa7812583534af8903d3f67ed675042789d4b1bd43c1
7
- data.tar.gz: d07f145b6efb251dd724982e8b9f02a399ff008798a0897853c082865c3a7a5eca0c85fa0de41a714bf38c4aa4d4429c366b6ba6687f46c257346d277d408103
6
+ metadata.gz: 69b5bb7b919d5cf7f7e179e6d983ac776899696175071b1db2403564b39465e72afadc3e4ef4ebac99edb5873d2fe64d7e99e637c5c16710baa4e2e2cd629de4
7
+ data.tar.gz: 9813dedfff2299f82b505f9fbe2c6dd71f067070ff97fcccc0575fd7ea0ecfb44cb02060f885d561d7b4c55e03f2905cf3c924d2a55d69e5dcb83775c01c44ec
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Versioning `fastlane` Plugin
2
2
 
3
3
  ![CI Status](https://travis-ci.org/SiarheiFedartsou/fastlane-plugin-versioning.svg?branch=master)
4
+ [![License](https://img.shields.io/github/license/SiarheiFedartsou/fastlane-plugin-versioning.svg)](https://github.com/SiarheiFedartsou/fastlane-plugin-versioning/blob/master/LICENSE)
5
+ [![Gem](https://img.shields.io/gem/v/fastlane-plugin-versioning.svg?style=flat)](http://rubygems.org/gems/fastlane-plugin-versioning)
4
6
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-versioning)
5
7
 
6
-
7
8
  ## Getting Started
8
9
 
9
10
  This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with fastlane-plugin-versioning, add it to your project by running:
@@ -15,14 +16,24 @@ fastlane add_plugin versioning
15
16
  ## About versioning
16
17
 
17
18
  Extends fastlane versioning actions. Allows to set/get versions without using agvtool and do some other small tricks.
18
- Note that all schemes that you pass to actions like `increment_version_number_in_plist` or `get_info_plist_path` in `scheme` parameter must be shared.
19
- To make your scheme shared go to "Manage schemes" in Xcode and tich "Shared" checkbox near your scheme.
19
+ Note that all schemes that you pass to actions like `increment_version_number_in_plist`, `increment_build_number_in_xcodeproj` or `get_info_plist_path` in `scheme` parameter must be shared.
20
+ To make your scheme shared go to "Manage schemes" in Xcode and tick "Shared" checkbox near your scheme.
21
+
22
+
23
+ ### what is this `plist_build_setting_support` stuff about?!
24
+ If you have a xcodeproject and have updated to Xcode 11, you'll notice that if you change your build and version numbers through the UI, the actual numbers are now stored inside build settings inside build confiugration. The Info.plist file -- where they used to be stored -- now contains build setting variables (looks like `$(CURRENT_PROJECT_VERSION)` or `$(MARKETING_VERSION)`, for build number and version number respectively).
25
+ If you are at this migration 'turning point', you have two options. you can either:
26
+ 1. simply add `plist_build_setting_support: true` to your plist action parameters
27
+ 2. change the command to be the xcodeproj variants - i.e. `increment_version_number_in_xcodeproj` or `increment_build_number_in_xcodeproj`
28
+
29
+ these also apply to the `getters` of build and version numbers.
30
+ We will leave the plist actions in, as for those consumers who are limited to their upgrade path.
20
31
 
21
32
  ## Actions
22
33
 
23
34
  ### increment_version_number_in_plist
24
35
 
25
- Increment/set version number in Info.plist of specific target. Doesn't use agvtool (unlike default increment_version_number).
36
+ Increment/set the version number in a Info.plist of specific target. Doesn't use `agvtool` (unlike default `increment_version_number`).
26
37
 
27
38
  ```ruby
28
39
  increment_version_number_in_plist # Automatically increment patch version number.
@@ -56,20 +67,42 @@ increment_version_number_in_plist(
56
67
  # (optional)
57
68
  target: 'TestTarget' # or `scheme`
58
69
  )
70
+
71
+ increment_version_number_in_plist(
72
+ # specify specific version number (optional, omitting it increments patch version number)
73
+ version_number: '2.1.1',
74
+ # (optional, you must specify the path to your main Xcode project if it is not in the project root directory
75
+ # or if you have multiple xcodeproj's in the root directory)
76
+ xcodeproj: './path/to/MyApp.xcodeproj'
77
+ # (optional)
78
+ target: 'TestTarget' # or `scheme`
79
+ plist_build_setting_support: true, # optional, and defaulting to false.
80
+ # setting this will resolve the version number using the relevant build settings from your xcodeproj.
81
+ )
82
+
59
83
  ```
60
84
 
85
+ #### plist_build_setting_support
86
+ `get_version_number_from_plist` supports the `plist_build_setting_support` flag, and will either use the other parameters you pass to resolve a particular build configuration to edit, _OR_ change __ALL__ of them.
87
+
88
+
61
89
  ### get_version_number_from_plist
62
90
 
63
- Get version number from Info.plist of specific target. Doesn't use agvtool (unlike default get_version_number).
91
+ Get the version number from an Info.plist of specific target. Doesn't use `agvtool` (unlike default `get_version_number`).
64
92
 
65
93
  ```ruby
66
94
  version = get_version_number_from_plist(xcodeproj: 'Project.xcodeproj', # optional
67
95
  target: 'TestTarget', # optional, or `scheme`
68
96
  # optional, must be specified if you have different Info.plist build settings
69
97
  # for different build configurations
98
+ plist_build_setting_support: true, # optional, and defaulting to false. setting this will
99
+ # resolve the version number using the relevant build settings from your xcodeproj.
70
100
  build_configuration_name: 'Release')
71
101
  ```
72
102
 
103
+ #### plist_build_setting_support
104
+ `get_version_number_from_plist` supports the `plist_build_setting_support` flag, and will either use the other parameters you pass to resolve a particular build configuration to retrieve, _OR_ pick the first it finds.
105
+
73
106
  ### get_app_store_version_number
74
107
 
75
108
 
@@ -96,7 +129,7 @@ version = get_version_number_from_git_branch(pattern: 'release-#')
96
129
 
97
130
  ### increment_build_number_in_plist
98
131
 
99
- Increment/set build number in Info.plist of specific target. Doesn't use agvtool (unlike default increment_version_number).
132
+ Increment/set build number in Info.plist of specific target. Doesn't use `agvtool` (unlike default `increment_version_number`).
100
133
 
101
134
  ```ruby
102
135
  increment_build_number_in_plist # Automatically increments the last part of the build number.
@@ -105,16 +138,115 @@ increment_build_number_in_plist(
105
138
  )
106
139
  ```
107
140
 
141
+ #### plist_build_setting_support
142
+ `increment_build_number_in_plist` supports the `plist_build_setting_support` flag, and will either use the other parameters you pass to resolve a particular build configuration to edit, _OR_ change __ALL__ of them.
143
+
108
144
  ### get_build_number_from_plist
109
145
 
110
- Get build number from Info.plist of specific target. Doesn't use agvtool (unlike default get_build_number).
146
+ Get the build number from an Info.plist of specific target. Doesn't use `agvtool` (unlike default `get_build_number`).
111
147
 
112
148
  ```ruby
113
149
  version = get_build_number_from_plist(xcodeproj: "Project.xcodeproj", # optional
150
+ target: 'TestTarget', # optional, or `scheme`
151
+ plist_build_setting_support: true, # optional, and defaulting to false. setting this will
152
+ # resolve the build number using the relevant build settings from your xcodeproj.
153
+ build_configuration_name: 'Release') # optional, must be specified if you have different Info.plist build settings for different build configurations
154
+ ```
155
+
156
+ #### plist_build_setting_support
157
+ `get_build_number_from_plist` supports the `plist_build_setting_support` flag, and will either use the other parameters you pass to resolve a particular build configuration to retrieve, _OR_ pick the first it finds.
158
+
159
+ ### get_build_number_from_xcodeproj
160
+
161
+ Get the build number from a xcodeproj - specific to a target. Doesn't use `agvtool` (unlike default `get_build_number`).
162
+
163
+ ```ruby
164
+ version = get_build_number_from_xcodeproj(xcodeproj: "Project.xcodeproj", # optional
114
165
  target: 'TestTarget', # optional, or `scheme`
115
166
  build_configuration_name: 'Release') # optional, must be specified if you have different Info.plist build settings for different build configurations
116
167
  ```
117
168
 
169
+ ### get_version_number_from_xcodeproj
170
+
171
+ Get the version number from a xcodeproj - specific to a target. Doesn't use `agvtool` (unlike default `get_build_number`).
172
+
173
+ ```ruby
174
+ version = get_version_number_from_xcodeproj(xcodeproj: 'Project.xcodeproj', # optional
175
+ target: 'TestTarget', # optional, or `scheme`
176
+ # optional, must be specified if you have different Info.plist build settings
177
+ # for different build configurations
178
+ build_configuration_name: 'Release')
179
+ ```
180
+
181
+ ### increment_version_number_in_xcodeproj
182
+
183
+ Increment/set the version number in a xcodeproj of specific target. Doesn't use `agvtool` (unlike default `increment_version_number`).
184
+
185
+ ```ruby
186
+ increment_version_number_in_xcodeproj # Automatically increment patch version number.
187
+ increment_version_number_in_xcodeproj(
188
+ bump_type: 'patch' # Automatically increment patch version number
189
+ )
190
+ increment_version_number_in_xcodeproj(
191
+ bump_type: 'minor' # Automatically increment minor version number
192
+ )
193
+ increment_version_number_in_xcodeproj(
194
+ bump_type: 'minor',
195
+ omit_zero_patch_version: true # if true omits zero in patch version(so 42.10.0 will become 42.10 and 42.10.1 will remain 42.10.1), default is false
196
+ )
197
+ increment_version_number_in_xcodeproj(
198
+ bump_type: 'major' # Automatically increment major version number
199
+ )
200
+ increment_version_number_in_xcodeproj(
201
+ version_number: '2.1.1' # Set a specific version number
202
+ )
203
+ increment_version_number_in_xcodeproj(
204
+ # Automatically increment patch version number. Use App Store version number as a source.
205
+ version_source: 'appstore'
206
+ )
207
+
208
+ increment_version_number_in_xcodeproj(
209
+ # specify specific version number (optional, omitting it increments patch version number)
210
+ version_number: '2.1.1',
211
+ # (optional, you must specify the path to your main Xcode project if it is not in the project root directory
212
+ # or if you have multiple xcodeproj's in the root directory)
213
+ xcodeproj: './path/to/MyApp.xcodeproj'
214
+ # (optional)
215
+ target: 'TestTarget' # or `scheme`
216
+ )
217
+
218
+ ```
219
+
220
+ ### get_version_number_from_plist
221
+
222
+ Get version number from Info.plist of specific target. Doesn't use agvtool (unlike default `get_version_number`).
223
+
224
+ ```ruby
225
+ version = get_version_number_from_plist(xcodeproj: 'Project.xcodeproj', # optional
226
+ target: 'TestTarget', # optional, or `scheme`
227
+ # optional, must be specified if you have different Info.plist build settings
228
+ # for different build configurations
229
+ plist_build_setting_support: true, # optional, and defaulting to false. setting this will
230
+ # resolve the version number using the relevant build settings from your xcodeproj.
231
+ build_configuration_name: 'Release')
232
+ ```
233
+
234
+ #### plist_build_setting_support
235
+ `get_version_number_from_plist` supports the `plist_build_setting_support` flag, and will either use the other parameters you pass to resolve a particular build configuration to retrieve, _OR_ pick the first it finds.
236
+
237
+ ### get_app_store_version_number
238
+
239
+
240
+ ```ruby
241
+ version = get_app_store_version_number(xcodeproj: 'Project.xcodeproj', # optional
242
+ target: 'TestTarget', # optional, or `scheme`
243
+ # optional, must be specified if you have different Info.plist build settings
244
+ # for different build configurations
245
+ build_configuration_name: 'Release')
246
+ )
247
+ version = get_app_store_version_number(bundle_id: 'com.apple.Numbers')
248
+
249
+ ```
118
250
 
119
251
  ### get_info_plist_path
120
252
 
@@ -129,7 +261,7 @@ get_info_plist_path(xcodeproj: 'Test.xcodeproj', # optional
129
261
 
130
262
  ### ci_build_number
131
263
 
132
- Get CI system build number. Determined using environment variables defined by CI systems. Supports Jenkins, Travis CI, Circle CI, TeamCity, GoCD, Bamboo, Gitlab CI, Xcode Server, Bitbucket Pipelines and BuddyBuild. Returns `1` if build number cannot be determined.
264
+ Get CI system build number. Determined using environment variables defined by CI systems. Supports Jenkins, Travis CI, Circle CI, TeamCity, GoCD, Bamboo, Gitlab CI, Xcode Server, Bitbucket Pipelines, BuddyBuild, AppVeyor. Returns `1` if build number cannot be determined.
133
265
 
134
266
  ```ruby
135
267
  increment_build_number_in_plist(
@@ -137,6 +269,8 @@ increment_build_number_in_plist(
137
269
  )
138
270
  ```
139
271
 
272
+
273
+
140
274
  ## Issues and Feedback
141
275
 
142
276
  For any other issues and feedback about this plugin, please submit it to this repository.
@@ -27,7 +27,7 @@ module Fastlane
27
27
  end
28
28
 
29
29
  if ENV.key?('GITLAB_CI')
30
- return ENV['CI_JOB_ID']
30
+ return ENV['CI_PIPELINE_IID'] || ENV['CI_JOB_ID']
31
31
  end
32
32
 
33
33
  if ENV.key?('XCS')
@@ -38,11 +38,19 @@ module Fastlane
38
38
  return ENV['BITBUCKET_BUILD_NUMBER']
39
39
  end
40
40
 
41
+ if ENV.key?('BITRISE_BUILD_NUMBER')
42
+ return ENV['BITRISE_BUILD_NUMBER']
43
+ end
44
+
41
45
  if ENV.key?('BUDDYBUILD_BUILD_NUMBER')
42
46
  return ENV['BUDDYBUILD_BUILD_NUMBER']
43
47
  end
44
48
 
45
- UI.error("Cannot detect current CI build number. Use 1 by default.")
49
+ if ENV.key?('APPVEYOR_BUILD_NUMBER')
50
+ return ENV['APPVEYOR_BUILD_NUMBER']
51
+ end
52
+
53
+ UI.error("Cannot detect current CI build number. Defaulting to \"1\".")
46
54
  "1"
47
55
  end
48
56
 
@@ -55,7 +63,7 @@ module Fastlane
55
63
  end
56
64
 
57
65
  def self.authors
58
- ["Siarhei Fedartsou"]
66
+ ["Siarhei Fedartsou", "John Douglas"]
59
67
  end
60
68
 
61
69
  def self.example_code
@@ -9,11 +9,11 @@ module Fastlane
9
9
  bundle_id = params[:bundle_id]
10
10
  else
11
11
  if Helper.test?
12
- plist = "/tmp/fastlane/tests/fastlane/Info.plist"
12
+ plist = "/tmp/fastlane/tests/fastlane/plist/Info.plist"
13
13
  else
14
14
  plist = GetInfoPlistPathAction.run(params)
15
15
  end
16
- bundle_id = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleIdentifier')
16
+ bundle_id = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleIdentifier') # TODO: add same kind of flag to support build setting variables
17
17
  end
18
18
 
19
19
  uri = URI("http://itunes.apple.com/lookup?bundleId=#{bundle_id}")
@@ -42,7 +42,7 @@ module Fastlane
42
42
  env_name: "FL_APPSTORE_VERSION_NUMBER_BUNDLE_ID",
43
43
  description: "Bundle ID of the application",
44
44
  optional: true,
45
- conflicting_options: [:xcodeproj, :target, :scheme, :build_configuration_name],
45
+ conflicting_options: %i[xcodeproj target scheme build_configuration_name],
46
46
  is_string: true),
47
47
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
48
48
  env_name: "FL_VERSION_NUMBER_PROJECT",
@@ -56,12 +56,12 @@ module Fastlane
56
56
  FastlaneCore::ConfigItem.new(key: :target,
57
57
  env_name: "FL_VERSION_NUMBER_TARGET",
58
58
  optional: true,
59
- conflicting_options: [:bundle_id, :scheme],
59
+ conflicting_options: %i[bundle_id scheme],
60
60
  description: "Specify a specific target if you have multiple per project, optional"),
61
61
  FastlaneCore::ConfigItem.new(key: :scheme,
62
62
  env_name: "FL_VERSION_NUMBER_SCHEME",
63
63
  optional: true,
64
- conflicting_options: [:bundle_id, :target],
64
+ conflicting_options: %i[bundle_id target],
65
65
  description: "Specify a specific scheme if you have multiple per project, optional"),
66
66
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
67
67
  optional: true,
@@ -75,7 +75,7 @@ module Fastlane
75
75
  end
76
76
 
77
77
  def self.is_supported?(platform)
78
- [:ios, :mac].include? platform
78
+ %i[ios mac].include? platform
79
79
  end
80
80
  end
81
81
  end
@@ -3,14 +3,22 @@ module Fastlane
3
3
  class GetBuildNumberFromPlistAction < Action
4
4
  def self.run(params)
5
5
  if Helper.test?
6
- plist = "/tmp/fastlane/tests/fastlane/Info.plist"
6
+ plist = "/tmp/fastlane/tests/fastlane/plist/Info.plist"
7
7
  else
8
8
  plist = GetInfoPlistPathAction.run(params)
9
9
  end
10
10
 
11
- version_number = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleVersion')
11
+ if params[:plist_build_setting_support]
12
+ UI.important "build number will originate from xcodeproj"
13
+ build_number = GetBuildNumberFromXcodeprojAction.run(params)
14
+ else
15
+ UI.important "build number will originate from plist."
16
+ build_number = GetInfoPlistValueAction.run(path: plist, key: 'CFBundleVersion')
17
+ end
18
+
12
19
  # Store the number in the shared hash
13
- Actions.lane_context[SharedValues::BUILD_NUMBER] = version_number
20
+ Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
21
+ build_number
14
22
  end
15
23
 
16
24
  #####################################################
@@ -23,7 +31,8 @@ module Fastlane
23
31
 
24
32
  def self.details
25
33
  [
26
- "This action will return the current build number set on your project's Info.plist."
34
+ "This action will return the current build number set on your project's Info.plist.",
35
+ "note that you can pass plist_build_setting_support: true, in which case it will return from your xcodeproj."
27
36
  ].join(' ')
28
37
  end
29
38
 
@@ -49,8 +58,11 @@ module Fastlane
49
58
  description: "Specify a specific scheme if you have multiple per project, optional"),
50
59
  FastlaneCore::ConfigItem.new(key: :build_configuration_name,
51
60
  optional: true,
52
- description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration")
53
-
61
+ description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration"),
62
+ FastlaneCore::ConfigItem.new(key: :plist_build_setting_support,
63
+ description: "support automatic resolution of build setting from xcodeproj if not a literal value in the plist",
64
+ is_string: false,
65
+ default_value: false)
54
66
  ]
55
67
  end
56
68
 
@@ -65,7 +77,7 @@ module Fastlane
65
77
  end
66
78
 
67
79
  def self.is_supported?(platform)
68
- [:ios, :mac].include? platform
80
+ %i[ios mac].include? platform
69
81
  end
70
82
  end
71
83
  end
@@ -0,0 +1,127 @@
1
+ module Fastlane
2
+ module Actions
3
+ class GetBuildNumberFromXcodeprojAction < Action
4
+ require 'xcodeproj'
5
+ require 'pathname'
6
+
7
+ def self.run(params)
8
+ unless params[:xcodeproj]
9
+ if Helper.test?
10
+ params[:xcodeproj] = "/tmp/fastlane/tests/fastlane/xcodeproj/versioning_fixture_project.xcodeproj"
11
+ else
12
+ params[:xcodeproj] = Dir["*.xcodeproj"][0] unless params[:xcodeproj]
13
+ end
14
+ end
15
+
16
+ if params[:target]
17
+ build_number = get_build_number_using_target(params)
18
+ elsif params[:build_configuration_name] && params[:scheme]
19
+ build_number = get_build_number_using_scheme(params)
20
+ else
21
+ UI.important "not enough information to pick a specific target or build configuration. taking the first one from the project"
22
+ build_number = get_first_build_number_in_xcodeproj(params)
23
+ end
24
+
25
+ Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
26
+ build_number
27
+ end
28
+
29
+ def self.get_first_build_number_in_xcodeproj(params)
30
+ project = Xcodeproj::Project.open(params[:xcodeproj])
31
+ configs = project.objects.select { |obj| select_build_configuration_predicate(nil, obj) }
32
+ configs.first.build_settings["CURRENT_PROJECT_VERSION"]
33
+ end
34
+
35
+ private_class_method
36
+ def self.select_build_configuration_predicate(name, configuration)
37
+ is_build_valid_configuration = configuration.isa == "XCBuildConfiguration" && !configuration.build_settings["PRODUCT_BUNDLE_IDENTIFIER"].nil?
38
+ is_build_valid_configuration &&= configuration.name == name unless name.nil?
39
+ return is_build_valid_configuration
40
+ end
41
+
42
+ def self.get_build_number_using_target(params)
43
+ project = Xcodeproj::Project.open(params[:xcodeproj])
44
+ if params[:target]
45
+ target = project.targets.detect { |t| t.name == params[:target] }
46
+ else
47
+ # firstly we are trying to find modern application target
48
+ target = project.targets.detect do |t|
49
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
50
+ t.product_type == 'com.apple.product-type.application'
51
+ end
52
+ target = project.targets[0] if target.nil?
53
+ end
54
+
55
+ build_number = target.resolved_build_setting('CURRENT_PROJECT_VERSION', true)
56
+ UI.user_error! 'Cannot resolve build number build setting.' if build_number.nil? || build_number.empty?
57
+
58
+ if !(build_configuration_name = params[:build_configuration_name]).nil?
59
+ build_number = build_number[build_configuration_name]
60
+ UI.user_error! "Cannot resolve $(CURRENT_PROJECT_VERSION) build setting for #{build_configuration_name}." if build_number.nil?
61
+ else
62
+ build_number = build_number.values.compact.uniq
63
+ UI.user_error! 'Cannot accurately resolve $(CURRENT_PROJECT_VERSION) build setting, try specifying :build_configuration_name.' if build_number.count > 1
64
+ build_number = build_number.first
65
+ end
66
+
67
+ build_number
68
+ end
69
+
70
+ def self.get_build_number_using_scheme(params)
71
+ config = { project: params[:xcodeproj], scheme: params[:scheme], configuration: params[:build_configuration_name] }
72
+ project = FastlaneCore::Project.new(config)
73
+ project.select_scheme
74
+
75
+ build_number = project.build_settings(key: 'CURRENT_PROJECT_VERSION')
76
+ UI.user_error! "Cannot resolve $(CURRENT_PROJECT_VERSION) in for the scheme #{config.scheme} with the name #{params.configuration}" if build_number.nil? || build_number.empty?
77
+ build_number
78
+ end
79
+
80
+ #####################################################
81
+ # @!group Documentation
82
+ #####################################################
83
+
84
+ def self.description
85
+ "Get the build number of your project"
86
+ end
87
+
88
+ def self.details
89
+ 'Gets the $(CURRENT_PROJECT_VERSION) build setting using the specified parameters, or the first if not enough parameters are passed.'
90
+ end
91
+
92
+ def self.available_options
93
+ [
94
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
95
+ env_name: "FL_BUILD_NUMBER_PROJECT",
96
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
97
+ optional: true,
98
+ verify_block: proc do |value|
99
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
100
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
101
+ end),
102
+ FastlaneCore::ConfigItem.new(key: :target,
103
+ env_name: "FL_BUILD_NUMBER_TARGET",
104
+ optional: true,
105
+ conflicting_options: [:scheme],
106
+ description: "Specify a specific target if you have multiple per project, optional"),
107
+ FastlaneCore::ConfigItem.new(key: :scheme,
108
+ env_name: "FL_BUILD_NUMBER_SCHEME",
109
+ optional: true,
110
+ conflicting_options: [:target],
111
+ description: "Specify a specific scheme if you have multiple per project, optional"),
112
+ FastlaneCore::ConfigItem.new(key: :build_configuration_name,
113
+ optional: true,
114
+ description: "Specify a specific build configuration if you have different build settings for each configuration")
115
+ ]
116
+ end
117
+
118
+ def self.authors
119
+ ["jdouglas-nz"]
120
+ end
121
+
122
+ def self.is_supported?(platform)
123
+ %i[ios mac].include? platform
124
+ end
125
+ end
126
+ end
127
+ end