Sha256: 23e2febde22e09ed228985d31d5c8987198f5819c8bee1fa8d37739de07a481a
Contents?: true
Size: 1.52 KB
Versions: 18
Compression:
Stored size: 1.52 KB
Contents
module Fastlane module Actions module SharedValues BINARY_SIZE = :BINARY_SIZE end class GetBinarySizeAction < Action def self.run(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)") binary_size end def self.description "Measures binary size in bytes" 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
18 entries across 18 versions & 1 rubygems