snapshot/lib/snapshot/test_command_generator.rb in fastlane-2.29.0 vs snapshot/lib/snapshot/test_command_generator.rb in fastlane-2.29.1

- old
+ new

@@ -1,18 +1,18 @@ module Snapshot # Responsible for building the fully working xcodebuild command class TestCommandGenerator class << self - def generate(device_type: nil) + def generate(device_type: nil, language: nil, locale: nil) parts = prefix parts << "xcodebuild" parts += options parts += destination(device_type) parts += build_settings parts += actions parts += suffix - parts += pipe + parts += pipe(device_type, language, locale) parts end def prefix @@ -60,12 +60,13 @@ def suffix [] end - def pipe - ["| tee #{xcodebuild_log_path.shellescape} | xcpretty #{Snapshot.config[:xcpretty_args]}"] + def pipe(device_type, language, locale) + log_path = xcodebuild_log_path(device_type: device_type, language: language, locale: locale) + ["| tee #{log_path.shellescape} | xcpretty #{Snapshot.config[:xcpretty_args]}"] end def find_device(device_name, os_version = Snapshot.config[:ios_version]) # We might get this error message # > The requested device could not be found because multiple devices matched the request. @@ -106,11 +107,20 @@ value = "platform=#{os} Simulator,id=#{device.udid},OS=#{os_version}" return ["-destination '#{value}'"] end - def xcodebuild_log_path - file_name = "#{Snapshot.project.app_name}-#{Snapshot.config[:scheme]}.log" + def xcodebuild_log_path(device_type: nil, language: nil, locale: nil) + name_components = [Snapshot.project.app_name, Snapshot.config[:scheme]] + + if Snapshot.config[:namespace_log_files] + name_components << device_type if device_type + name_components << language if language + name_components << locale if locale + end + + file_name = "#{name_components.join('-')}.log" + containing = File.expand_path(Snapshot.config[:buildlog_path]) FileUtils.mkdir_p(containing) return File.join(containing, file_name) end