Conform TargetReference to CustomStringConvertible

This commit is contained in:
Yuta Saito 2019-10-15 15:15:25 +09:00
parent 55613785da
commit e0dfc72f85
2 changed files with 9 additions and 5 deletions

View File

@ -387,11 +387,11 @@ extension Scheme.Test.TestTarget: JSONEncodable {
public func toJSONValue() -> Any {
if randomExecutionOrder == Scheme.Test.TestTarget.randomExecutionOrderDefault,
parallelizable == Scheme.Test.TestTarget.parallelizableDefault {
return targetReference.toString()
return targetReference.reference
}
var dict: JSONDictionary = [
"name": targetReference.toString(),
"name": targetReference.reference,
]
if randomExecutionOrder != Scheme.Test.TestTarget.randomExecutionOrderDefault {
@ -532,7 +532,7 @@ extension Scheme.Build: JSONObjectConvertible {
extension Scheme.Build: JSONEncodable {
public func toJSONValue() -> Any {
let targetPairs = targets.map { ($0.target.toString(), $0.buildTypes.map { $0.toJSONValue() }) }
let targetPairs = targets.map { ($0.target.reference, $0.buildTypes.map { $0.toJSONValue() }) }
var dict: JSONDictionary = [
"targets": Dictionary(uniqueKeysWithValues: targetPairs),

View File

@ -41,12 +41,16 @@ extension TargetReference {
}
}
extension TargetReference {
public func toString() -> String {
extension TargetReference: CustomStringConvertible {
public var reference: String {
switch location {
case .local: return name
case .project(let projectPath):
return "\(projectPath)/\(name)"
}
}
public var description: String {
return reference
}
}