Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 5f32221

Browse files
elektronikworkshopadiazulay
authored andcommitted
Add and document buildPreferences setting
* Validator for `buildPreferences` * Documentation for `buildPreferences`
1 parent 9543ba7 commit 5f32221

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ The following settings are as per sketch settings of the Arduino extension. You
117117
- `"global"`: Use the global settings (default)
118118
- `"disable"`: Disable the auto-generation even if globally enabled
119119
- `"enable"`: Enable the auto-generation even if globally disabled
120+
- `buildPreferences` - Set Arduino preferences which then are used during any build (verify, upload, ...). This allows for extra defines, compiler options or includes. The preference key-value pairs must be set as follows:
121+
```json
122+
"buildPreferences": [
123+
["build.extra_flags", "-DMY_DEFINE=666 -DANOTHER_DEFINE=3.14 -Wall"],
124+
["compiler.cpp.extra_flags", "-DYET_ANOTER=\"hello\""]
125+
]
126+
}
127+
```
120128

121129
## Pre- and Post-Build Commands
122130
On Windows the commands run within a `cmd`-, on Linux and OSX within a `bash`-instance. Therefore your command can be anything what you can run within those shells. Instead of running a command you can invoke a script. This makes writing more complex pre-/post-build mechanisms much easier and opens up the possibility to run python or other scripting languages.

misc/arduinoValidator.json

+12
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@
5252
"description": "Command to be run after every build",
5353
"type": "string",
5454
"minLength": 1
55+
},
56+
"buildPreferences": {
57+
"description": "Arduino preferences which are passed to the Arduino back-end during build",
58+
"type": "array",
59+
"items": {
60+
"type":"array",
61+
"minItems": 2,
62+
"maxItems": 2,
63+
"items": {
64+
"type": "string"
65+
}
66+
}
5567
}
5668
}
5769
}

0 commit comments

Comments
 (0)