diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-19 10:53:27 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-20 09:46:45 +0200 |
commit | 5160c7efa5771d74b560f9c2ea761f09e08a9216 (patch) | |
tree | 02eecf016485128c5c7a2d2c38628688fd20d936 /hugolib/hugo_sites_build.go | |
parent | e2dd4cd05fa96a08d49b3b198edf0ccf9a94970e (diff) |
tpl/debug: Add debug.Timer
Closes #11580
Diffstat (limited to 'hugolib/hugo_sites_build.go')
-rw-r--r-- | hugolib/hugo_sites_build.go | 18 |
1 files changed, 11 insertions, 7 deletions
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 } } |