Skip to content
Merged
Prev Previous commit
Next Next commit
Suppress size output if --quiet is specified
  • Loading branch information
cmaglie committed Jan 23, 2025
commit d9cfdf7942b9ba3ad17838511ba0c4eedbdb9b1b
3 changes: 3 additions & 0 deletions commands/service_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
})
}
var verbosity logger.Verbosity = logger.VerbosityNormal
if req.GetQuiet() {
verbosity = logger.VerbosityQuiet
}
if req.GetVerbose() {
verbosity = logger.VerbosityVerbose
}
Expand Down
28 changes: 15 additions & 13 deletions internal/arduino/builder/sizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,21 @@ func (b *Builder) checkSize() (ExecutablesFileSections, error) {
return nil, nil
}

b.logger.Info(i18n.Tr("Sketch uses %[1]s bytes (%[3]s%%) of program storage space. Maximum is %[2]s bytes.",
strconv.Itoa(textSize),
strconv.Itoa(maxTextSize),
strconv.Itoa(textSize*100/maxTextSize)))
if dataSize >= 0 {
if maxDataSize > 0 {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes (%[3]s%%) of dynamic memory, leaving %[4]s bytes for local variables. Maximum is %[2]s bytes.",
strconv.Itoa(dataSize),
strconv.Itoa(maxDataSize),
strconv.Itoa(dataSize*100/maxDataSize),
strconv.Itoa(maxDataSize-dataSize)))
} else {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes of dynamic memory.", strconv.Itoa(dataSize)))
if b.logger.VerbosityLevel() > logger.VerbosityQuiet {
b.logger.Info(i18n.Tr("Sketch uses %[1]s bytes (%[3]s%%) of program storage space. Maximum is %[2]s bytes.",
strconv.Itoa(textSize),
strconv.Itoa(maxTextSize),
strconv.Itoa(textSize*100/maxTextSize)))
if dataSize >= 0 {
if maxDataSize > 0 {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes (%[3]s%%) of dynamic memory, leaving %[4]s bytes for local variables. Maximum is %[2]s bytes.",
strconv.Itoa(dataSize),
strconv.Itoa(maxDataSize),
strconv.Itoa(dataSize*100/maxDataSize),
strconv.Itoa(maxDataSize-dataSize)))
} else {
b.logger.Info(i18n.Tr("Global variables use %[1]s bytes of dynamic memory.", strconv.Itoa(dataSize)))
}
}
}

Expand Down