Skip to content

Commit 2aedad1

Browse files
committed
Save and restore warnings from cached files
There's a concurrency issue between stdout and stderr prints so lines are interleaved at the moment (when parallel compilation is active).
1 parent 6fdac77 commit 2aedad1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

builder_utils/utils.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,18 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath string, source string,
230230
}
231231

232232
if !objIsUpToDate {
233-
_, _, err = ExecRecipe(ctx, properties, recipe, false /* stdout */, utils.ShowIfVerbose /* stderr */, utils.Show)
233+
_, stderrCache, err := ExecRecipe(ctx, properties, recipe, false /* stdout */, utils.ShowIfVerbose /* stderr */, utils.Show)
234234
if err != nil {
235235
return "", i18n.WrapError(err)
236236
}
237-
} else if ctx.Verbose {
238-
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, properties[constants.BUILD_PROPERTIES_OBJECT_FILE])
237+
ctx.WarningsCache[source] = string(stderrCache)
238+
} else {
239+
if ctx.Verbose {
240+
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, properties[constants.BUILD_PROPERTIES_OBJECT_FILE])
241+
}
242+
if ctx.WarningsCache[source] != "" {
243+
logger.UnformattedFprintln(os.Stderr, ctx.WarningsCache[source])
244+
}
239245
}
240246

241247
return properties[constants.BUILD_PROPERTIES_OBJECT_FILE], nil

0 commit comments

Comments
 (0)