Skip to content

Commit 84f2702

Browse files
committed
Removed useless builderCtx field SketchSourceMerged
1 parent 5b897ce commit 84f2702

File tree

6 files changed

+46
-48
lines changed

6 files changed

+46
-48
lines changed

Diff for: arduino/builder/sketch.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ var (
3838
// PrepareSketchBuildPath copies the sketch source files in the build path.
3939
// The .ino files are merged together to create a .cpp file (by the way, the
4040
// .cpp file still needs to be Arduino-preprocessed to compile).
41-
func PrepareSketchBuildPath(sketch *sketch.Sketch, sourceOverrides map[string]string, buildPath *paths.Path) (offset int, mergedSource string, err error) {
42-
if offset, mergedSource, err = sketchMergeSources(sketch, sourceOverrides); err != nil {
43-
return
41+
func PrepareSketchBuildPath(sketch *sketch.Sketch, sourceOverrides map[string]string, buildPath *paths.Path) (int, error) {
42+
if offset, mergedSource, err := sketchMergeSources(sketch, sourceOverrides); err != nil {
43+
return 0, err
44+
} else if err := SketchSaveItemCpp(sketch.MainFile, []byte(mergedSource), buildPath); err != nil {
45+
return 0, err
46+
} else if err := sketchCopyAdditionalFiles(sketch, buildPath, sourceOverrides); err != nil {
47+
return 0, err
48+
} else {
49+
return offset, nil
4450
}
45-
if err = SketchSaveItemCpp(sketch.MainFile, []byte(mergedSource), buildPath); err != nil {
46-
return
47-
}
48-
if err = sketchCopyAdditionalFiles(sketch, buildPath, sourceOverrides); err != nil {
49-
return
50-
}
51-
return
5251
}
5352

5453
// SketchSaveItemCpp saves a preprocessed .cpp sketch file on disk

Diff for: legacy/builder/builder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (s *Builder) Run(ctx *types.Context) error {
4949
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.prebuild", Suffix: ".pattern"},
5050

5151
types.BareCommand(func(ctx *types.Context) error {
52-
ctx.LineOffset, ctx.SketchSourceMerged, _err = builder.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
52+
ctx.LineOffset, _err = builder.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
5353
return _err
5454
}),
5555

@@ -141,7 +141,7 @@ func (s *Preprocess) Run(ctx *types.Context) error {
141141
&RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.prebuild", Suffix: ".pattern"},
142142

143143
types.BareCommand(func(ctx *types.Context) error {
144-
ctx.LineOffset, ctx.SketchSourceMerged, _err = builder.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
144+
ctx.LineOffset, _err = builder.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
145145
return _err
146146
}),
147147

Diff for: legacy/builder/test/ctags_runner_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ func ctagsRunnerTestTemplate(t *testing.T, sketchLocation *paths.Path) []byte {
4747
err := (&builder.ContainerSetupHardwareToolsLibsSketchAndProps{}).Run(ctx)
4848
NoError(t, err)
4949

50-
_, source, err := bldr.PrepareSketchBuildPath(ctx.Sketch, nil, ctx.SketchBuildPath)
50+
_, err = bldr.PrepareSketchBuildPath(ctx.Sketch, nil, ctx.SketchBuildPath)
5151
NoError(t, err)
5252

53+
source := loadPreprocessedSketch(t, ctx)
5354
target := ctx.BuildPath.Join("ctags_target.cpp")
5455
NoError(t, target.Parent().MkdirAll())
5556
NoError(t, target.WriteFile([]byte(source)))

Diff for: legacy/builder/test/includes_to_include_folders_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestIncludesToIncludeFolders(t *testing.T) {
4747
commands := []types.Command{
4848
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
4949
types.BareCommand(func(ctx *types.Context) error {
50-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
50+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
5151
return _err
5252
}),
5353
&builder.ContainerFindIncludes{},
@@ -82,7 +82,7 @@ func TestIncludesToIncludeFoldersSketchWithIfDef(t *testing.T) {
8282
commands := []types.Command{
8383
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
8484
types.BareCommand(func(ctx *types.Context) error {
85-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
85+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
8686
return _err
8787
}),
8888
&builder.ContainerFindIncludes{},
@@ -116,7 +116,7 @@ func TestIncludesToIncludeFoldersIRremoteLibrary(t *testing.T) {
116116
commands := []types.Command{
117117
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
118118
types.BareCommand(func(ctx *types.Context) error {
119-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
119+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
120120
return _err
121121
}),
122122
&builder.ContainerFindIncludes{},
@@ -153,7 +153,7 @@ func TestIncludesToIncludeFoldersANewLibrary(t *testing.T) {
153153
commands := []types.Command{
154154
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
155155
types.BareCommand(func(ctx *types.Context) error {
156-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
156+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
157157
return _err
158158
}),
159159
&builder.ContainerFindIncludes{},
@@ -189,7 +189,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs(t *testing.T) {
189189
commands := []types.Command{
190190
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
191191
types.BareCommand(func(ctx *types.Context) error {
192-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
192+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
193193
return _err
194194
}),
195195
&builder.ContainerFindIncludes{},
@@ -226,7 +226,7 @@ func TestIncludesToIncludeFoldersDuplicateLibsWithConflictingLibsOutsideOfPlatfo
226226
commands := []types.Command{
227227
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
228228
types.BareCommand(func(ctx *types.Context) error {
229-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
229+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
230230
return _err
231231
}),
232232
&builder.ContainerFindIncludes{},
@@ -263,7 +263,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs2(t *testing.T) {
263263
commands := []types.Command{
264264
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
265265
types.BareCommand(func(ctx *types.Context) error {
266-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
266+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
267267
return _err
268268
}),
269269
&builder.ContainerFindIncludes{},
@@ -300,7 +300,7 @@ func TestIncludesToIncludeFoldersSubfolders(t *testing.T) {
300300
commands := []types.Command{
301301
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
302302
types.BareCommand(func(ctx *types.Context) error {
303-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
303+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
304304
return _err
305305
}),
306306
&builder.ContainerFindIncludes{},

Diff for: legacy/builder/test/prototypes_adder_test.go

+25-23
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
5757
commands := []types.Command{
5858
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
5959
types.BareCommand(func(ctx *types.Context) error {
60-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
60+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
6161
return _err
6262
}),
6363
&builder.ContainerFindIncludes{},
@@ -93,7 +93,7 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
9393
commands := []types.Command{
9494
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
9595
types.BareCommand(func(ctx *types.Context) error {
96-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
96+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
9797
return _err
9898
}),
9999
&builder.ContainerFindIncludes{},
@@ -129,7 +129,7 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
129129
commands := []types.Command{
130130
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
131131
types.BareCommand(func(ctx *types.Context) error {
132-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
132+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
133133
return _err
134134
}),
135135
&builder.ContainerFindIncludes{},
@@ -165,7 +165,7 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
165165
commands := []types.Command{
166166
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
167167
types.BareCommand(func(ctx *types.Context) error {
168-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
168+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
169169
return _err
170170
}),
171171
&builder.ContainerFindIncludes{},
@@ -201,7 +201,7 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
201201
commands := []types.Command{
202202
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
203203
types.BareCommand(func(ctx *types.Context) error {
204-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
204+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
205205
return _err
206206
}),
207207
&builder.ContainerFindIncludes{},
@@ -237,7 +237,7 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
237237
commands := []types.Command{
238238
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
239239
types.BareCommand(func(ctx *types.Context) error {
240-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
240+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
241241
return _err
242242
}),
243243
&builder.ContainerFindIncludes{},
@@ -273,7 +273,7 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
273273
commands := []types.Command{
274274
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
275275
types.BareCommand(func(ctx *types.Context) error {
276-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
276+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
277277
return _err
278278
}),
279279
&builder.ContainerFindIncludes{},
@@ -309,7 +309,7 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
309309
commands := []types.Command{
310310
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
311311
types.BareCommand(func(ctx *types.Context) error {
312-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
312+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
313313
return _err
314314
}),
315315
&builder.ContainerFindIncludes{},
@@ -353,7 +353,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
353353
commands := []types.Command{
354354
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
355355
types.BareCommand(func(ctx *types.Context) error {
356-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
356+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
357357
return _err
358358
}),
359359
&builder.ContainerFindIncludes{},
@@ -395,7 +395,7 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
395395
commands := []types.Command{
396396
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
397397
types.BareCommand(func(ctx *types.Context) error {
398-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
398+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
399399
return _err
400400
}),
401401
&builder.ContainerFindIncludes{},
@@ -405,11 +405,12 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
405405
err := command.Run(ctx)
406406
NoError(t, err)
407407
}
408+
mergedSketch := loadPreprocessedSketch(t, ctx)
408409
NoError(t, builder.PreprocessSketchWithCtags(ctx))
409410

410411
preprocessedSketch := loadPreprocessedSketch(t, ctx)
411412
require.Contains(t, preprocessedSketch, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n")
412-
require.Equal(t, ctx.SketchSourceMerged, preprocessedSketch) // No prototypes added
413+
require.Equal(t, mergedSketch, preprocessedSketch) // No prototypes added
413414
}
414415

415416
func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
@@ -434,7 +435,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
434435
commands := []types.Command{
435436
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
436437
types.BareCommand(func(ctx *types.Context) error {
437-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
438+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
438439
return _err
439440
}),
440441
&builder.ContainerFindIncludes{},
@@ -444,11 +445,12 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
444445
err := command.Run(ctx)
445446
NoError(t, err)
446447
}
448+
mergedSketch := loadPreprocessedSketch(t, ctx)
447449
NoError(t, builder.PreprocessSketchWithCtags(ctx))
448450

449451
preprocessedSketch := loadPreprocessedSketch(t, ctx)
450452
require.Contains(t, preprocessedSketch, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n")
451-
require.Equal(t, ctx.SketchSourceMerged, preprocessedSketch) // No prototypes added
453+
require.Equal(t, mergedSketch, preprocessedSketch) // No prototypes added
452454
}
453455

454456
func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
@@ -473,7 +475,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
473475
commands := []types.Command{
474476
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
475477
types.BareCommand(func(ctx *types.Context) error {
476-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
478+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
477479
return _err
478480
}),
479481
&builder.ContainerFindIncludes{},
@@ -512,7 +514,7 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
512514
commands := []types.Command{
513515
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
514516
types.BareCommand(func(ctx *types.Context) error {
515-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
517+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
516518
return _err
517519
}),
518520
&builder.ContainerFindIncludes{},
@@ -562,7 +564,7 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
562564
commands := []types.Command{
563565
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
564566
types.BareCommand(func(ctx *types.Context) error {
565-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
567+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
566568
return _err
567569
}),
568570
&builder.ContainerFindIncludes{},
@@ -601,7 +603,7 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
601603
commands := []types.Command{
602604
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
603605
types.BareCommand(func(ctx *types.Context) error {
604-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
606+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
605607
return _err
606608
}),
607609
&builder.ContainerFindIncludes{},
@@ -639,7 +641,7 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
639641
commands := []types.Command{
640642
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
641643
types.BareCommand(func(ctx *types.Context) error {
642-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
644+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
643645
return _err
644646
}),
645647
&builder.ContainerFindIncludes{},
@@ -684,7 +686,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
684686
commands := []types.Command{
685687
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
686688
types.BareCommand(func(ctx *types.Context) error {
687-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
689+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
688690
return _err
689691
}),
690692
&builder.ContainerFindIncludes{},
@@ -726,7 +728,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
726728
commands := []types.Command{
727729
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
728730
types.BareCommand(func(ctx *types.Context) error {
729-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
731+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
730732
return _err
731733
}),
732734
&builder.ContainerFindIncludes{},
@@ -768,7 +770,7 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
768770
commands := []types.Command{
769771
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
770772
types.BareCommand(func(ctx *types.Context) error {
771-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
773+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
772774
return _err
773775
}),
774776
&builder.ContainerFindIncludes{},
@@ -804,7 +806,7 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
804806
commands := []types.Command{
805807
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
806808
types.BareCommand(func(ctx *types.Context) error {
807-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
809+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
808810
return _err
809811
}),
810812
&builder.ContainerFindIncludes{},
@@ -839,7 +841,7 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
839841
commands := []types.Command{
840842
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
841843
types.BareCommand(func(ctx *types.Context) error {
842-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
844+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
843845
return _err
844846
}),
845847
&builder.ContainerFindIncludes{},

Diff for: legacy/builder/types/context.go

-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ type Context struct {
104104
Sketch *sketch.Sketch
105105
WarningsLevel string
106106

107-
// Arduino sketch (.ino) to C++ (.cpp) conversion steps:
108-
// 1. Concatenate *.ino files into a single merged source file -> SketchSourceMerged
109-
SketchSourceMerged string
110-
111107
// Libraries handling
112108
LibrariesManager *librariesmanager.LibrariesManager
113109
LibrariesResolver *librariesresolver.Cpp

0 commit comments

Comments
 (0)