class Fastlane::Actions::GetApplicationIdAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 30
def self.authors
  ['Helder Pinhal']
end
available_options() click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 45
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :cached_data,
                                 env_name: 'GRADLE_MANAGER_CACHED_DATA',
                                 description: 'The cached data from get_gradle_data. If not supplied then the action will try to fetch it',
                                 optional: true,
                                 type: Hash,
                                 default_value: nil),
    FastlaneCore::ConfigItem.new(key: :module_name,
                                 env_name: 'GRADLE_MANAGER_MODULE_NAME',
                                 description: 'The name of the application source folder in the Android project (default: app)',
                                 optional: true,
                                 type: String,
                                 default_value: 'app'),
    FastlaneCore::ConfigItem.new(key: :gradle_file_path,
                                 env_name: 'GRADLE_MANAGER_GRADLE_FILE_PATH',
                                 description: 'The relative path to the gradle file (default:app/build.gradle)',
                                 optional: true,
                                 type: String,
                                 default_value: nil),
    FastlaneCore::ConfigItem.new(key: :flavor_name,
                                 env_name: 'GRADLE_MANAGER_FLAVOR_NAME',
                                 description: 'The name of the product flavor',
                                 optional: true,
                                 type: String,
                                 default_value: nil)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 26
def self.description
  'Get the parsed Gradle file of an Android project.'
end
details() click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 38
def self.details
  [
    'Get the parsed Gradle file of an Android project.',
    'This action will return the parsed Gradle file based on the path you\'ve specified.'
  ].join('\n')
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 74
def self.is_supported?(platform)
  [:android].include?(platform)
end
return_value() click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 34
def self.return_value
  'Returns the parsed Gradle file.'
end
run(params) click to toggle source
# File lib/fastlane/plugin/gradle_manager/actions/get_application_id_action.rb, line 4
def self.run(params)
  flavor ||= params[:flavor_name]

  begin
    gradle_data ||= params[:cached_data]

    if gradle_data.nil?
      gradle_file_path = Helper::GradleFileFinderHelper.find_file(params)
      gradle_data = Helper::GradleParserHelper.parse(gradle_file_path)
    end

    application_id = Helper::GradleDataFinderHelper.find_property(gradle_data, :application_id, flavor)

    application_id_suffix = Helper::GradleDataFinderHelper.find_property(gradle_data, :application_id_suffix, flavor)
    application_id += application_id_suffix unless application_id_suffix.nil?

    return application_id
  rescue => err
    UI.error("An exception occurred while parsing the gradle file: #{err}")
  end
end