From 5f32221c20bb48afd86040494e1ca1214371a709 Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Sat, 29 Feb 2020 12:15:17 +0100 Subject: [PATCH] Add and document buildPreferences setting * Validator for `buildPreferences` * Documentation for `buildPreferences` --- README.md | 8 ++++++++ misc/arduinoValidator.json | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 5b24e3b9..3a66c244 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/misc/arduinoValidator.json b/misc/arduinoValidator.json index 97f41cac..5386fc4f 100644 --- a/misc/arduinoValidator.json +++ b/misc/arduinoValidator.json @@ -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" + } + } } } }