Skip to content

Commit 6d63b54

Browse files
committed
Moved GCCPreprocRunner into proper place
1 parent 563d451 commit 6d63b54

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

legacy/builder/gcc_preproc_runner.go renamed to arduino/builder/preprocessor/gcc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file is part of arduino-cli.
22
//
3-
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
3+
// Copyright 2023 ARDUINO SA (http://www.arduino.cc/)
44
//
55
// This software is released under the GNU General Public License version 3,
66
// which covers the main part of arduino-cli.
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to license@arduino.cc.
1515

16-
package builder
16+
package preprocessor
1717

1818
import (
1919
"context"
@@ -24,11 +24,11 @@ import (
2424
f "github.com/arduino/arduino-cli/internal/algorithms"
2525
"github.com/arduino/arduino-cli/legacy/builder/utils"
2626
"github.com/arduino/go-paths-helper"
27-
properties "github.com/arduino/go-properties-orderedmap"
27+
"github.com/arduino/go-properties-orderedmap"
2828
"github.com/pkg/errors"
2929
)
3030

31-
func GCCPreprocRunner(sourceFilePath *paths.Path, targetFilePath *paths.Path, includes paths.PathList, buildProperties *properties.Map) ([]byte, []byte, error) {
31+
func GCC(sourceFilePath *paths.Path, targetFilePath *paths.Path, includes paths.PathList, buildProperties *properties.Map) ([]byte, []byte, error) {
3232
gccBuildProperties := properties.NewMap()
3333
gccBuildProperties.Set("preproc.macros.flags", "-w -x c++ -E -CC")
3434
gccBuildProperties.Merge(buildProperties)

legacy/builder/container_add_prototypes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func PreprocessSketchWithCtags(ctx *types.Context) error {
3434

3535
// Run preprocessor
3636
sourceFile := ctx.SketchBuildPath.Join(ctx.Sketch.MainFile.Base() + ".cpp")
37-
gccStdout, gccStderr, err := GCCPreprocRunner(sourceFile, targetFilePath, ctx.IncludeFolders, ctx.BuildProperties)
37+
gccStdout, gccStderr, err := preprocessor.GCC(sourceFile, targetFilePath, ctx.IncludeFolders, ctx.BuildProperties)
3838
if ctx.Verbose {
3939
ctx.WriteStdout(gccStdout)
4040
ctx.WriteStderr(gccStderr)

legacy/builder/container_find_includes.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ import (
9898
"os/exec"
9999
"time"
100100

101+
"github.com/arduino/arduino-cli/arduino/builder/preprocessor"
101102
"github.com/arduino/arduino-cli/arduino/globals"
102103
"github.com/arduino/arduino-cli/arduino/libraries"
103104
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
@@ -370,7 +371,7 @@ func findIncludesUntilDone(ctx *types.Context, cache *includeCache, sourceFileQu
370371
}
371372
} else {
372373
var preproc_stdout []byte
373-
preproc_stdout, preproc_stderr, preproc_err = GCCPreprocRunner(sourcePath, targetFilePath, includes, ctx.BuildProperties)
374+
preproc_stdout, preproc_stderr, preproc_err = preprocessor.GCC(sourcePath, targetFilePath, includes, ctx.BuildProperties)
374375
if ctx.Verbose {
375376
ctx.WriteStdout(preproc_stdout)
376377
ctx.WriteStdout(preproc_stderr)
@@ -405,7 +406,7 @@ func findIncludesUntilDone(ctx *types.Context, cache *includeCache, sourceFileQu
405406
if preproc_err == nil || preproc_stderr == nil {
406407
// Filename came from cache, so run preprocessor to obtain error to show
407408
var preproc_stdout []byte
408-
preproc_stdout, preproc_stderr, preproc_err = GCCPreprocRunner(sourcePath, targetFilePath, includes, ctx.BuildProperties)
409+
preproc_stdout, preproc_stderr, preproc_err = preprocessor.GCC(sourcePath, targetFilePath, includes, ctx.BuildProperties)
409410
if ctx.Verbose {
410411
ctx.WriteStdout(preproc_stdout)
411412
}

legacy/builder/preprocess_sketch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"runtime"
2424

2525
bldr "github.com/arduino/arduino-cli/arduino/builder"
26+
"github.com/arduino/arduino-cli/arduino/builder/preprocessor"
2627
"github.com/arduino/arduino-cli/legacy/builder/types"
2728
"github.com/arduino/arduino-cli/legacy/builder/utils"
2829
properties "github.com/arduino/go-properties-orderedmap"
@@ -36,7 +37,7 @@ func PreprocessSketchWithArduinoPreprocessor(ctx *types.Context) error {
3637

3738
sourceFile := ctx.SketchBuildPath.Join(ctx.Sketch.MainFile.Base() + ".cpp")
3839
targetFile := ctx.PreprocPath.Join("sketch_merged.cpp")
39-
gccStdout, gccStderr, err := GCCPreprocRunner(sourceFile, targetFile, ctx.IncludeFolders, ctx.BuildProperties)
40+
gccStdout, gccStderr, err := preprocessor.GCC(sourceFile, targetFile, ctx.IncludeFolders, ctx.BuildProperties)
4041
if ctx.Verbose {
4142
ctx.WriteStdout(gccStdout)
4243
ctx.WriteStderr(gccStderr)

0 commit comments

Comments
 (0)