@@ -21,17 +21,56 @@ enum ExclusivesError: Error, CustomStringConvertible, Equatable {
2121
2222 /// Conflicting exclusive entries were found across the provided targets (duplicates in mutually exclusive sections).
2323 /// - Parameter targetNames: A comma-separated list of conflicting target names.
24- case exclusiveEntriesFound( targetNames: String )
24+ /// - Parameter diff: A `Target` instance representing the differences found.
25+ case exclusiveEntriesFound( targetNames: String , diff: Target )
2526
2627 /// A human-readable description of the exclusivity validation failure, suitable for logging or displaying in diagnostics.
2728 var description : String {
2829 switch self {
2930 case . invalidTargetName( let name) :
30- " error: ❌ Target name \( name) inside exclusive section doesn't exist in the project "
31+ " ❌ Target name \( name) inside exclusive section doesn't exist in the project "
3132 case . invalidPathForTarget( let targetName, let path) :
32- " error: ❌ Path \( path) inside exclusive section for target \( targetName) doesn't exist in the project "
33- case . exclusiveEntriesFound( let targetNames) :
34- " error: ❌ Exclusive entries found for targets: \( targetNames) "
33+ " ❌ Path \( path) inside exclusive section for target \( targetName) doesn't exist in the project "
34+ case . exclusiveEntriesFound( let targetNames, let diff) :
35+ exclusiveEntriesErrorMessage (
36+ targetNames: targetNames,
37+ diff: diff
38+ )
39+ }
40+ }
41+
42+ private func exclusiveEntriesErrorMessage(
43+ targetNames: String ,
44+ diff: Target
45+ ) -> String {
46+ var message = " ❌ Exclusive entries found for targets: \( targetNames) \n "
47+ updateMessage (
48+ kind: " files " ,
49+ entries: diff. filePaths,
50+ message: & message
51+ )
52+ updateMessage (
53+ kind: " dependencies " ,
54+ entries: diff. dependencies,
55+ message: & message
56+ )
57+ updateMessage (
58+ kind: " frameworks " ,
59+ entries: diff. frameworks,
60+ message: & message
61+ )
62+ return message
63+ }
64+
65+ private func updateMessage(
66+ kind: String ,
67+ entries: Set < String > ,
68+ message: inout String
69+ ) {
70+ guard !entries. isEmpty else { return }
71+ message += " Conflicting \( kind) : \n "
72+ for entry in entries. sorted ( ) {
73+ message += " - \( entry) \n "
3574 }
3675 }
3776}
0 commit comments