builder: print compiler commands while building a library

We should have been doing this all along and makes it easier to debug
things that go wrong while compiling a library.
Этот коммит содержится в:
Ayke van Laethem 2022-11-05 20:19:34 +01:00 коммит произвёл Ron Evans
родитель 666ead3996
коммит 2001c44ed3

Просмотреть файл

@ -242,6 +242,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
var compileArgs []string var compileArgs []string
compileArgs = append(compileArgs, args...) compileArgs = append(compileArgs, args...)
compileArgs = append(compileArgs, "-o", objpath, srcpath) compileArgs = append(compileArgs, "-o", objpath, srcpath)
if config.Options.PrintCommands != nil {
config.Options.PrintCommands("clang", compileArgs...)
}
err := runCCompiler(compileArgs...) err := runCCompiler(compileArgs...)
if err != nil { if err != nil {
return &commandError{"failed to build", srcpath, err} return &commandError{"failed to build", srcpath, err}
@ -268,6 +271,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
} }
tmpfile.Close() tmpfile.Close()
compileArgs = append(compileArgs, "-o", tmpfile.Name(), srcpath) compileArgs = append(compileArgs, "-o", tmpfile.Name(), srcpath)
if config.Options.PrintCommands != nil {
config.Options.PrintCommands("clang", compileArgs...)
}
err = runCCompiler(compileArgs...) err = runCCompiler(compileArgs...)
if err != nil { if err != nil {
return &commandError{"failed to build", srcpath, err} return &commandError{"failed to build", srcpath, err}