Skip to content

Commit

Permalink
Add and document buildPreferences setting
Browse files Browse the repository at this point in the history
* Validator for `buildPreferences`
* Documentation for `buildPreferences`
  • Loading branch information
elektronikworkshop authored and adiazulay committed Jan 19, 2021
1 parent 9543ba7 commit 5f32221
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ The following settings are as per sketch settings of the Arduino extension. You
- `"global"`: Use the global settings (default)
- `"disable"`: Disable the auto-generation even if globally enabled
- `"enable"`: Enable the auto-generation even if globally disabled
- `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:
```json
"buildPreferences": [
["build.extra_flags", "-DMY_DEFINE=666 -DANOTHER_DEFINE=3.14 -Wall"],
["compiler.cpp.extra_flags", "-DYET_ANOTER=\"hello\""]
]
}
```

## Pre- and Post-Build Commands
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.
Expand Down
12 changes: 12 additions & 0 deletions misc/arduinoValidator.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@
"description": "Command to be run after every build",
"type": "string",
"minLength": 1
},
"buildPreferences": {
"description": "Arduino preferences which are passed to the Arduino back-end during build",
"type": "array",
"items": {
"type":"array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "string"
}
}
}
}
}

0 comments on commit 5f32221

Please sign in to comment.