@@ -43,7 +43,9 @@ func (s *Builder) Run(ctx *types.Context) error {
43
43
commands := []types.Command {
44
44
& ContainerBuildOptions {},
45
45
46
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.prebuild" , Suffix : ".pattern" },
46
+ types .BareCommand (func (ctx * types.Context ) error {
47
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.prebuild" , ".pattern" , false )
48
+ }),
47
49
48
50
types .BareCommand (func (ctx * types.Context ) error {
49
51
ctx .LineOffset , _err = ctx .Builder .PrepareSketchBuildPath (ctx .SourceOverride , ctx .SketchBuildPath )
@@ -59,7 +61,11 @@ func (s *Builder) Run(ctx *types.Context) error {
59
61
types .BareCommand (PreprocessSketch ),
60
62
61
63
logIfVerbose (false , tr ("Compiling sketch..." )),
62
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.sketch.prebuild" , Suffix : ".pattern" },
64
+
65
+ types .BareCommand (func (ctx * types.Context ) error {
66
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.sketch.prebuild" , ".pattern" , false )
67
+ }),
68
+
63
69
types .BareCommand (func (ctx * types.Context ) error {
64
70
sketchObjectFiles , err := phases .SketchBuilder (
65
71
ctx .SketchBuildPath ,
@@ -82,10 +88,15 @@ func (s *Builder) Run(ctx *types.Context) error {
82
88
ctx .SketchObjectFiles = sketchObjectFiles
83
89
return nil
84
90
}),
85
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.sketch.postbuild" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
91
+
92
+ types .BareCommand (func (ctx * types.Context ) error {
93
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.sketch.postbuild" , ".pattern" , true )
94
+ }),
86
95
87
96
logIfVerbose (false , tr ("Compiling libraries..." )),
88
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.libraries.prebuild" , Suffix : ".pattern" },
97
+ types .BareCommand (func (ctx * types.Context ) error {
98
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.libraries.prebuild" , ".pattern" , false )
99
+ }),
89
100
& UnusedCompiledLibrariesRemover {},
90
101
types .BareCommand (func (ctx * types.Context ) error {
91
102
librariesObjectFiles , err := phases .LibrariesBuilder (
@@ -112,10 +123,14 @@ func (s *Builder) Run(ctx *types.Context) error {
112
123
113
124
return nil
114
125
}),
115
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.libraries.postbuild" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
126
+ types .BareCommand (func (ctx * types.Context ) error {
127
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.libraries.postbuild" , ".pattern" , true )
128
+ }),
116
129
117
130
logIfVerbose (false , tr ("Compiling core..." )),
118
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.core.prebuild" , Suffix : ".pattern" },
131
+ types .BareCommand (func (ctx * types.Context ) error {
132
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.core.prebuild" , ".pattern" , false )
133
+ }),
119
134
120
135
types .BareCommand (func (ctx * types.Context ) error {
121
136
objectFiles , archiveFile , err := phases .CoreBuilder (
@@ -139,10 +154,14 @@ func (s *Builder) Run(ctx *types.Context) error {
139
154
return err
140
155
}),
141
156
142
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.core.postbuild" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
157
+ types .BareCommand (func (ctx * types.Context ) error {
158
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.core.postbuild" , ".pattern" , true )
159
+ }),
143
160
144
161
logIfVerbose (false , tr ("Linking everything together..." )),
145
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.linking.prelink" , Suffix : ".pattern" },
162
+ types .BareCommand (func (ctx * types.Context ) error {
163
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.linking.prelink" , ".pattern" , false )
164
+ }),
146
165
147
166
types .BareCommand (func (ctx * types.Context ) error {
148
167
verboseInfoOut , err := phases .Linker (
@@ -164,15 +183,25 @@ func (s *Builder) Run(ctx *types.Context) error {
164
183
return err
165
184
}),
166
185
167
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.linking.postlink" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
186
+ types .BareCommand (func (ctx * types.Context ) error {
187
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.linking.postlink" , ".pattern" , true )
188
+ }),
168
189
169
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.objcopy.preobjcopy" , Suffix : ".pattern" },
170
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.objcopy." , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
171
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.objcopy.postobjcopy" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
190
+ types .BareCommand (func (ctx * types.Context ) error {
191
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.objcopy.preobjcopy" , ".pattern" , false )
192
+ }),
193
+ types .BareCommand (func (ctx * types.Context ) error {
194
+ return recipeByPrefixSuffixRunner (ctx , "recipe.objcopy." , ".pattern" , true )
195
+ }),
196
+ types .BareCommand (func (ctx * types.Context ) error {
197
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.objcopy.postobjcopy" , ".pattern" , true )
198
+ }),
172
199
173
200
& MergeSketchWithBootloader {},
174
201
175
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.postbuild" , Suffix : ".pattern" , SkipIfOnlyUpdatingCompilationDatabase : true },
202
+ types .BareCommand (func (ctx * types.Context ) error {
203
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.postbuild" , ".pattern" , true )
204
+ }),
176
205
}
177
206
178
207
ctx .Progress .AddSubSteps (len (commands ) + 5 )
@@ -259,7 +288,9 @@ func (s *Preprocess) Run(ctx *types.Context) error {
259
288
commands := []types.Command {
260
289
& ContainerBuildOptions {},
261
290
262
- & RecipeByPrefixSuffixRunner {Prefix : "recipe.hooks.prebuild" , Suffix : ".pattern" },
291
+ types .BareCommand (func (ctx * types.Context ) error {
292
+ return recipeByPrefixSuffixRunner (ctx , "recipe.hooks.prebuild" , ".pattern" , false )
293
+ }),
263
294
264
295
types .BareCommand (func (ctx * types.Context ) error {
265
296
ctx .LineOffset , _err = ctx .Builder .PrepareSketchBuildPath (ctx .SourceOverride , ctx .SketchBuildPath )
@@ -343,3 +374,12 @@ func logIfVerbose(warn bool, msg string) types.BareCommand {
343
374
return nil
344
375
})
345
376
}
377
+
378
+ func recipeByPrefixSuffixRunner (ctx * types.Context , prefix , suffix string , skipIfOnlyUpdatingCompilationDatabase bool ) error {
379
+ return RecipeByPrefixSuffixRunner (
380
+ prefix , suffix , skipIfOnlyUpdatingCompilationDatabase ,
381
+ ctx .OnlyUpdateCompilationDatabase , ctx .Verbose ,
382
+ ctx .BuildProperties , ctx .Stdout , ctx .Stderr ,
383
+ func (msg string ) { ctx .Info (msg ) },
384
+ )
385
+ }
0 commit comments