@@ -6,6 +6,8 @@ struct MiniMake {
6
6
enum TaskAttribute {
7
7
/// Task is phony, meaning it must be built even if its inputs are up to date
8
8
case phony
9
+ /// Don't print anything when building this task
10
+ case silent
9
11
}
10
12
/// A task to build
11
13
struct Task {
@@ -84,15 +86,16 @@ struct MiniMake {
84
86
private static var reset : String { " \u{001B} [0m " }
85
87
86
88
mutating func started( _ task: Task ) {
87
- self . print ( task. displayName , " \( Self . green) building \( Self . reset) " )
89
+ self . print ( task, " \( Self . green) building \( Self . reset) " )
88
90
}
89
91
90
92
mutating func skipped( _ task: Task ) {
91
- self . print ( task. displayName , " \( Self . yellow) skipped \( Self . reset) " )
93
+ self . print ( task, " \( Self . yellow) skipped \( Self . reset) " )
92
94
}
93
95
94
- private mutating func print( _ subjectPath: String , _ message: @autoclosure ( ) -> String ) {
95
- Swift . print ( " [ \( self . built + 1 ) / \( self . total) ] \( subjectPath) : \( message ( ) ) " )
96
+ private mutating func print( _ task: Task , _ message: @autoclosure ( ) -> String ) {
97
+ guard !task. attributes. contains ( . silent) else { return }
98
+ Swift . print ( " [ \( self . built + 1 ) / \( self . total) ] \( task. displayName) : \( message ( ) ) " )
96
99
self . built += 1
97
100
}
98
101
}
@@ -102,7 +105,7 @@ struct MiniMake {
102
105
func visit( task: Task ) -> Int {
103
106
guard !visited. contains ( task. key) else { return 0 }
104
107
visited. insert ( task. key)
105
- var total = 1
108
+ var total = task . attributes . contains ( . silent ) ? 0 : 1
106
109
for want in task. wants {
107
110
total += visit ( task: self . tasks [ want] !)
108
111
}
0 commit comments