From ff46bc4a894a405b33c8828fcaf7973593064313 Mon Sep 17 00:00:00 2001 From: Alessio Perugini Date: Tue, 26 Sep 2023 20:51:22 +0200 Subject: [PATCH] Call PushProgress at every CompleteStep call --- arduino/builder/builder.go | 28 ------------------- arduino/builder/compilation.go | 1 - arduino/builder/internal/progress/progress.go | 4 +-- arduino/builder/libraries.go | 1 - 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/arduino/builder/builder.go b/arduino/builder/builder.go index 06ab9662676..d3c7f2b73ca 100644 --- a/arduino/builder/builder.go +++ b/arduino/builder/builder.go @@ -273,19 +273,16 @@ func (b *Builder) preprocess() error { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.prebuild", ".pattern", false); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.prepareSketchBuildPath(); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() b.logIfVerbose(false, tr("Detecting libraries used...")) err := b.libsDetector.FindIncludes( @@ -302,18 +299,15 @@ func (b *Builder) preprocess() error { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() b.warnAboutArchIncompatibleLibraries(b.libsDetector.ImportedLibraries()) b.Progress.CompleteStep() - b.Progress.PushProgress() b.logIfVerbose(false, tr("Generating function prototypes...")) if err := b.preprocessSketch(b.libsDetector.IncludeFolders()); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() return nil } @@ -342,11 +336,9 @@ func (b *Builder) Build() error { b.libsDetector.PrintUsedAndNotUsedLibraries(buildErr != nil) b.Progress.CompleteStep() - b.Progress.PushProgress() b.printUsedLibraries(b.libsDetector.ImportedLibraries()) b.Progress.CompleteStep() - b.Progress.PushProgress() if buildErr != nil { return buildErr @@ -355,13 +347,11 @@ func (b *Builder) Build() error { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.size(); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() return nil } @@ -373,112 +363,94 @@ func (b *Builder) build() error { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.buildSketch(b.libsDetector.IncludeFolders()); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.sketch.postbuild", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() b.logIfVerbose(false, tr("Compiling libraries...")) if err := b.RunRecipe("recipe.hooks.libraries.prebuild", ".pattern", false); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.removeUnusedCompiledLibraries(b.libsDetector.ImportedLibraries()); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.buildLibraries(b.libsDetector.IncludeFolders(), b.libsDetector.ImportedLibraries()); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.libraries.postbuild", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() b.logIfVerbose(false, tr("Compiling core...")) if err := b.RunRecipe("recipe.hooks.core.prebuild", ".pattern", false); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.buildCore(); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.core.postbuild", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() b.logIfVerbose(false, tr("Linking everything together...")) if err := b.RunRecipe("recipe.hooks.linking.prelink", ".pattern", false); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.link(); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.linking.postlink", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.objcopy.preobjcopy", ".pattern", false); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.objcopy.", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.objcopy.postobjcopy", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.mergeSketchWithBootloader(); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if err := b.RunRecipe("recipe.hooks.postbuild", ".pattern", true); err != nil { return err } b.Progress.CompleteStep() - b.Progress.PushProgress() if b.compilationDatabase != nil { b.compilationDatabase.SaveToFile() diff --git a/arduino/builder/compilation.go b/arduino/builder/compilation.go index ca492e77893..5e1d9e9ff21 100644 --- a/arduino/builder/compilation.go +++ b/arduino/builder/compilation.go @@ -84,7 +84,6 @@ func (b *Builder) compileFiles( queue <- source b.Progress.CompleteStep() - b.Progress.PushProgress() } close(queue) wg.Wait() diff --git a/arduino/builder/internal/progress/progress.go b/arduino/builder/internal/progress/progress.go index a3fa9b09d9b..4722813f6a8 100644 --- a/arduino/builder/internal/progress/progress.go +++ b/arduino/builder/internal/progress/progress.go @@ -53,10 +53,10 @@ func (p *Struct) RemoveSubSteps() { // CompleteStep fixdoc func (p *Struct) CompleteStep() { p.Progress += p.StepAmount + p.pushProgress() } -// PushProgress fixdoc -func (p *Struct) PushProgress() { +func (p *Struct) pushProgress() { if p.callback != nil { p.callback(&rpc.TaskProgress{ Percent: p.Progress, diff --git a/arduino/builder/libraries.go b/arduino/builder/libraries.go index 82988709b5d..bbe4f514529 100644 --- a/arduino/builder/libraries.go +++ b/arduino/builder/libraries.go @@ -123,7 +123,6 @@ func (b *Builder) compileLibraries(libraries libraries.List, includes []string) objectFiles.AddAll(libraryObjectFiles) b.Progress.CompleteStep() - b.Progress.PushProgress() } return objectFiles, nil