Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55251c5

Browse files
committed
Move arduino-proprocessor under experimental flag
1 parent 2b1cfdd commit 55251c5

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

‎arduino-builder/main.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const FLAG_DAEMON = "daemon"
8888
const FLAG_VID_PID = "vid-pid"
8989
const FLAG_JOBS = "jobs"
9090
const FLAG_TRACE = "trace"
91+
const FLAG_EXPERIMENTAL = "experimental"
9192

9293
type foldersFlag []string
9394

@@ -149,6 +150,7 @@ var daemonFlag *bool
149150
var vidPidFlag *string
150151
var jobsFlag *int
151152
var traceFlag *bool
153+
var experimentalFeatures *bool
152154

153155
func init() {
154156
compileFlag = flag.Bool(FLAG_ACTION_COMPILE, false, "compiles the given sketch")
@@ -176,6 +178,7 @@ func init() {
176178
vidPidFlag = flag.String(FLAG_VID_PID, "", "specify to use vid/pid specific build properties, as defined in boards.txt")
177179
jobsFlag = flag.Int(FLAG_JOBS, 0, "specify how many concurrent gcc processes should run at the same time. Defaults to the number of available cores on the running machine")
178180
traceFlag = flag.Bool(FLAG_TRACE, false, "traces the whole process lifecycle")
181+
experimentalFeatures = flag.Bool(FLAG_EXPERIMENTAL, false, "enables experimental features")
179182
}
180183

181184
func main() {
@@ -222,6 +225,11 @@ func main() {
222225

223226
ctx := &types.Context{}
224227

228+
// place here all experimental features that should live under this flag
229+
if *experimentalFeatures {
230+
ctx.UseArduinoPreprocessor = true
231+
}
232+
225233
if *daemonFlag {
226234
var loggerBuffer []string
227235
logger := i18n.AccumulatorLogger{}

‎builder.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ func (s *Builder) Run(ctx *types.Context) error {
142142
return otherErr
143143
}
144144

145+
type PreprocessSketch struct{}
146+
147+
func (s *PreprocessSketch) Run(ctx *types.Context) error {
148+
var commands []types.Command
149+
if ctx.UseArduinoPreprocessor {
150+
commands = append(commands, &PreprocessSketchArduino{})
151+
} else {
152+
commands = append(commands, &ContainerAddPrototypes{})
153+
}
154+
return runCommands(ctx, commands, true)
155+
}
156+
145157
type Preprocess struct{}
146158

147159
func (s *Preprocess) Run(ctx *types.Context) error {

‎preprocess_sketch.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ import (
4343
"github.com/arduino/arduino-builder/utils"
4444
)
4545

46-
type PreprocessSketch struct{}
46+
type PreprocessSketchArduino struct{}
4747

48-
func (s *PreprocessSketch) Run(ctx *types.Context) error {
48+
func (s *PreprocessSketchArduino) Run(ctx *types.Context) error {
4949
sourceFile := filepath.Join(ctx.SketchBuildPath, filepath.Base(ctx.Sketch.MainFile.Name)+".cpp")
5050
commands := []types.Command{
5151
&ArduinoPreprocessorRunner{},

‎types/context.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ type Context struct {
100100

101101
// Reuse old tools since the backing storage didn't change
102102
CanUseCachedTools bool
103+
104+
// Experimental: use arduino-preprocessor to create prototypes
105+
UseArduinoPreprocessor bool
103106
}
104107

105108
func (ctx *Context) ExtractBuildOptions() properties.Map {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /