Class: Fastlane::Actions::AndroidIncrementVersionCodeAction
- Inherits:
-
AndroidBaseAction
show all
- Defined in:
- lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb
Class Method Summary
collapse
app_project_dir_action, authors, find_build_gradle, is_supported?
Class Method Details
.available_options ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 46
def self.available_options
[
app_project_dir_action,
FastlaneCore::ConfigItem.new(key: :key,
env_name: "FL_ANDROID_INCREMENT_VERSION_CODE_KEY",
description: "The property key",
optional: true,
type: String,
default_value: "versionCode"),
FastlaneCore::ConfigItem.new(key: :version_code,
env_name: "FL_ANDROID_GET_VERSION_CODE_VERSION_CODE",
description: "Change to a specific version instead of just incrementing",
optional: true,
is_string: false),
]
end
|
.category ⇒ Object
69
70
71
72
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 69
def self.category
:project
end
|
.description ⇒ Object
38
39
40
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 38
def self.description
"Increments the version code of the android project"
end
|
.details ⇒ Object
42
43
44
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 42
def self.details
"Based on the provided params, increments the version code and returns their new value"
end
|
.output ⇒ Object
63
64
65
66
67
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 63
def self.output
[
["ANDROID_VERSION_CODE", "The new version code"],
]
end
|
.return_type ⇒ Object
88
89
90
91
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 88
def self.return_type
:int
end
|
.return_value ⇒ Object
def self.example_code
[
'version = android_increment_version_code(xcodeproj: "Project.xcodeproj")',
'version = android_increment_version_code(
xcodeproj: "Project.xcodeproj",
target: "App"
)'
]
end
84
85
86
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 84
def self.return_value
"The Android app new version code"
end
|
.run(params) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 12
def self.run(params)
UI.message("Param app_project_dir: #{params[:app_project_dir]}")
UI.message("Param version_code: #{params[:version_code]}")
UI.message("Param key: #{params[:key]}")
file_path = find_build_gradle(params[:app_project_dir])
version_code = Helper::AndroidVersionManagerHelper.get_version_code_from_gradle_file(file_path, params[:key])
new_version_code = params[:version_code] || version_code + 1
if new_version_code <= version_code
UI.user_error!("New version code must be greater than the current one")
end
Helper::AndroidVersionManagerHelper.set_key_value_on_gradle_file(file_path, params[:key], new_version_code)
Actions.lane_context[Fastlane::Actions::SharedValues::ANDROID_VERSION_CODE] = new_version_code
return new_version_code
end
|