fastlane/swift/LaneFileProtocol.swift in fastlane_hotfix-2.165.1 vs fastlane/swift/LaneFileProtocol.swift in fastlane_hotfix-2.187.0
- old
+ new
@@ -1,7 +1,7 @@
// LaneFileProtocol.swift
-// Copyright (c) 2020 FastlaneTools
+// Copyright (c) 2021 FastlaneTools
//
// ** NOTE **
// This file is provided by fastlane and WILL be overwritten in future updates
// If you want to add extra functionality to this project, create a new file in a
@@ -15,33 +15,37 @@
static func runLane(from fastfile: LaneFile?, named lane: String, with parameters: [String: String]) -> Bool
func recordLaneDescriptions()
func beforeAll(with lane: String)
func afterAll(with lane: String)
- func onError(currentLane: String, errorInfo: String)
+ func onError(currentLane: String, errorInfo: String, errorClass: String?, errorMessage: String?)
}
public extension LaneFileProtocol {
var fastlaneVersion: String { return "" } // Defaults to "" because that means any is fine
- func beforeAll(with lane: String) {} // No-op by default
- func afterAll(with lane: String) {} // No-op by default
- func onError(currentLane _: String, errorInfo _: String) {} // No-op by default
+ func beforeAll(with _: String) {} // No-op by default
+ func afterAll(with _: String) {} // No-op by default
func recordLaneDescriptions() {} // No-op by default
}
@objcMembers
open class LaneFile: NSObject, LaneFileProtocol {
private(set) static var fastfileInstance: LaneFile?
+ private static var onErrorCalled = Set<String>()
private static func trimLaneFromName(laneName: String) -> String {
return String(laneName.prefix(laneName.count - 4))
}
private static func trimLaneWithOptionsFromName(laneName: String) -> String {
return String(laneName.prefix(laneName.count - 12))
}
+ public func onError(currentLane: String, errorInfo _: String, errorClass _: String?, errorMessage _: String?) {
+ LaneFile.onErrorCalled.insert(currentLane)
+ }
+
private static var laneFunctionNames: [String] {
var lanes: [String] = []
var methodCount: UInt32 = 0
#if !SWIFT_PACKAGE
let methodList = class_copyMethodList(self, &methodCount)
@@ -135,10 +139,12 @@
// We need to catch all possible errors here and display a nice message.
_ = fastfileInstance.perform(NSSelectorFromString(laneMethod), with: parameters)
// Call only on success.
- fastfileInstance.afterAll(with: lane)
+ if !LaneFile.onErrorCalled.contains(lane) {
+ fastfileInstance.afterAll(with: lane)
+ }
log(message: "Done running lane: \(lane) 🚀")
return true
}
}