Sha256: 356d3d28124738d9195dc1ae5b970843ec28989d7f48864178e0b49f7f7bfdfa
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
module Fastlane module Actions module SharedValues BINARY_SIZE = :BINARY_SIZE end class GetBinarySizeAction < Action def self.run(config) Fastlane::Polidea.session.action_launched("get_binary_size", config) binary_file = config[:binary] UI.user_error!("No IPA or APK file path given, pass using `binary: 'ipa or apk path'`") unless binary_file.to_s.length > 0 binary_size = File.open(binary_file).size binary_size_in_mb = (binary_size / 1024.0 / 1024.0).round(2) Actions.lane_context[SharedValues::BINARY_SIZE] = binary_size ENV[SharedValues::BINARY_SIZE.to_s] = binary_size.to_s UI.success("Size of #{binary_file} is #{binary_size_in_mb} MB (#{binary_size} bytes)") Fastlane::Polidea.session.action_completed("get_binary_size") binary_size end def self.description "Measures binary size in bytes, use `extract_app_info` instead" end def self.available_options [ FastlaneCore::ConfigItem.new(key: :binary, env_name: "", description: ".ipa or .apk file from the build ", optional: true, default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]) ] end def self.output [ ['BINARY_SIZE', 'Size of .ipa/.apk in bytes'] ] end def self.author "Piotrek Dubiel" end def self.is_supported?(platform) [:ios, :android].include? platform end end end end
Version data entries
4 entries across 4 versions & 1 rubygems