diff --git a/scan/lib/scan/runner.rb b/scan/lib/scan/runner.rb index e5ce644754b..54f99bb4eef 100644 --- a/scan/lib/scan/runner.rb +++ b/scan/lib/scan/runner.rb @@ -55,6 +55,8 @@ def test_app end def execute(retries: 0) + Scan.cache[:retry_attempt] = Scan.config[:number_of_retries] - retries + command = @test_command_generator.generate prefix_hash = [ diff --git a/scan/lib/scan/test_command_generator.rb b/scan/lib/scan/test_command_generator.rb index 9be93e7b510..050179bfa8f 100644 --- a/scan/lib/scan/test_command_generator.rb +++ b/scan/lib/scan/test_command_generator.rb @@ -164,8 +164,10 @@ def build_path # The path to the result bundle def result_bundle_path + retry_count = Scan.cache[:retry_attempt] || 0 + attempt = retry_count > 0 ? "-#{retry_count}" : "" ext = FastlaneCore::Helper.xcode_version.to_i >= 11 ? '.xcresult' : '.test_result' - path = File.join(Scan.config[:output_directory], Scan.config[:scheme]) + ext + path = File.join(Scan.config[:output_directory], Scan.config[:scheme]) + attempt + ext if File.directory?(path) FileUtils.remove_dir(path) end