Skip to content

Commit 7cff862

Browse files
committed
uniform parameters between preprocesors
1 parent de3c000 commit 7cff862

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

legacy/builder/builder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ func PreprocessSketch(ctx *types.Context) error {
142142
var err error
143143
if ctx.UseArduinoPreprocessor {
144144
normalOutput, verboseOutput, err = PreprocessSketchWithArduinoPreprocessor(
145-
ctx.Sketch, ctx.BuildPath, ctx.IncludeFolders, ctx.SketchBuildPath,
146-
ctx.BuildProperties)
145+
ctx.Sketch, ctx.BuildPath, ctx.IncludeFolders, ctx.LineOffset,
146+
ctx.BuildProperties, ctx.OnlyUpdateCompilationDatabase)
147147
} else {
148148
normalOutput, verboseOutput, err = preprocessor.PreprocessSketchWithCtags(
149149
ctx.Sketch, ctx.BuildPath, ctx.IncludeFolders, ctx.LineOffset,

legacy/builder/preprocess_sketch.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ import (
3131
"github.com/pkg/errors"
3232
)
3333

34-
func PreprocessSketchWithArduinoPreprocessor(sk *sketch.Sketch, buildPath *paths.Path, includeFolders paths.PathList, sketchBuildPath *paths.Path, buildProperties *properties.Map) ([]byte, []byte, error) {
34+
func PreprocessSketchWithArduinoPreprocessor(sk *sketch.Sketch, buildPath *paths.Path, includeFolders paths.PathList, lineOffset int, buildProperties *properties.Map, onlyUpdateCompilationDatabase bool) ([]byte, []byte, error) {
3535
verboseOut := &bytes.Buffer{}
3636
normalOut := &bytes.Buffer{}
3737
if err := buildPath.Join("preproc").MkdirAll(); err != nil {
3838
return nil, nil, err
3939
}
4040

41-
sourceFile := sketchBuildPath.Join(sk.MainFile.Base() + ".cpp")
41+
sourceFile := buildPath.Join("sketch", sk.MainFile.Base()+".cpp")
4242
targetFile := buildPath.Join("preproc", "sketch_merged.cpp")
4343
gccStdout, gccStderr, err := preprocessor.GCC(sourceFile, targetFile, includeFolders, buildProperties)
4444
verboseOut.Write(gccStdout)
@@ -83,5 +83,6 @@ func PreprocessSketchWithArduinoPreprocessor(sk *sketch.Sketch, buildPath *paths
8383
}
8484
result := utils.NormalizeUTF8(commandStdOut)
8585

86-
return normalOut.Bytes(), verboseOut.Bytes(), bldr.SketchSaveItemCpp(sk.MainFile, result, sketchBuildPath)
86+
err = bldr.SketchSaveItemCpp(sk.MainFile, result, buildPath.Join("sketch"))
87+
return normalOut.Bytes(), verboseOut.Bytes(), err
8788
}

0 commit comments

Comments
 (0)