builder: add support for -x flag
Print commands as they are executed with the -x flag. This is not yet complete: library builds don't print commands yet. But it's a step closer.
Этот коммит содержится в:
родитель
fb03787b73
коммит
896a848001
3 изменённых файлов: 7 добавлений и 1 удалений
|
@ -476,6 +476,9 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
|
||||||
}
|
}
|
||||||
ldflags = append(ldflags, dependency.result)
|
ldflags = append(ldflags, dependency.result)
|
||||||
}
|
}
|
||||||
|
if config.Options.PrintCommands {
|
||||||
|
fmt.Printf("%s %s\n", config.Target.Linker, strings.Join(ldflags, " "))
|
||||||
|
}
|
||||||
err = link(config.Target.Linker, ldflags...)
|
err = link(config.Target.Linker, ldflags...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &commandError{"failed to link", executable, err}
|
return &commandError{"failed to link", executable, err}
|
||||||
|
|
|
@ -124,6 +124,9 @@ func compileAndCacheCFile(abspath, tmpdir string, config *compileopts.Config) (s
|
||||||
flags := config.CFlags()
|
flags := config.CFlags()
|
||||||
flags = append(flags, "-MD", "-MV", "-MTdeps", "-MF", depTmpFile.Name()) // autogenerate dependencies
|
flags = append(flags, "-MD", "-MV", "-MTdeps", "-MF", depTmpFile.Name()) // autogenerate dependencies
|
||||||
flags = append(flags, "-c", "-o", objTmpFile.Name(), abspath)
|
flags = append(flags, "-c", "-o", objTmpFile.Name(), abspath)
|
||||||
|
if config.Options.PrintCommands {
|
||||||
|
fmt.Printf("%s %s\n", config.Target.Compiler, strings.Join(flags, " "))
|
||||||
|
}
|
||||||
err = runCCompiler(config.Target.Compiler, flags...)
|
err = runCCompiler(config.Target.Compiler, flags...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", &commandError{"failed to build", abspath, err}
|
return "", &commandError{"failed to build", abspath, err}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче