Skip to content

Commit 19906a7

Browse files
move LogIfVerbose from utils to legacy builder
1 parent 32cf84f commit 19906a7

File tree

2 files changed

+20
-48
lines changed

2 files changed

+20
-48
lines changed

Diff for: legacy/builder/builder.go

+20-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/arduino/arduino-cli/i18n"
2424
"github.com/arduino/arduino-cli/legacy/builder/phases"
2525
"github.com/arduino/arduino-cli/legacy/builder/types"
26-
"github.com/arduino/arduino-cli/legacy/builder/utils"
2726
"github.com/pkg/errors"
2827
"github.com/sirupsen/logrus"
2928
)
@@ -51,26 +50,26 @@ func (s *Builder) Run(ctx *types.Context) error {
5150
return _err
5251
}),
5352

54-
utils.LogIfVerbose(false, tr("Detecting libraries used...")),
53+
logIfVerbose(false, tr("Detecting libraries used...")),
5554
findIncludes(ctx),
5655

5756
&WarnAboutArchIncompatibleLibraries{},
5857

59-
utils.LogIfVerbose(false, tr("Generating function prototypes...")),
58+
logIfVerbose(false, tr("Generating function prototypes...")),
6059
types.BareCommand(PreprocessSketch),
6160

62-
utils.LogIfVerbose(false, tr("Compiling sketch...")),
61+
logIfVerbose(false, tr("Compiling sketch...")),
6362
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.prebuild", Suffix: ".pattern"},
6463
&phases.SketchBuilder{},
6564
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true},
6665

67-
utils.LogIfVerbose(false, tr("Compiling libraries...")),
66+
logIfVerbose(false, tr("Compiling libraries...")),
6867
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.prebuild", Suffix: ".pattern"},
6968
&UnusedCompiledLibrariesRemover{},
7069
&phases.LibrariesBuilder{},
7170
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true},
7271

73-
utils.LogIfVerbose(false, tr("Compiling core...")),
72+
logIfVerbose(false, tr("Compiling core...")),
7473
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.prebuild", Suffix: ".pattern"},
7574

7675
types.BareCommand(func(ctx *types.Context) error {
@@ -98,7 +97,7 @@ func (s *Builder) Run(ctx *types.Context) error {
9897

9998
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true},
10099

101-
utils.LogIfVerbose(false, tr("Linking everything together...")),
100+
logIfVerbose(false, tr("Linking everything together...")),
102101
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.prelink", Suffix: ".pattern"},
103102
&phases.Linker{},
104103
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.postlink", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true},
@@ -255,3 +254,17 @@ func findIncludes(ctx *types.Context) types.BareCommand {
255254
)
256255
})
257256
}
257+
258+
func logIfVerbose(warn bool, msg string) types.BareCommand {
259+
return types.BareCommand(func(ctx *types.Context) error {
260+
if !ctx.Verbose {
261+
return nil
262+
}
263+
if warn {
264+
ctx.Warn(msg)
265+
} else {
266+
ctx.Info(msg)
267+
}
268+
return nil
269+
})
270+
}

Diff for: legacy/builder/utils/utils.go

-41
This file was deleted.

0 commit comments

Comments
 (0)