@@ -6,6 +6,8 @@ struct MiniMake {
66 enum TaskAttribute {
77 /// Task is phony, meaning it must be built even if its inputs are up to date
88 case phony
9+ /// Don't print anything when building this task
10+ case silent
911 }
1012 /// A task to build
1113 struct Task {
@@ -84,15 +86,16 @@ struct MiniMake {
8486 private static var reset : String { " \u{001B} [0m " }
8587
8688 mutating func started( _ task: Task ) {
87- self . print ( task. displayName , " \( Self . green) building \( Self . reset) " )
89+ self . print ( task, " \( Self . green) building \( Self . reset) " )
8890 }
8991
9092 mutating func skipped( _ task: Task ) {
91- self . print ( task. displayName , " \( Self . yellow) skipped \( Self . reset) " )
93+ self . print ( task, " \( Self . yellow) skipped \( Self . reset) " )
9294 }
9395
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 ( ) ) " )
9699 self . built += 1
97100 }
98101 }
@@ -102,7 +105,7 @@ struct MiniMake {
102105 func visit( task: Task ) -> Int {
103106 guard !visited. contains ( task. key) else { return 0 }
104107 visited. insert ( task. key)
105- var total = 1
108+ var total = task . attributes . contains ( . silent ) ? 0 : 1
106109 for want in task. wants {
107110 total += visit ( task: self . tasks [ want] !)
108111 }
0 commit comments