Skip to content

Commit 805f22d

Browse files
run builder commands without the usage of runCommands func to explicitly handle the substeps
1 parent d9f8722 commit 805f22d

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

Diff for: legacy/builder/builder.go

+26-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (s *Builder) Run(ctx *types.Context) error {
4141
return err
4242
}
4343

44-
var _err error
44+
var _err, mainErr error
4545
commands := []types.Command{
4646
&ContainerSetupHardwareToolsLibsSketchAndProps{},
4747

@@ -92,12 +92,25 @@ func (s *Builder) Run(ctx *types.Context) error {
9292
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true},
9393
}
9494

95-
mainErr := runCommands(ctx, commands)
95+
ctx.Progress.AddSubSteps(len(commands) + 4)
96+
defer ctx.Progress.RemoveSubSteps()
97+
98+
for _, command := range commands {
99+
PrintRingNameIfDebug(ctx, command)
100+
err := command.Run(ctx)
101+
if err != nil {
102+
mainErr = errors.WithStack(err)
103+
break
104+
}
105+
ctx.Progress.CompleteStep()
106+
ctx.PushProgress()
107+
}
96108

97109
if ctx.CompilationDatabase != nil {
98110
ctx.CompilationDatabase.SaveToFile()
99111
}
100112

113+
var otherErr error
101114
commands = []types.Command{
102115
&PrintUsedAndNotUsedLibraries{SketchError: mainErr != nil},
103116

@@ -107,7 +120,16 @@ func (s *Builder) Run(ctx *types.Context) error {
107120

108121
&phases.Sizer{SketchError: mainErr != nil},
109122
}
110-
otherErr := runCommands(ctx, commands)
123+
for _, command := range commands {
124+
PrintRingNameIfDebug(ctx, command)
125+
err := command.Run(ctx)
126+
if err != nil {
127+
otherErr = errors.WithStack(err)
128+
break
129+
}
130+
ctx.Progress.CompleteStep()
131+
ctx.PushProgress()
132+
}
111133

112134
if mainErr != nil {
113135
return mainErr
@@ -193,8 +215,7 @@ func PrintRingNameIfDebug(ctx *types.Context, command types.Command) {
193215
}
194216

195217
func RunBuilder(ctx *types.Context) error {
196-
command := Builder{}
197-
return command.Run(ctx)
218+
return runCommands(ctx, []types.Command{&Builder{}})
198219
}
199220

200221
func RunParseHardware(ctx *types.Context) error {

0 commit comments

Comments
 (0)