lib/gym/runner.rb in gym-1.12.1 vs lib/gym/runner.rb in gym-1.13.0

- old
+ new

@@ -9,30 +9,41 @@ def run unless Gym.config[:skip_build_archive] clear_old_files build_app end - verify_archive - + verify_archive if Gym.project.produces_archive? FileUtils.mkdir_p(File.expand_path(Gym.config[:output_directory])) if Gym.project.ios? || Gym.project.tvos? fix_generic_archive # See https://github.com/fastlane/fastlane/pull/4325 - package_app + package_app if Gym.project.produces_archive? fix_package compress_and_move_dsym - path = move_ipa + path = move_ipa if Gym.project.produces_archive? move_manifest move_app_thinning move_app_thinning_size_report move_apps_folder - - path elsif Gym.project.mac? + path = File.expand_path(Gym.config[:output_directory]) compress_and_move_dsym - copy_mac_app + if Gym.project.mac_app? + copy_mac_app + return path + end + copy_files_from_path(File.join(BuildCommandGenerator.archive_path, "Products/usr/local/bin/*")) if Gym.project.command_line_tool? end + + if Gym.project.library? || Gym.project.framework? + base_framework_path = Gym.project.build_settings(key: "BUILD_ROOT") + base_framework_path = Gym.config[:derived_data_path] + "/Build/Products/" if Gym.config[:derived_data_path] + + copy_files_from_path("#{base_framework_path}/*/*") + path = base_framework_path + end + path end ##################################################### # @!group Printing out things ##################################################### @@ -84,10 +95,11 @@ Gym::XcodebuildFixes.watchkit_fix Gym::XcodebuildFixes.watchkit2_fix end def mark_archive_as_built_by_gym(archive_path) + return if Gym.project.library? || Gym.project.framework? escaped_archive_path = archive_path.shellescape system("xattr -w info.fastlane.generated_by_gym 1 #{escaped_archive_path}") end # Builds the app and prepares the archive @@ -153,17 +165,34 @@ UI.success "Successfully exported and signed the ipa file:" UI.message ipa_path ipa_path end + # copys framework from temp folder: + + def copy_files_from_path(path) + UI.success "Exporting Files:" + Dir[path].each do |f| + existing_file = File.join(File.expand_path(Gym.config[:output_directory]), File.basename(f)) + # If the target file already exists in output directory + # we have to remove it first, otherwise cp_r fails even with remove_destination + # e.g.: there are symlinks in the .framework + if File.exist?(existing_file) + UI.important "Removing #{File.basename(f)} from output directory" if $verbose + FileUtils.rm_rf(existing_file) + end + FileUtils.cp_r(f, File.expand_path(Gym.config[:output_directory]), remove_destination: true) + UI.message "\t ▸ #{File.basename(f)}" + end + end + # Copies the .app from the archive into the output directory def copy_mac_app - app_path = Dir[File.join(BuildCommandGenerator.archive_path, "Products/Applications/*.app")].last - UI.crash!("Couldn't find application in '#{BuildCommandGenerator.archive_path}'") unless app_path - + exe_name = Gym.project.build_settings(key: "EXECUTABLE_NAME") + app_path = File.join(BuildCommandGenerator.archive_path, "Products/Applications/#{exe_name}.app") + UI.crash!("Couldn't find application in '#{BuildCommandGenerator.archive_path}'") unless File.exist?(app_path) FileUtils.cp_r(app_path, File.expand_path(Gym.config[:output_directory]), remove_destination: true) app_path = File.join(Gym.config[:output_directory], File.basename(app_path)) - UI.success "Successfully exported the .app file:" UI.message app_path app_path end