Class: Gym::XcodeFix
- Inherits:
-
Object
- Object
- Gym::XcodeFix
- Defined in:
- lib/gym/xcode_fix.rb
Class Method Summary collapse
-
.patch_package_application ⇒ Object
Fix PackageApplication Perl script by Xcode to create the IPA from the archive.
Class Method Details
.patch_package_application ⇒ Object
Fix PackageApplication Perl script by Xcode to create the IPA from the archive
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gym/xcode_fix.rb', line 5 def patch_package_application require 'fileutils' # Initialization developer_dir = `xcode-select --print-path`.strip patched_package_application_path = File.join("/tmp", "PackageApplication4Gym") # Remove any previous patched PackageApplication FileUtils.rm patched_package_application_path if File.exist?(patched_package_application_path) Dir.mktmpdir do |tmpdir| # Check current PackageApplication MD5 require 'digest' path = File.join(Helper.gem_path("gym"), "lib/assets/package_application_patches/PackageApplication_MD5") expected_md5 = File.read(path) # If that location changes, search it using xcrun --sdk iphoneos -f PackageApplication package_application_path = "#{developer_dir}/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication" raise "Unable to patch the `PackageApplication` script bundled in XCode. This is not supported." unless expected_md5 == Digest::MD5.file(package_application_path).hexdigest # Duplicate PackageApplication script to PackageApplication4Gym FileUtils.copy_file(package_application_path, patched_package_application_path) # Apply patches to PackageApplication4Gym from patches folder Dir[File.join(Helper.gem_path("gym"), "lib/assets/package_application_patches/*.diff")].each do |patch| Helper.log.info "Applying Package Application patch: #{File.basename(patch)}" unless Gym.config[:silent] command = ["patch #{patched_package_application_path} < #{patch}"] Runner.new.print_command(command, "Applying Package Application patch: #{File.basename(patch)}") if $verbose FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: !Gym.config[:silent], error: proc do |output| ErrorHandler.handle_package_error(output) end) end end return patched_package_application_path # Return path to the patched PackageApplication end |