From 5160c7efa5771d74b560f9c2ea761f09e08a9216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Oct 2023 10:53:27 +0200 Subject: tpl/debug: Add debug.Timer Closes #11580 --- hugolib/hugo_sites_build.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'hugolib/hugo_sites_build.go') diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index 167d19eb5..27fde5822 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -17,6 +17,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "path/filepath" "strings" @@ -38,8 +39,6 @@ import ( "github.com/gohugoio/hugo/output" - "errors" - "github.com/fsnotify/fsnotify" "github.com/gohugoio/hugo/helpers" ) @@ -68,6 +67,12 @@ func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error { defer unlock() } + defer func() { + for _, s := range h.Sites { + s.Deps.BuildEndListeners.Notify() + } + }() + infol := h.Log.InfoCommand("build") errCollector := h.StartErrorCollector() @@ -344,7 +349,6 @@ func (h *HugoSites) postRenderOnce() error { h.Log.Warnf("Template %s is unused, source file %s", unusedTemplate.Name(), unusedTemplate.Filename()) } } - }) return nil } @@ -384,7 +388,7 @@ func (h *HugoSites) postProcess(l logg.LevelLogger) error { } // Make sure it's written to the OS fs as this is used by // editors. - if err := afero.WriteFile(hugofs.Os, filename, b, 0666); err != nil { + if err := afero.WriteFile(hugofs.Os, filename, b, 0o666); err != nil { h.Log.Warnf("Failed to write jsconfig.json: %s", err) } } @@ -446,7 +450,7 @@ func (h *HugoSites) postProcess(l logg.LevelLogger) error { } if changed { - return afero.WriteFile(h.BaseFs.PublishFs, filename, content, 0666) + return afero.WriteFile(h.BaseFs.PublishFs, filename, content, 0o666) } return nil @@ -512,13 +516,13 @@ func (h *HugoSites) writeBuildStats() error { } // Make sure it's always written to the OS fs. - if err := afero.WriteFile(hugofs.Os, filename, js, 0666); err != nil { + if err := afero.WriteFile(hugofs.Os, filename, js, 0o666); err != nil { return err } // Write to the destination as well if it's a in-memory fs. if !hugofs.IsOsFs(h.Fs.Source) { - if err := afero.WriteFile(h.Fs.WorkingDirWritable, filename, js, 0666); err != nil { + if err := afero.WriteFile(h.Fs.WorkingDirWritable, filename, js, 0o666); err != nil { return err } } -- cgit v1.2.3