@@ -207,6 +207,8 @@ func compileFilesWithRecipe(ctx *types.Context, objectFiles []string, sourcePath
207
207
}
208
208
}
209
209
210
+ var outputCacheMutex sync.Mutex
211
+
210
212
func compileFileWithRecipe (ctx * types.Context , sourcePath string , source string , buildPath string , buildProperties properties.Map , includes []string , recipe string ) (string , error ) {
211
213
logger := ctx .GetLogger ()
212
214
properties := buildProperties .Clone ()
@@ -230,12 +232,26 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath string, source string,
230
232
}
231
233
232
234
if ! objIsUpToDate {
233
- _ , _ , err = ExecRecipe (ctx , properties , recipe , false /* stdout */ , utils .ShowIfVerbose /* stderr */ , utils .Show )
235
+ stdout , stderr , err : = ExecRecipe (ctx , properties , recipe , false /* stdout */ , utils .ShowIfVerbose /* stderr */ , utils .Show )
234
236
if err != nil {
235
237
return "" , i18n .WrapError (err )
236
238
}
237
- } else if ctx .Verbose {
238
- logger .Println (constants .LOG_LEVEL_INFO , constants .MSG_USING_PREVIOUS_COMPILED_FILE , properties [constants .BUILD_PROPERTIES_OBJECT_FILE ])
239
+ outputCacheMutex .Lock ()
240
+ ctx .OutputCache [source ] = types.Streams {
241
+ Stderr : stderr ,
242
+ Stdout : stdout ,
243
+ }
244
+ outputCacheMutex .Unlock ()
245
+ } else {
246
+ if ctx .Verbose {
247
+ logger .Println (constants .LOG_LEVEL_INFO , constants .MSG_USING_PREVIOUS_COMPILED_FILE , properties [constants .BUILD_PROPERTIES_OBJECT_FILE ])
248
+ }
249
+ if len (ctx .OutputCache [source ].Stderr ) > 0 && ctx .WarningsLevel != "none" {
250
+ logger .UnformattedWrite (os .Stderr , ctx .OutputCache [source ].Stderr )
251
+ }
252
+ if len (ctx .OutputCache [source ].Stdout ) > 0 && ctx .WarningsLevel != "none" {
253
+ logger .UnformattedWrite (os .Stdout , ctx .OutputCache [source ].Stdout )
254
+ }
239
255
}
240
256
241
257
return properties [constants .BUILD_PROPERTIES_OBJECT_FILE ], nil
0 commit comments