fastlane-plugin-flutter 0.1.16 → 0.2.0

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
2
  SHA1:
3
- metadata.gz: 242d1757ff287f1f08427ecc5414a6f2ffec1d89
4
- data.tar.gz: 626f6a78ee15291a0bd45113aa212eedfaaca6d7
3
+ metadata.gz: f0cb39c89f3fbcde4fcf59cfc54c1db29e892422
4
+ data.tar.gz: 52b6ca96f4a4d9ce291456fd657a8a93864fc16d
5
5
  SHA512:
6
- metadata.gz: e894a556b6a010514d3061915c9ede118a28598764d5c9291261faf60e4fc746dc1631d372976ab7f8ca231da04703c6f0c30908fe9bec1d5853cb6440af3a12
7
- data.tar.gz: c8dd712748c078b8ec48ebf818cc01460d88884f476fa7e48178fb813058df16061373f25f7fbe2eb719c7ed7320221bc81d89141c78be419f6360bca8e8a140
6
+ metadata.gz: 402189c1cad467be3634c24bcf08773364a448da9f8c3be6481d9392a00be8b2cdd25a0831182f707801716ff86d35632662a3dda8407ea1dba9d9ddeb2ec01d
7
+ data.tar.gz: d6dbd28f31bb8e3f730c63727734ab23a412c97383d603155436b8912abe9cf47e907aa551de066eded33c5b0696ad26f928920dfbdb280c294ff3236c513247
@@ -9,8 +9,9 @@ module Fastlane
9
9
  module SharedValues
10
10
  FLUTTER_OUTPUT_APP = :FLUTTER_OUTPUT_APP
11
11
  FLUTTER_OUTPUT_APK = :FLUTTER_OUTPUT_APK
12
- FLUTTER_OUTPUT_GIT_BUILD_NUMBER = :FLUTTER_OUTPUT_GIT_BUILD_NUMBER
13
- FLUTTER_OUTPUT_GIT_BUILD_NAME = :FLUTTER_OUTPUT_GIT_BUILD_NAME
12
+ FLUTTER_OUTPUT_BUILD_NUMBER_OVERRIDE =
13
+ :FLUTTER_OUTPUT_BUILD_NUMBER_OVERRIDE
14
+ FLUTTER_OUTPUT_BUILD_NAME_OVERRIDE = :FLUTTER_OUTPUT_BUILD_NAME_OVERRIDE
14
15
  end
15
16
 
16
17
  class FlutterAction < Action
@@ -38,21 +39,17 @@ module Fastlane
38
39
  additional_args = []
39
40
  additional_args.push('--debug') if params[:debug]
40
41
 
41
- if params[:git_version]
42
- build_number = sh(*%w(git rev-list --count HEAD)).strip.to_i
43
- lane_context[SharedValues::FLUTTER_OUTPUT_GIT_BUILD_NUMBER] =
44
- build_number
42
+ if lane_context[SharedValues::FLUTTER_OUTPUT_BUILD_NUMBER_OVERRIDE] =
43
+ build_number = Helper::FlutterHelper.build_number(
44
+ params[:build_number_override]
45
+ )
45
46
  additional_args.push('--build-number', build_number.to_s)
47
+ end
46
48
 
47
- build_name = sh(
48
- *%W(
49
- git describe
50
- --tags
51
- --dirty=#{params[:git_version_dirty_mark]}
52
- )
53
- ).strip
54
- lane_context[SharedValues::FLUTTER_OUTPUT_GIT_BUILD_NAME] =
55
- build_name
49
+ if lane_context[SharedValues::FLUTTER_OUTPUT_BUILD_NAME_OVERRIDE] =
50
+ build_name = Helper::FlutterHelper.build_name(
51
+ params[:build_name_override]
52
+ )
56
53
  additional_args.push('--build-name', build_name)
57
54
  end
58
55
 
@@ -204,19 +201,46 @@ module Fastlane
204
201
  default_value: false,
205
202
  ),
206
203
  FastlaneCore::ConfigItem.new(
207
- key: :git_version,
208
- env_name: 'FL_FLUTTER_GIT_VERSION',
209
- description: 'Set build number and name based on Git',
204
+ key: :build_number_override,
205
+ env_name: 'FL_FLUTTER_BUILD_NUMBER_OVERRIDE',
206
+ description: <<-'DESCRIPTION',
207
+ Override build number in pubspec.yaml. Can be either a number, or
208
+ a schema definition, ex.: ci (take from CI) vcs (take from Git),
209
+ ci+1000 (take from CI and add 1000).
210
+ WARNING: does not override Android build number specified in
211
+ pubspec.yaml due to Flutter bug:
212
+ https://github.com/flutter/flutter/issues/22788.
213
+ DESCRIPTION
210
214
  optional: true,
211
- is_string: false,
212
- default_value: false,
215
+ verify_block: proc do |value|
216
+ begin
217
+ Helper::FlutterHelper.build_number(value)
218
+ rescue ArgumentError => e
219
+ UI.user_error!(e.message)
220
+ end
221
+ end,
213
222
  ),
214
223
  FastlaneCore::ConfigItem.new(
215
- key: :git_version_dirty_mark,
216
- env_name: 'FL_FLUTTER_GIT_VERSION_DIRTY_MARK',
217
- description: 'Append mark if the working tree is "dirty"',
224
+ key: :build_name_override,
225
+ env_name: 'FL_FLUTTER_BUILD_NAME_OVERRIDE',
226
+ description: <<-'DESCRIPTION',
227
+ Override build name in pubspec.yaml. Can be either a string, or a
228
+ schema definition, ex.: vcs* (take from VCS, add "*" for dirty
229
+ tree), vcs (take from VCS, no dirty mark).
230
+ NOTE: for App Store, must be in the format of at most 3 integeres
231
+ separated by a dot (".").
232
+ WARNING: does not override Android build number specified in
233
+ pubspec.yaml due to Flutter bug:
234
+ https://github.com/flutter/flutter/issues/22788.
235
+ DESCRIPTION
218
236
  optional: true,
219
- default_value: '*',
237
+ verify_block: proc do |value|
238
+ begin
239
+ Helper::FlutterHelper.build_name(value)
240
+ rescue ArgumentError => e
241
+ UI.user_error!(e.message)
242
+ end
243
+ end,
220
244
  ),
221
245
  # l10n settings
222
246
  FastlaneCore::ConfigItem.new(
@@ -57,6 +57,40 @@ module Fastlane
57
57
  end
58
58
  differencies
59
59
  end
60
+
61
+ def self.build_number(schema)
62
+ schema and Integer(schema)
63
+ rescue ArgumentError
64
+ build_number_source, build_number_base = schema.split('+', 2)
65
+
66
+ case build_number_source
67
+ when 'vcs'
68
+ build_number = Integer(sh(*%w(git rev-list --count HEAD)).strip)
69
+ when 'ci'
70
+ begin
71
+ build_number = Integer(ENV['TRAVIS_BUILD_NUMBER'] ||
72
+ ENV['CIRCLE_BUILD_NUM'])
73
+ rescue ArgumentError
74
+ raise if ENV.key?('CI')
75
+ raise ArgumentError, 'CI version requested, but not running on a CI'
76
+ end
77
+ end
78
+
79
+ if build_number_base
80
+ build_number + Integer(build_number_base)
81
+ else
82
+ build_number
83
+ end
84
+ end
85
+
86
+ def self.build_name(schema)
87
+ if schema && schema.start_with?('vcs')
88
+ dirty_mark = schema['vcs'.size..-1]
89
+ sh(*%W(git describe --tags --dirty=#{dirty_mark})).strip
90
+ else
91
+ schema
92
+ end
93
+ end
60
94
  end
61
95
  end
62
96
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Flutter
3
- VERSION = "0.1.16"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Sheremet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-08 00:00:00.000000000 Z
11
+ date: 2018-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry