Class: Fastlane::Actions::AndroidIncrementVersionCodeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AndroidIncrementVersionCodeAction
- Defined in:
- lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_type ⇒ Object
-
.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.
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
102 103 104 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 102 def self. ["Jonathan Cardoso", "@_jonathancardos", "JCMais"] end |
.available_options ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 46 def self. [ FastlaneCore::ConfigItem.new(key: :app_project_dir, env_name: "FL_ANDROID_INCREMENT_VERSION_CODE_APP_PROJECT_DIR", description: "The path to the application source folder in the Android project (default: android/app)", optional: true, type: String, default_value: "android/app", verify_block: proc do |value| # Not using File.exist?("#{value}/build.gradle") because it does not handle globs UI.user_error!("Couldn't find build.gradle file at path '#{value}'") unless Dir["#{value}/build.gradle"].any? end), 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
78 79 80 81 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 78 def self.category # https://github.com/fastlane/fastlane/blob/051e5012984d97257571a76627c1261946afb8f8/fastlane/lib/fastlane/action.rb#L6-L21 :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 |
.is_supported?(platform) ⇒ Boolean
106 107 108 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 106 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
72 73 74 75 76 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 72 def self.output [ ["ANDROID_VERSION_CODE", "The new version code"], ] end |
.return_type ⇒ Object
97 98 99 100 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 97 def self.return_type # https://github.com/fastlane/fastlane/blob/051e5012984d97257571a76627c1261946afb8f8/fastlane/lib/fastlane/action.rb#L23-L30 :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
93 94 95 |
# File 'lib/fastlane/plugin/android_version_manager/actions/android_increment_version_code_action.rb', line 93 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.("Param app_project_dir: #{params[:app_project_dir]}") UI.("Param version_code: #{params[:version_code]}") UI.("Param key: #{params[:key]}") file_path = "#{params[:app_project_dir]}/build.gradle" # We can expect version_code to be an existing and valid version code 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 |