Skip to content

Commit c90453e

Browse files
committed
Removed useless builderCtx field SketchSourceMerged
1 parent 93d62b2 commit c90453e

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
@@ -39,17 +39,16 @@ var (
3939
// PrepareSketchBuildPath copies the sketch source files in the build path.
4040
// The .ino files are merged together to create a .cpp file (by the way, the
4141
// .cpp file still needs to be Arduino-preprocessed to compile).
42-
func PrepareSketchBuildPath(sketch *sketch.Sketch, sourceOverrides map[string]string, buildPath *paths.Path) (offset int, mergedSource string, err error) {
43-
if offset, mergedSource, err = sketchMergeSources(sketch, sourceOverrides); err != nil {
44-
return
45-
}
46-
if err = SketchSaveItemCpp(sketch.MainFile, []byte(mergedSource), buildPath); err != nil {
47-
return
48-
}
49-
if err = sketchCopyAdditionalFiles(sketch, buildPath, sourceOverrides); err != nil {
50-
return
42+
func PrepareSketchBuildPath(sketch *sketch.Sketch, sourceOverrides map[string]string, buildPath *paths.Path) (int, error) {
43+
if offset, mergedSource, err := sketchMergeSources(sketch, sourceOverrides); err != nil {
44+
return 0, err
45+
} else if err := SketchSaveItemCpp(sketch.MainFile, []byte(mergedSource), buildPath); err != nil {
46+
return 0, err
47+
} else if err := sketchCopyAdditionalFiles(sketch, buildPath, sourceOverrides); err != nil {
48+
return 0, err
49+
} else {
50+
return offset, nil
5151
}
52-
return
5352
}
5453

5554
// 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
@@ -34,9 +34,10 @@ func ctagsRunnerTestTemplate(t *testing.T, sketchLocation *paths.Path) []byte {
3434
err := (&builder.ContainerSetupHardwareToolsLibsSketchAndProps{}).Run(ctx)
3535
NoError(t, err)
3636

37-
_, source, err := bldr.PrepareSketchBuildPath(ctx.Sketch, nil, ctx.SketchBuildPath)
37+
_, err = bldr.PrepareSketchBuildPath(ctx.Sketch, nil, ctx.SketchBuildPath)
3838
NoError(t, err)
3939

40+
source := loadPreprocessedSketch(t, ctx)
4041
target := ctx.BuildPath.Join("ctags_target.cpp")
4142
NoError(t, target.WriteFile([]byte(source)))
4243

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestIncludesToIncludeFolders(t *testing.T) {
3636
commands := []types.Command{
3737
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
3838
types.BareCommand(func(ctx *types.Context) error {
39-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
39+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
4040
return _err
4141
}),
4242
&builder.ContainerFindIncludes{},
@@ -60,7 +60,7 @@ func TestIncludesToIncludeFoldersSketchWithIfDef(t *testing.T) {
6060
commands := []types.Command{
6161
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
6262
types.BareCommand(func(ctx *types.Context) error {
63-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
63+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
6464
return _err
6565
}),
6666
&builder.ContainerFindIncludes{},
@@ -83,7 +83,7 @@ func TestIncludesToIncludeFoldersIRremoteLibrary(t *testing.T) {
8383
commands := []types.Command{
8484
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
8585
types.BareCommand(func(ctx *types.Context) error {
86-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
86+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
8787
return _err
8888
}),
8989
&builder.ContainerFindIncludes{},
@@ -109,7 +109,7 @@ func TestIncludesToIncludeFoldersANewLibrary(t *testing.T) {
109109
commands := []types.Command{
110110
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
111111
types.BareCommand(func(ctx *types.Context) error {
112-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
112+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
113113
return _err
114114
}),
115115
&builder.ContainerFindIncludes{},
@@ -140,7 +140,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs(t *testing.T) {
140140
commands := []types.Command{
141141
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
142142
types.BareCommand(func(ctx *types.Context) error {
143-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
143+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
144144
return _err
145145
}),
146146
&builder.ContainerFindIncludes{},
@@ -172,7 +172,7 @@ func TestIncludesToIncludeFoldersDuplicateLibsWithConflictingLibsOutsideOfPlatfo
172172
commands := []types.Command{
173173
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
174174
types.BareCommand(func(ctx *types.Context) error {
175-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
175+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
176176
return _err
177177
}),
178178
&builder.ContainerFindIncludes{},
@@ -204,7 +204,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs2(t *testing.T) {
204204
commands := []types.Command{
205205
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
206206
types.BareCommand(func(ctx *types.Context) error {
207-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
207+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
208208
return _err
209209
}),
210210
&builder.ContainerFindIncludes{},
@@ -230,7 +230,7 @@ func TestIncludesToIncludeFoldersSubfolders(t *testing.T) {
230230
commands := []types.Command{
231231
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
232232
types.BareCommand(func(ctx *types.Context) error {
233-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
233+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
234234
return _err
235235
}),
236236
&builder.ContainerFindIncludes{},

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

+25-23
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestPrototypesAdderBridgeExample(t *testing.T) {
4848
commands := []types.Command{
4949
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
5050
types.BareCommand(func(ctx *types.Context) error {
51-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
51+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
5252
return _err
5353
}),
5454
&builder.ContainerFindIncludes{},
@@ -74,7 +74,7 @@ func TestPrototypesAdderSketchWithIfDef(t *testing.T) {
7474
commands := []types.Command{
7575
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
7676
types.BareCommand(func(ctx *types.Context) error {
77-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
77+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
7878
return _err
7979
}),
8080
&builder.ContainerFindIncludes{},
@@ -100,7 +100,7 @@ func TestPrototypesAdderBaladuino(t *testing.T) {
100100
commands := []types.Command{
101101
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
102102
types.BareCommand(func(ctx *types.Context) error {
103-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
103+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
104104
return _err
105105
}),
106106
&builder.ContainerFindIncludes{},
@@ -126,7 +126,7 @@ func TestPrototypesAdderCharWithEscapedDoubleQuote(t *testing.T) {
126126
commands := []types.Command{
127127
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
128128
types.BareCommand(func(ctx *types.Context) error {
129-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
129+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
130130
return _err
131131
}),
132132
&builder.ContainerFindIncludes{},
@@ -152,7 +152,7 @@ func TestPrototypesAdderIncludeBetweenMultilineComment(t *testing.T) {
152152
commands := []types.Command{
153153
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
154154
types.BareCommand(func(ctx *types.Context) error {
155-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
155+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
156156
return _err
157157
}),
158158
&builder.ContainerFindIncludes{},
@@ -178,7 +178,7 @@ func TestPrototypesAdderLineContinuations(t *testing.T) {
178178
commands := []types.Command{
179179
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
180180
types.BareCommand(func(ctx *types.Context) error {
181-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
181+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
182182
return _err
183183
}),
184184
&builder.ContainerFindIncludes{},
@@ -204,7 +204,7 @@ func TestPrototypesAdderStringWithComment(t *testing.T) {
204204
commands := []types.Command{
205205
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
206206
types.BareCommand(func(ctx *types.Context) error {
207-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
207+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
208208
return _err
209209
}),
210210
&builder.ContainerFindIncludes{},
@@ -230,7 +230,7 @@ func TestPrototypesAdderSketchWithStruct(t *testing.T) {
230230
commands := []types.Command{
231231
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
232232
types.BareCommand(func(ctx *types.Context) error {
233-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
233+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
234234
return _err
235235
}),
236236
&builder.ContainerFindIncludes{},
@@ -264,7 +264,7 @@ func TestPrototypesAdderSketchWithConfig(t *testing.T) {
264264
commands := []types.Command{
265265
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
266266
types.BareCommand(func(ctx *types.Context) error {
267-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
267+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
268268
return _err
269269
}),
270270
&builder.ContainerFindIncludes{},
@@ -296,7 +296,7 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
296296
commands := []types.Command{
297297
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
298298
types.BareCommand(func(ctx *types.Context) error {
299-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
299+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
300300
return _err
301301
}),
302302
&builder.ContainerFindIncludes{},
@@ -305,11 +305,12 @@ func TestPrototypesAdderSketchNoFunctionsTwoFiles(t *testing.T) {
305305
err := command.Run(ctx)
306306
NoError(t, err)
307307
}
308+
mergedSketch := loadPreprocessedSketch(t, ctx)
308309
NoError(t, builder.PreprocessSketchWithCtags(ctx))
309310

310311
preprocessedSketch := loadPreprocessedSketch(t, ctx)
311312
require.Contains(t, preprocessedSketch, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n")
312-
require.Equal(t, ctx.SketchSourceMerged, preprocessedSketch) // No prototypes added
313+
require.Equal(t, mergedSketch, preprocessedSketch) // No prototypes added
313314
}
314315

315316
func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
@@ -324,7 +325,7 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
324325
commands := []types.Command{
325326
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
326327
types.BareCommand(func(ctx *types.Context) error {
327-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
328+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
328329
return _err
329330
}),
330331
&builder.ContainerFindIncludes{},
@@ -333,11 +334,12 @@ func TestPrototypesAdderSketchNoFunctions(t *testing.T) {
333334
err := command.Run(ctx)
334335
NoError(t, err)
335336
}
337+
mergedSketch := loadPreprocessedSketch(t, ctx)
336338
NoError(t, builder.PreprocessSketchWithCtags(ctx))
337339

338340
preprocessedSketch := loadPreprocessedSketch(t, ctx)
339341
require.Contains(t, preprocessedSketch, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n")
340-
require.Equal(t, ctx.SketchSourceMerged, preprocessedSketch) // No prototypes added
342+
require.Equal(t, mergedSketch, preprocessedSketch) // No prototypes added
341343
}
342344

343345
func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
@@ -353,7 +355,7 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
353355
commands := []types.Command{
354356
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
355357
types.BareCommand(func(ctx *types.Context) error {
356-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
358+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
357359
return _err
358360
}),
359361
&builder.ContainerFindIncludes{},
@@ -382,7 +384,7 @@ func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
382384
commands := []types.Command{
383385
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
384386
types.BareCommand(func(ctx *types.Context) error {
385-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
387+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
386388
return _err
387389
}),
388390
&builder.ContainerFindIncludes{},
@@ -422,7 +424,7 @@ func TestPrototypesAdderSketchWithFunctionSignatureInsideIFDEF(t *testing.T) {
422424
commands := []types.Command{
423425
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
424426
types.BareCommand(func(ctx *types.Context) error {
425-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
427+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
426428
return _err
427429
}),
428430
&builder.ContainerFindIncludes{},
@@ -456,7 +458,7 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
456458
commands := []types.Command{
457459
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
458460
types.BareCommand(func(ctx *types.Context) error {
459-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
461+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
460462
return _err
461463
}),
462464
&builder.ContainerFindIncludes{},
@@ -489,7 +491,7 @@ func TestPrototypesAdderSketchWithTypename(t *testing.T) {
489491
commands := []types.Command{
490492
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
491493
types.BareCommand(func(ctx *types.Context) error {
492-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
494+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
493495
return _err
494496
}),
495497
&builder.ContainerFindIncludes{},
@@ -524,7 +526,7 @@ func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
524526
commands := []types.Command{
525527
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
526528
types.BareCommand(func(ctx *types.Context) error {
527-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
529+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
528530
return _err
529531
}),
530532
&builder.ContainerFindIncludes{},
@@ -556,7 +558,7 @@ func TestPrototypesAdderSketchWithIfDef2SAM(t *testing.T) {
556558
commands := []types.Command{
557559
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
558560
types.BareCommand(func(ctx *types.Context) error {
559-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
561+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
560562
return _err
561563
}),
562564
&builder.ContainerFindIncludes{},
@@ -588,7 +590,7 @@ func TestPrototypesAdderSketchWithConst(t *testing.T) {
588590
commands := []types.Command{
589591
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
590592
types.BareCommand(func(ctx *types.Context) error {
591-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
593+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
592594
return _err
593595
}),
594596
&builder.ContainerFindIncludes{},
@@ -614,7 +616,7 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
614616
commands := []types.Command{
615617
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
616618
types.BareCommand(func(ctx *types.Context) error {
617-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
619+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
618620
return _err
619621
}),
620622
&builder.ContainerFindIncludes{},
@@ -640,7 +642,7 @@ func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) {
640642
commands := []types.Command{
641643
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
642644
types.BareCommand(func(ctx *types.Context) error {
643-
ctx.LineOffset, ctx.SketchSourceMerged, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
645+
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
644646
return _err
645647
}),
646648
&builder.ContainerFindIncludes{},

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

-4
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ type Context struct {
101101
Sketch *sketch.Sketch
102102
WarningsLevel string
103103

104-
// Arduino sketch (.ino) to C++ (.cpp) conversion steps:
105-
// 1. Concatenate *.ino files into a single merged source file -> SketchSourceMerged
106-
SketchSourceMerged string
107-
108104
// Libraries handling
109105
LibrariesManager *librariesmanager.LibrariesManager
110106
LibrariesResolver *librariesresolver.Cpp

0 commit comments

Comments
 (0)