fastlane-plugin-android_versioning 0.3.1 → 0.5.4
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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/fastlane/plugin/android_versioning/actions/get_value_from_build.rb +30 -3
- data/lib/fastlane/plugin/android_versioning/actions/get_version_code.rb +7 -1
- data/lib/fastlane/plugin/android_versioning/actions/get_version_name.rb +7 -1
- data/lib/fastlane/plugin/android_versioning/actions/increment_version_code.rb +27 -12
- data/lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb +6 -0
- data/lib/fastlane/plugin/android_versioning/actions/set_value_in_build.rb +30 -4
- data/lib/fastlane/plugin/android_versioning/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b18ed0f97fbda93363f1a8bc6a17f088f371925e
|
4
|
+
data.tar.gz: 8d3a32e846a7ab93d4bba16934e07ddc095ad644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95f9076481db3b049d168028332d04317a2ee2e0cbc703f3bec50a8c569a13ef06f683f319a0b3070d19d85937fa71cdac9d018a468e4a0e92ce55c569cd3059
|
7
|
+
data.tar.gz: 62c6d541464f545696747fa56934b849e394ff06a4a7bbf3355ae0429b0f35611de45149d866bc436825e5e5c5bd8122f469ecd86cd969620b6b49d86127da17
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-android_versioning)
|
4
4
|
[](https://badge.fury.io/rb/fastlane-plugin-android_versioning)
|
5
|
+
[](https://circleci.com/gh/otkmnb2783/fastlane-plugin-android_versioning)
|
5
6
|
|
6
7
|
## Getting Started
|
7
8
|
|
@@ -19,7 +20,7 @@ Allows to set/get app version name and version code directly to/from build.gradl
|
|
19
20
|
|
20
21
|
## Example
|
21
22
|
|
22
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane
|
23
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane show_version`.
|
23
24
|
|
24
25
|
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
25
26
|
|
@@ -5,17 +5,39 @@ module Fastlane
|
|
5
5
|
class GetValueFromBuildAction < Action
|
6
6
|
def self.run(params)
|
7
7
|
app_project_dir ||= params[:app_project_dir]
|
8
|
+
regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
|
9
|
+
flavor = params[:flavor]
|
10
|
+
flavorSpecified = !(flavor.nil? or flavor.empty?)
|
11
|
+
regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
|
8
12
|
value = ""
|
9
13
|
found = false
|
14
|
+
flavorFound = false
|
15
|
+
productFlavorsSection = false
|
10
16
|
Dir.glob("#{app_project_dir}/build.gradle") do |path|
|
17
|
+
UI.verbose("path: #{path}")
|
18
|
+
UI.verbose("absolute_path: #{File.expand_path(path)}")
|
11
19
|
begin
|
12
20
|
File.open(path, 'r') do |file|
|
13
21
|
file.each_line do |line|
|
14
|
-
|
22
|
+
|
23
|
+
if flavorSpecified and !productFlavorsSection
|
24
|
+
unless line.include? "productFlavors"
|
25
|
+
next
|
26
|
+
end
|
27
|
+
productFlavorsSection = true
|
28
|
+
end
|
29
|
+
|
30
|
+
if flavorSpecified and !flavorFound
|
31
|
+
unless line.match(regex_flavor)
|
32
|
+
next
|
33
|
+
end
|
34
|
+
flavorFound = true
|
35
|
+
end
|
36
|
+
|
37
|
+
unless line.match(regex) and !found
|
15
38
|
next
|
16
39
|
end
|
17
|
-
|
18
|
-
value = components.last.tr("\"", "").tr("\'", "")
|
40
|
+
key, left, value, right, comment = line.match(regex).captures
|
19
41
|
break
|
20
42
|
end
|
21
43
|
file.close
|
@@ -36,6 +58,11 @@ module Fastlane
|
|
36
58
|
optional: true,
|
37
59
|
type: String,
|
38
60
|
default_value: "android/app"),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
62
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
63
|
+
description: "The product flavor name (optional)",
|
64
|
+
optional: true,
|
65
|
+
type: String),
|
39
66
|
FastlaneCore::ConfigItem.new(key: :key,
|
40
67
|
description: "The property key",
|
41
68
|
type: String)
|
@@ -6,6 +6,7 @@ module Fastlane
|
|
6
6
|
def self.run(params)
|
7
7
|
GetValueFromBuildAction.run(
|
8
8
|
app_project_dir: params[:app_project_dir],
|
9
|
+
flavor: params[:flavor],
|
9
10
|
key: "versionCode"
|
10
11
|
)
|
11
12
|
end
|
@@ -20,7 +21,12 @@ module Fastlane
|
|
20
21
|
description: "The path to the application source folder in the Android project (default: android/app)",
|
21
22
|
optional: true,
|
22
23
|
type: String,
|
23
|
-
default_value: "android/app")
|
24
|
+
default_value: "android/app"),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
26
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
27
|
+
description: "The product flavor name (optional)",
|
28
|
+
optional: true,
|
29
|
+
type: String)
|
24
30
|
]
|
25
31
|
end
|
26
32
|
|
@@ -6,6 +6,7 @@ module Fastlane
|
|
6
6
|
def self.run(params)
|
7
7
|
GetValueFromBuildAction.run(
|
8
8
|
app_project_dir: params[:app_project_dir],
|
9
|
+
flavor: params[:flavor],
|
9
10
|
key: "versionName"
|
10
11
|
)
|
11
12
|
end
|
@@ -20,7 +21,12 @@ module Fastlane
|
|
20
21
|
description: "The path to the application source folder in the Android project (default: android/app)",
|
21
22
|
optional: true,
|
22
23
|
type: String,
|
23
|
-
default_value: "android/app")
|
24
|
+
default_value: "android/app"),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
26
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
27
|
+
description: "The product flavor name (optional)",
|
28
|
+
optional: true,
|
29
|
+
type: String)
|
24
30
|
]
|
25
31
|
end
|
26
32
|
|
@@ -9,9 +9,19 @@ module Fastlane
|
|
9
9
|
class IncrementVersionCodeAction < Action
|
10
10
|
def self.run(params)
|
11
11
|
current_version_code = GetVersionCodeAction.run(params)
|
12
|
-
|
12
|
+
|
13
|
+
new_version_code =
|
14
|
+
if params[:version_code].nil?
|
15
|
+
current_version_code.to_i + 1
|
16
|
+
elsif params[:version_code] == -1
|
17
|
+
((Time.now.to_f * 1000).to_i / (60 * 1000)).to_i
|
18
|
+
else
|
19
|
+
params[:version_code].to_i
|
20
|
+
end
|
21
|
+
|
13
22
|
SetValueInBuildAction.run(
|
14
23
|
app_project_dir: params[:app_project_dir],
|
24
|
+
flavor: params[:flavor],
|
15
25
|
key: "versionCode",
|
16
26
|
value: new_version_code
|
17
27
|
)
|
@@ -24,17 +34,22 @@ module Fastlane
|
|
24
34
|
#####################################################
|
25
35
|
def self.available_options
|
26
36
|
[
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
38
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
39
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
40
|
+
optional: true,
|
41
|
+
type: String,
|
42
|
+
default_value: "android/app"),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
44
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
45
|
+
description: "The product flavor name (optional)",
|
46
|
+
optional: true,
|
47
|
+
type: String),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :version_code,
|
49
|
+
env_name: "ANDROID_VERSIONING_VERSION_CODE",
|
50
|
+
description: "Change to a specific version (optional)",
|
51
|
+
optional: true,
|
52
|
+
type: Integer)
|
38
53
|
]
|
39
54
|
end
|
40
55
|
|
@@ -31,6 +31,7 @@ module Fastlane
|
|
31
31
|
end
|
32
32
|
SetValueInBuildAction.run(
|
33
33
|
app_project_dir: params[:app_project_dir],
|
34
|
+
flavor: params[:flavor],
|
34
35
|
key: "versionName",
|
35
36
|
value: new_version
|
36
37
|
)
|
@@ -49,6 +50,11 @@ module Fastlane
|
|
49
50
|
optional: true,
|
50
51
|
type: String,
|
51
52
|
default_value: "android/app"),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
54
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
55
|
+
description: "The product flavor name (optional)",
|
56
|
+
optional: true,
|
57
|
+
type: String),
|
52
58
|
FastlaneCore::ConfigItem.new(key: :bump_type,
|
53
59
|
env_name: "ANDROID_VERSIONING_BUMP_TYPE",
|
54
60
|
description: "Change to a specific type (optional)",
|
@@ -6,19 +6,40 @@ module Fastlane
|
|
6
6
|
class SetValueInBuildAction < Action
|
7
7
|
def self.run(params)
|
8
8
|
app_project_dir ||= params[:app_project_dir]
|
9
|
+
regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
|
10
|
+
flavor = params[:flavor]
|
11
|
+
flavorSpecified = !(flavor.nil? or flavor.empty?)
|
12
|
+
regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
|
9
13
|
found = false
|
14
|
+
productFlavorsSection = false
|
15
|
+
flavorFound = false
|
10
16
|
Dir.glob("#{app_project_dir}/build.gradle") do |path|
|
11
17
|
begin
|
12
18
|
temp_file = Tempfile.new('versioning')
|
13
19
|
File.open(path, 'r') do |file|
|
14
20
|
file.each_line do |line|
|
15
|
-
|
21
|
+
|
22
|
+
if flavorSpecified and !productFlavorsSection
|
23
|
+
unless line.include? "productFlavors" or productFlavorsSection
|
24
|
+
temp_file.puts line
|
25
|
+
next
|
26
|
+
end
|
27
|
+
productFlavorsSection = true
|
28
|
+
end
|
29
|
+
|
30
|
+
if flavorSpecified and !flavorFound
|
31
|
+
unless line.match(regex_flavor)
|
32
|
+
temp_file.puts line
|
33
|
+
next
|
34
|
+
end
|
35
|
+
flavorFound = true
|
36
|
+
end
|
37
|
+
|
38
|
+
unless line.match(regex) and !found
|
16
39
|
temp_file.puts line
|
17
40
|
next
|
18
41
|
end
|
19
|
-
|
20
|
-
value = components.last.tr("\"", "").tr("\'", "")
|
21
|
-
line.replace line.sub(value, params[:value].to_s)
|
42
|
+
line = line.gsub regex, "\\k<key>\\k<left>#{params[:value]}\\k<right>\\k<comment>"
|
22
43
|
found = true
|
23
44
|
temp_file.puts line
|
24
45
|
end
|
@@ -43,6 +64,11 @@ module Fastlane
|
|
43
64
|
optional: true,
|
44
65
|
type: String,
|
45
66
|
default_value: "android/app"),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
68
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
69
|
+
description: "The product flavor name (optional)",
|
70
|
+
optional: true,
|
71
|
+
type: String),
|
46
72
|
FastlaneCore::ConfigItem.new(key: :key,
|
47
73
|
description: "The property key",
|
48
74
|
type: String),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-android_versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu OHTAKE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.6.14.1
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Allows to set/get app version name and version code directly to/from build.gradle
|