fastlane-plugin-gradle_manager 0.1.0 → 1.0.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.
- checksums.yaml +5 -5
- data/lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb +68 -0
- data/lib/fastlane/plugin/gradle_manager/actions/get_gradle_data_action.rb +17 -30
- data/lib/fastlane/plugin/gradle_manager/actions/get_version_code_action.rb +63 -0
- data/lib/fastlane/plugin/gradle_manager/actions/get_version_name_action.rb +63 -0
- data/lib/fastlane/plugin/gradle_manager/actions/shared_values.rb +11 -0
- data/lib/fastlane/plugin/gradle_manager/helper/gradle_data_finder_helper.rb +26 -0
- data/lib/fastlane/plugin/gradle_manager/helper/gradle_file_finder_helper.rb +23 -0
- data/lib/fastlane/plugin/gradle_manager/helper/gradle_parser_helper.rb +6 -6
- data/lib/fastlane/plugin/gradle_manager/version.rb +1 -1
- metadata +8 -3
- data/lib/fastlane/plugin/gradle_manager/helper/gradle_manager_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ba8b27a2f2f053f6df7bc175a6e93087dcc143289beefee74576e2a0c8094748
|
4
|
+
data.tar.gz: bf8b09d6dea9991b00ec9bb3963cbf1ba67a6a54d88c0fbd1fe02a090c1205dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e43986cf559a67d9fa8d7fb4a66c9666e3c4723d68c2e9a4d33dc0bd790e560ec281b39e3eade8b69a901b69c44156a8afca8615868e71240ea54b9c96aa50c
|
7
|
+
data.tar.gz: e7686db376c18aeb9f33e25d1d1079c946baf48228501e34f84abcd633aebd30f0827eb18e0901d943ce761587587b0843af16ee49bed5bb26ef1afd072142ad
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class GetApplicationIdAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
gradle_file_path = Helper::GradleFileFinderHelper.find_file(params)
|
6
|
+
flavor ||= params[:flavor_name]
|
7
|
+
|
8
|
+
begin
|
9
|
+
gradle_data = Helper::GradleParserHelper.parse(gradle_file_path)
|
10
|
+
application_id = Helper::GradleDataFinderHelper.find_property(gradle_data, :application_id, flavor)
|
11
|
+
|
12
|
+
application_id_suffix = Helper::GradleDataFinderHelper.find_property(gradle_data, :application_id_suffix, flavor)
|
13
|
+
application_id += application_id_suffix unless application_id_suffix.nil?
|
14
|
+
|
15
|
+
return application_id
|
16
|
+
rescue => err
|
17
|
+
UI.error("An exception occurred while parsing the gradle file: #{err}")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.description
|
22
|
+
'Get the parsed Gradle file of an Android project.'
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.authors
|
26
|
+
['Helder Pinhal']
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.return_value
|
30
|
+
'Returns the parsed Gradle file.'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.details
|
34
|
+
[
|
35
|
+
'Get the parsed Gradle file of an Android project.',
|
36
|
+
'This action will return the parsed Gradle file based on the path you\'ve specified.'
|
37
|
+
].join('\n')
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.available_options
|
41
|
+
[
|
42
|
+
FastlaneCore::ConfigItem.new(key: :module_name,
|
43
|
+
env_name: 'GRADLE_MANAGER_MODULE_NAME',
|
44
|
+
description: 'The name of the application source folder in the Android project (default: app)',
|
45
|
+
optional: true,
|
46
|
+
type: String,
|
47
|
+
default_value: 'app'),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
49
|
+
env_name: 'GRADLE_MANAGER_GRADLE_FILE_PATH',
|
50
|
+
description: 'The relative path to the gradle file (default:app/build.gradle)',
|
51
|
+
optional: true,
|
52
|
+
type: String,
|
53
|
+
default_value: nil),
|
54
|
+
FastlaneCore::ConfigItem.new(key: :flavor_name,
|
55
|
+
env_name: 'GRADLE_MANAGER_FLAVOR_NAME',
|
56
|
+
description: 'The name of the product flavor',
|
57
|
+
optional: true,
|
58
|
+
type: String,
|
59
|
+
default_value: nil)
|
60
|
+
]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.is_supported?(platform)
|
64
|
+
[:android].include?(platform)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -2,24 +2,11 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class GetGradleDataAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
gradle_file_path
|
6
|
-
|
7
|
-
if !gradle_file_path.nil?
|
8
|
-
UI.message("The gradle_manager plugin will use gradle file at (#{gradle_file_path})!")
|
9
|
-
else
|
10
|
-
module_folder_name = params[:module_folder_name]
|
11
|
-
UI.message("The gradle_manager plugin is looking inside your project folder (#{module_folder_name})!")
|
12
|
-
|
13
|
-
Dir.glob("**/#{module_folder_name}/build.gradle") do |path|
|
14
|
-
UI.message(" -> Found a build.gradle file at path: (#{path})!")
|
15
|
-
gradle_file_path = path
|
16
|
-
end
|
17
|
-
end
|
5
|
+
gradle_file_path = Helper::GradleFileFinderHelper.find_file(params)
|
18
6
|
|
19
7
|
begin
|
20
|
-
gradle_data = Helper::
|
21
|
-
|
22
|
-
Actions.lane_context['GRADLE_MANAGER_RAW_DATA'] = gradle_data
|
8
|
+
gradle_data = Helper::GradleParserHelper.parse(gradle_file_path)
|
9
|
+
Actions.lane_context[SharedValues::GM_RAW_DATA] = gradle_data
|
23
10
|
UI.success('👍 gradle data successfully parsed')
|
24
11
|
return gradle_data
|
25
12
|
rescue => err
|
@@ -41,25 +28,25 @@ module Fastlane
|
|
41
28
|
|
42
29
|
def self.details
|
43
30
|
[
|
44
|
-
|
45
|
-
|
31
|
+
'Get the parsed Gradle file of an Android project.',
|
32
|
+
'This action will return the parsed Gradle file based on the path you\'ve specified.'
|
46
33
|
].join('\n')
|
47
34
|
end
|
48
35
|
|
49
36
|
def self.available_options
|
50
37
|
[
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
38
|
+
FastlaneCore::ConfigItem.new(key: :module_name,
|
39
|
+
env_name: 'GRADLE_MANAGER_MODULE_NAME',
|
40
|
+
description: 'The name of the application source folder in the Android project (default: app)',
|
41
|
+
optional: true,
|
42
|
+
type: String,
|
43
|
+
default_value: 'app'),
|
44
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
45
|
+
env_name: 'GRADLE_MANAGER_GRADLE_FILE_PATH',
|
46
|
+
description: 'The relative path to the gradle file (default:app/build.gradle)',
|
47
|
+
optional: true,
|
48
|
+
type: String,
|
49
|
+
default_value: nil)
|
63
50
|
]
|
64
51
|
end
|
65
52
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class GetVersionCodeAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
gradle_file_path = Helper::GradleFileFinderHelper.find_file(params)
|
6
|
+
flavor ||= params[:flavor_name]
|
7
|
+
|
8
|
+
begin
|
9
|
+
gradle_data = Helper::GradleParserHelper.parse(gradle_file_path)
|
10
|
+
return Helper::GradleDataFinderHelper.find_property(gradle_data, :version_code, flavor)
|
11
|
+
rescue => err
|
12
|
+
UI.error("An exception occurred while parsing the gradle file: #{err}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.description
|
17
|
+
'Get the parsed Gradle file of an Android project.'
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.authors
|
21
|
+
['Helder Pinhal']
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.return_value
|
25
|
+
'Returns the parsed Gradle file.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.details
|
29
|
+
[
|
30
|
+
'Get the parsed Gradle file of an Android project.',
|
31
|
+
'This action will return the parsed Gradle file based on the path you\'ve specified.'
|
32
|
+
].join('\n')
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :module_name,
|
38
|
+
env_name: 'GRADLE_MANAGER_MODULE_NAME',
|
39
|
+
description: 'The name of the application source folder in the Android project (default: app)',
|
40
|
+
optional: true,
|
41
|
+
type: String,
|
42
|
+
default_value: 'app'),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
44
|
+
env_name: 'GRADLE_MANAGER_GRADLE_FILE_PATH',
|
45
|
+
description: 'The relative path to the gradle file (default:app/build.gradle)',
|
46
|
+
optional: true,
|
47
|
+
type: String,
|
48
|
+
default_value: nil),
|
49
|
+
FastlaneCore::ConfigItem.new(key: :flavor_name,
|
50
|
+
env_name: 'GRADLE_MANAGER_FLAVOR_NAME',
|
51
|
+
description: 'The name of the product flavor',
|
52
|
+
optional: true,
|
53
|
+
type: String,
|
54
|
+
default_value: nil)
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.is_supported?(platform)
|
59
|
+
[:android].include?(platform)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class GetVersionNameAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
gradle_file_path = Helper::GradleFileFinderHelper.find_file(params)
|
6
|
+
flavor ||= params[:flavor_name]
|
7
|
+
|
8
|
+
begin
|
9
|
+
gradle_data = Helper::GradleParserHelper.parse(gradle_file_path)
|
10
|
+
return Helper::GradleDataFinderHelper.find_property(gradle_data, :version_name, flavor)
|
11
|
+
rescue => err
|
12
|
+
UI.error("An exception occurred while parsing the gradle file: #{err}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.description
|
17
|
+
'Get the parsed Gradle file of an Android project.'
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.authors
|
21
|
+
['Helder Pinhal']
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.return_value
|
25
|
+
'Returns the parsed Gradle file.'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.details
|
29
|
+
[
|
30
|
+
'Get the parsed Gradle file of an Android project.',
|
31
|
+
'This action will return the parsed Gradle file based on the path you\'ve specified.'
|
32
|
+
].join('\n')
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :module_name,
|
38
|
+
env_name: 'GRADLE_MANAGER_MODULE_NAME',
|
39
|
+
description: 'The name of the application source folder in the Android project (default: app)',
|
40
|
+
optional: true,
|
41
|
+
type: String,
|
42
|
+
default_value: 'app'),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
44
|
+
env_name: 'GRADLE_MANAGER_GRADLE_FILE_PATH',
|
45
|
+
description: 'The relative path to the gradle file (default:app/build.gradle)',
|
46
|
+
optional: true,
|
47
|
+
type: String,
|
48
|
+
default_value: nil),
|
49
|
+
FastlaneCore::ConfigItem.new(key: :flavor_name,
|
50
|
+
env_name: 'GRADLE_MANAGER_FLAVOR_NAME',
|
51
|
+
description: 'The name of the product flavor',
|
52
|
+
optional: true,
|
53
|
+
type: String,
|
54
|
+
default_value: nil)
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.is_supported?(platform)
|
59
|
+
[:android].include?(platform)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
GM_RAW_DATA = :GM_RAW_DATA
|
5
|
+
GM_APPLICATION_ID = :GM_APPLICATION_ID
|
6
|
+
GM_APPLICATION_ID_SUFFIX = :GM_APPLICATION_ID_SUFFIX
|
7
|
+
GM_VERSION_CODE = :GM_VERSION_CODE
|
8
|
+
GM_VERSION_NAME = :GM_VERSION_NAME
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
module GradleDataFinderHelper
|
4
|
+
def self.find_property(gradle_data, property_key, flavor = nil)
|
5
|
+
value = nil
|
6
|
+
|
7
|
+
if gradle_data.key?(:default_config)
|
8
|
+
if gradle_data[:default_config].key?(property_key)
|
9
|
+
value = gradle_data[:default_config][property_key]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
if !flavor.nil? && gradle_data.key?(:product_flavors)
|
14
|
+
if gradle_data[:product_flavors].key?(flavor)
|
15
|
+
flavor_hash = gradle_data[:product_flavors][flavor]
|
16
|
+
if flavor_hash.key?(property_key)
|
17
|
+
value = flavor_hash[property_key]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
return value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
module GradleFileFinderHelper
|
4
|
+
def self.find_file(params)
|
5
|
+
gradle_file_path ||= params[:gradle_file_path]
|
6
|
+
|
7
|
+
if !gradle_file_path.nil?
|
8
|
+
UI.message("The gradle_manager plugin will use gradle file at (#{gradle_file_path})!")
|
9
|
+
else
|
10
|
+
module_name = params[:module_name]
|
11
|
+
UI.message("The gradle_manager plugin is looking inside your project folder (#{module_name})!")
|
12
|
+
|
13
|
+
Dir.glob("**/#{module_name}/build.gradle") do |path|
|
14
|
+
UI.message(" -> Found a build.gradle file at path: (#{path})!")
|
15
|
+
gradle_file_path = path
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
return gradle_file_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -21,7 +21,7 @@ module Fastlane
|
|
21
21
|
return @result
|
22
22
|
end
|
23
23
|
|
24
|
-
def reset
|
24
|
+
def self.reset
|
25
25
|
@reading_default_config = false
|
26
26
|
@reading_product_flavors = false
|
27
27
|
@reading_product_flavor_block = false
|
@@ -29,13 +29,13 @@ module Fastlane
|
|
29
29
|
@result = {}
|
30
30
|
end
|
31
31
|
|
32
|
-
def handle_line(line)
|
32
|
+
def self.handle_line(line)
|
33
33
|
if line.include? 'defaultConfig'
|
34
34
|
@result[:default_config] = {}
|
35
35
|
@reading_default_config = true
|
36
36
|
elsif line.include? 'productFlavors'
|
37
37
|
@result[:product_flavors] = {}
|
38
|
-
@
|
38
|
+
@reading_product_flavors = true
|
39
39
|
@current_indent = 0
|
40
40
|
elsif @reading_default_config
|
41
41
|
handle_default_config(line)
|
@@ -46,7 +46,7 @@ module Fastlane
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def handle_default_config(line)
|
49
|
+
def self.handle_default_config(line)
|
50
50
|
trimmed = line.strip
|
51
51
|
|
52
52
|
if trimmed == '}'
|
@@ -72,7 +72,7 @@ module Fastlane
|
|
72
72
|
@result[:default_config][symbol] = components[components.length - 1].tr('\"', '')
|
73
73
|
end
|
74
74
|
|
75
|
-
def handle_product_flavors(line)
|
75
|
+
def self.handle_product_flavors(line)
|
76
76
|
trimmed = line.strip
|
77
77
|
|
78
78
|
if trimmed == '}'
|
@@ -90,7 +90,7 @@ module Fastlane
|
|
90
90
|
@reading_product_flavor_block = true
|
91
91
|
end
|
92
92
|
|
93
|
-
def handle_product_flavor_block(line)
|
93
|
+
def self.handle_product_flavor_block(line)
|
94
94
|
trimmed = line.strip
|
95
95
|
|
96
96
|
if trimmed == '}'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-gradle_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Helder Pinhal
|
@@ -131,8 +131,13 @@ files:
|
|
131
131
|
- LICENSE
|
132
132
|
- README.md
|
133
133
|
- lib/fastlane/plugin/gradle_manager.rb
|
134
|
+
- lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb
|
134
135
|
- lib/fastlane/plugin/gradle_manager/actions/get_gradle_data_action.rb
|
135
|
-
- lib/fastlane/plugin/gradle_manager/
|
136
|
+
- lib/fastlane/plugin/gradle_manager/actions/get_version_code_action.rb
|
137
|
+
- lib/fastlane/plugin/gradle_manager/actions/get_version_name_action.rb
|
138
|
+
- lib/fastlane/plugin/gradle_manager/actions/shared_values.rb
|
139
|
+
- lib/fastlane/plugin/gradle_manager/helper/gradle_data_finder_helper.rb
|
140
|
+
- lib/fastlane/plugin/gradle_manager/helper/gradle_file_finder_helper.rb
|
136
141
|
- lib/fastlane/plugin/gradle_manager/helper/gradle_parser_helper.rb
|
137
142
|
- lib/fastlane/plugin/gradle_manager/version.rb
|
138
143
|
homepage: https://github.com/hpinhal/fastlane-plugin-gradle-manager
|
@@ -155,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
160
|
version: '0'
|
156
161
|
requirements: []
|
157
162
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
163
|
+
rubygems_version: 2.7.2
|
159
164
|
signing_key:
|
160
165
|
specification_version: 4
|
161
166
|
summary: Exposes some Android configurations from the gradle file.
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Fastlane
|
2
|
-
module Helper
|
3
|
-
class GradleManagerHelper
|
4
|
-
# class methods that you define here become available in your action
|
5
|
-
# as `Helper::GradleManagerHelper.your_method`
|
6
|
-
#
|
7
|
-
def self.show_message
|
8
|
-
UI.message("Hello from the gradle_manager plugin helper!")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|