lib/gym/runner.rb in gym-0.3.2 vs lib/gym/runner.rb in gym-0.3.3

- old
+ new

@@ -7,11 +7,13 @@ def run clear_old_files build_app verify_archive package_app - swift_library_fix + Gym::XcodebuildFixes.swift_library_fix + Gym::XcodebuildFixes.watchkit_fix + Gym::XcodebuildFixes.clear_patched_package_application move_results end ##################################################### # @!group Printing out things @@ -21,16 +23,16 @@ def print_command(command, title) rows = command.map do |c| current = c.to_s.dup next unless current.length > 0 - if current.include? "-" and current.to_s.split(" '").count == 2 + match_default_parameter = current.match(/(-.*) '(.*)'/) + if match_default_parameter # That's a default parameter, like `-project 'Name'` - # We use " '" to not split by spaces within the value (e.g. path) - current.split(" '") + match_default_parameter[1, 2] else - current.gsub!("| ", "") # as the | will somehow break the terminal table + current.gsub!("| ", "\| ") # as the | will somehow break the terminal table [current, ""] end end puts Terminal::Table.new( @@ -84,53 +86,14 @@ error: proc do |output| ErrorHandler.handle_package_error(output) end) end - # Determine whether it is a Swift project and, eventually, include all required libraries to copy from Xcode's toolchain directory. - # Since there's no "xcodebuild" target to do just that, it is done post-build when exporting an archived build. - def swift_library_fix - require 'fileutils' - - ipa_swift_frameworks = Dir["#{PackageCommandGenerator.appfile_path}/Frameworks/libswift*"] - - unless ipa_swift_frameworks.empty? - Dir.mktmpdir do |tmpdir| - # Copy all necessary Swift libraries to a temporary "SwiftSupport" directory so that we can - # easily add it to the .ipa later. - swift_support = File.join(tmpdir, "SwiftSupport") - - Dir.mkdir(swift_support) - - developer_dir = `xcode-select --print-path`.strip - ipa_swift_frameworks.each do |path| - framework = File.basename(path) - - FileUtils.copy_file("#{developer_dir}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/#{framework}", File.join(swift_support, framework)) - end - - # Add "SwiftSupport" to the .ipa archive - Dir.chdir(tmpdir) do - command_parts = ["zip --recurse-paths #{PackageCommandGenerator.ipa_path} SwiftSupport"] - command_parts << "> /dev/null" unless $verbose - print_command(command_parts, "Fix Swift embedded code if needed") if $verbose - - FastlaneCore::CommandExecutor.execute(command: command_parts, - print_all: false, - print_command: !Gym.config[:silent], - error: proc do |output| - ErrorHandler.handle_package_error(output) - end) - end - end - end - end - # Moves over the binary and dsym file to the output directory # @return (String) The path to the resulting ipa file def move_results require 'fileutils' - + FileUtils.mkdir_p(Gym.config[:output_directory]) FileUtils.mv(PackageCommandGenerator.ipa_path, Gym.config[:output_directory], force: true) if PackageCommandGenerator.dsym_path # Compress and move the dsym file containing_directory = File.expand_path("..", PackageCommandGenerator.dsym_path)