Class: Fastlane::BinaryChecker
- Inherits:
-
Object
- Object
- Fastlane::BinaryChecker
- Defined in:
- lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb
Instance Method Summary collapse
- #check_architectures(required_archs) ⇒ Object
- #check_bitcode_availability ⇒ Object
- #check_coverage_symbols ⇒ Object
- #check_debug_symbols ⇒ Object
- #check_encryption ⇒ Object
- #check_for_assertion ⇒ Object
- #check_for_flagged_tests ⇒ Object
- #check_profiling_data ⇒ Object
-
#initialize(file_path) ⇒ BinaryChecker
constructor
A new instance of BinaryChecker.
Constructor Details
#initialize(file_path) ⇒ BinaryChecker
Returns a new instance of BinaryChecker.
6 7 8 9 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 6 def initialize(file_path) UI.verbose("Initialized new checker") @file_path = file_path end |
Instance Method Details
#check_architectures(required_archs) ⇒ Object
11 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/checkbuild/actions/checkbuild_action.rb', line 11 def check_architectures(required_archs) UI.verbose("Checking architectures...") lipo = %x( command -v lipo ).strip if lipo != "" then command = lipo + " -info " + @file_path result = `#{command}` required_archs.chunk { |arch| result[arch] != nil }.each { |found, arch| if found == false then UI.error("Non fat file, missing #{arch}") return elsif found == true then UI.success("Found all necessary architectures! #{arch}") return end } else UI.error("Command lipo not found!") end end |
#check_bitcode_availability ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 85 def check_bitcode_availability UI.verbose("Check if bitcode is available") otool = %x( command -v otool ).strip if otool != "" then command = otool + " -arch arm64 -l " + @file_path result = `#{command}` contains_llvm = false if result.include? "__LLVM" then contains_llvm = true end contains_filesize = false if result.include? "filesize" # TODO contains_filesize = true end if contains_llvm && contains_filesize then UI.("Bitcode active!") else UI.("Bitcode inactive!") end else UI.error("Command otool not found!") end end |
#check_coverage_symbols ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 34 def check_coverage_symbols UI.verbose("Check for coverage symbols...") otool = %x( command -v otool ).strip if otool != "" then command = otool + " -l -arch all " + @file_path result = `#{command}` if result.include? "__llvm_cov" then UI.error("File contains coverage symbols!") else UI.success("File does not contain any coverage symbols!") end else UI.error("Command otool not found!") end end |
#check_debug_symbols ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 130 def check_debug_symbols UI.verbose("Check for debug symbols") nm = %x( command -v nm ).strip if nm != "" then command1 = nm + " " + @file_path command2 = nm + " -a " + @file_path slimDump = `#{command1}` fatDump = `#{command2}` # TODO end end |
#check_encryption ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 68 def check_encryption UI.verbose("Check encryption info...") otool = %x( command -v otool ).strip if otool != "" then command = otool + " -l " + @file_path result = `#{command}` if result.include? "LC_ENCRYPTION_INFO" then UI.("File contains encryption info!") else UI.("File does not contain any encryption info!") end else UI.error("Command otool not found!") end end |
#check_for_assertion ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 113 def check_for_assertion UI.verbose("Check for assertions...") nm = %x( command -v nm ).strip if nm != "" then command = nm + " " + @file_path result = `#{command}` if result.include? "NSAssertionHandler" then UI.error("File contains assertions!") else UI.success("File does not contain any assertions!") end else UI.error("Command nm not found!") end end |
#check_for_flagged_tests ⇒ Object
142 143 144 145 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 142 def check_for_flagged_tests UI.verbose("Check for flagged tests") end |
#check_profiling_data ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fastlane/plugin/checkbuild/actions/checkbuild_action.rb', line 51 def check_profiling_data UI.verbose("Check profiling info...") otool = %x( command -v otool ).strip if otool != "" then command = otool + " -l -arch all " + @file_path result = `#{command}` if result.include? "__llvm_" then UI.error("File contains profiling data!") else UI.success("File does not contain any profiling data!") end else UI.error("Command otool not found!") end end |