Skip to content

Commit 1862038

Browse files
Call PushProgress at every CompleteStep call
1 parent c543b4d commit 1862038

File tree

4 files changed

+2
-32
lines changed

4 files changed

+2
-32
lines changed

Diff for: arduino/builder/builder.go

-28
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,16 @@ func (b *Builder) preprocess() error {
273273
return err
274274
}
275275
b.Progress.CompleteStep()
276-
b.Progress.PushProgress()
277276

278277
if err := b.RunRecipe("recipe.hooks.prebuild", ".pattern", false); err != nil {
279278
return err
280279
}
281280
b.Progress.CompleteStep()
282-
b.Progress.PushProgress()
283281

284282
if err := b.prepareSketchBuildPath(); err != nil {
285283
return err
286284
}
287285
b.Progress.CompleteStep()
288-
b.Progress.PushProgress()
289286

290287
b.logIfVerbose(false, tr("Detecting libraries used..."))
291288
err := b.libsDetector.FindIncludes(
@@ -302,18 +299,15 @@ func (b *Builder) preprocess() error {
302299
return err
303300
}
304301
b.Progress.CompleteStep()
305-
b.Progress.PushProgress()
306302

307303
b.warnAboutArchIncompatibleLibraries(b.libsDetector.ImportedLibraries())
308304
b.Progress.CompleteStep()
309-
b.Progress.PushProgress()
310305

311306
b.logIfVerbose(false, tr("Generating function prototypes..."))
312307
if err := b.preprocessSketch(b.libsDetector.IncludeFolders()); err != nil {
313308
return err
314309
}
315310
b.Progress.CompleteStep()
316-
b.Progress.PushProgress()
317311

318312
return nil
319313
}
@@ -342,11 +336,9 @@ func (b *Builder) Build() error {
342336

343337
b.libsDetector.PrintUsedAndNotUsedLibraries(buildErr != nil)
344338
b.Progress.CompleteStep()
345-
b.Progress.PushProgress()
346339

347340
b.printUsedLibraries(b.libsDetector.ImportedLibraries())
348341
b.Progress.CompleteStep()
349-
b.Progress.PushProgress()
350342

351343
if buildErr != nil {
352344
return buildErr
@@ -355,13 +347,11 @@ func (b *Builder) Build() error {
355347
return err
356348
}
357349
b.Progress.CompleteStep()
358-
b.Progress.PushProgress()
359350

360351
if err := b.size(); err != nil {
361352
return err
362353
}
363354
b.Progress.CompleteStep()
364-
b.Progress.PushProgress()
365355

366356
return nil
367357
}
@@ -373,112 +363,94 @@ func (b *Builder) build() error {
373363
return err
374364
}
375365
b.Progress.CompleteStep()
376-
b.Progress.PushProgress()
377366

378367
if err := b.buildSketch(b.libsDetector.IncludeFolders()); err != nil {
379368
return err
380369
}
381370
b.Progress.CompleteStep()
382-
b.Progress.PushProgress()
383371

384372
if err := b.RunRecipe("recipe.hooks.sketch.postbuild", ".pattern", true); err != nil {
385373
return err
386374
}
387375
b.Progress.CompleteStep()
388-
b.Progress.PushProgress()
389376

390377
b.logIfVerbose(false, tr("Compiling libraries..."))
391378
if err := b.RunRecipe("recipe.hooks.libraries.prebuild", ".pattern", false); err != nil {
392379
return err
393380
}
394381
b.Progress.CompleteStep()
395-
b.Progress.PushProgress()
396382

397383
if err := b.removeUnusedCompiledLibraries(b.libsDetector.ImportedLibraries()); err != nil {
398384
return err
399385
}
400386
b.Progress.CompleteStep()
401-
b.Progress.PushProgress()
402387

403388
if err := b.buildLibraries(b.libsDetector.IncludeFolders(), b.libsDetector.ImportedLibraries()); err != nil {
404389
return err
405390
}
406391
b.Progress.CompleteStep()
407-
b.Progress.PushProgress()
408392

409393
if err := b.RunRecipe("recipe.hooks.libraries.postbuild", ".pattern", true); err != nil {
410394
return err
411395
}
412396
b.Progress.CompleteStep()
413-
b.Progress.PushProgress()
414397

415398
b.logIfVerbose(false, tr("Compiling core..."))
416399
if err := b.RunRecipe("recipe.hooks.core.prebuild", ".pattern", false); err != nil {
417400
return err
418401
}
419402
b.Progress.CompleteStep()
420-
b.Progress.PushProgress()
421403

422404
if err := b.buildCore(); err != nil {
423405
return err
424406
}
425407
b.Progress.CompleteStep()
426-
b.Progress.PushProgress()
427408

428409
if err := b.RunRecipe("recipe.hooks.core.postbuild", ".pattern", true); err != nil {
429410
return err
430411
}
431412
b.Progress.CompleteStep()
432-
b.Progress.PushProgress()
433413

434414
b.logIfVerbose(false, tr("Linking everything together..."))
435415
if err := b.RunRecipe("recipe.hooks.linking.prelink", ".pattern", false); err != nil {
436416
return err
437417
}
438418
b.Progress.CompleteStep()
439-
b.Progress.PushProgress()
440419

441420
if err := b.link(); err != nil {
442421
return err
443422
}
444423
b.Progress.CompleteStep()
445-
b.Progress.PushProgress()
446424

447425
if err := b.RunRecipe("recipe.hooks.linking.postlink", ".pattern", true); err != nil {
448426
return err
449427
}
450428
b.Progress.CompleteStep()
451-
b.Progress.PushProgress()
452429

453430
if err := b.RunRecipe("recipe.hooks.objcopy.preobjcopy", ".pattern", false); err != nil {
454431
return err
455432
}
456433
b.Progress.CompleteStep()
457-
b.Progress.PushProgress()
458434

459435
if err := b.RunRecipe("recipe.objcopy.", ".pattern", true); err != nil {
460436
return err
461437
}
462438
b.Progress.CompleteStep()
463-
b.Progress.PushProgress()
464439

465440
if err := b.RunRecipe("recipe.hooks.objcopy.postobjcopy", ".pattern", true); err != nil {
466441
return err
467442
}
468443
b.Progress.CompleteStep()
469-
b.Progress.PushProgress()
470444

471445
if err := b.mergeSketchWithBootloader(); err != nil {
472446
return err
473447
}
474448
b.Progress.CompleteStep()
475-
b.Progress.PushProgress()
476449

477450
if err := b.RunRecipe("recipe.hooks.postbuild", ".pattern", true); err != nil {
478451
return err
479452
}
480453
b.Progress.CompleteStep()
481-
b.Progress.PushProgress()
482454

483455
if b.compilationDatabase != nil {
484456
b.compilationDatabase.SaveToFile()

Diff for: arduino/builder/compilation.go

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ func (b *Builder) compileFiles(
8484
queue <- source
8585

8686
b.Progress.CompleteStep()
87-
b.Progress.PushProgress()
8887
}
8988
close(queue)
9089
wg.Wait()

Diff for: arduino/builder/internal/progress/progress.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ func (p *Struct) RemoveSubSteps() {
5353
// CompleteStep fixdoc
5454
func (p *Struct) CompleteStep() {
5555
p.Progress += p.StepAmount
56+
p.pushProgress()
5657
}
5758

58-
// PushProgress fixdoc
59-
func (p *Struct) PushProgress() {
59+
func (p *Struct) pushProgress() {
6060
if p.callback != nil {
6161
p.callback(&rpc.TaskProgress{
6262
Percent: p.Progress,

Diff for: arduino/builder/libraries.go

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ func (b *Builder) compileLibraries(libraries libraries.List, includes []string)
123123
objectFiles.AddAll(libraryObjectFiles)
124124

125125
b.Progress.CompleteStep()
126-
b.Progress.PushProgress()
127126
}
128127

129128
return objectFiles, nil

0 commit comments

Comments
 (0)