From ea876e243d6b9055047b4083ac8443192129dcdf Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Sat, 18 Feb 2023 17:47:25 +0100 Subject: [PATCH] platformio: add json validation step to fs builder --- data/profiles/home-lighting.json | 2 +- platformio.ini | 18 ++++++++++-------- verify-configs.py | 13 +++++++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 verify-configs.py diff --git a/data/profiles/home-lighting.json b/data/profiles/home-lighting.json index f9f0f12..5b038e9 100644 --- a/data/profiles/home-lighting.json +++ b/data/profiles/home-lighting.json @@ -12,6 +12,6 @@ "Idle": ["Solid", "MPU5060", "Pulse", "IdleColors", "CircadianRhythm"], "Acid": ["Chimes", "Pulse", "MPU5060", "IdleColors", "Rainbow"], "Flashlight": ["Flashlight"] - } + }, "surfaceMap": "default" } diff --git a/platformio.ini b/platformio.ini index be5d910..62e28f9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,6 +11,7 @@ [common_env_data] src_filter = "+<*> -<.git/> -<.svn/> - -" lib_ldf_mode = chain+ +extra_scripts = verify-configs.py src_build_flags = -DRENDERBUG_VERSION=3 -DRENDERBUG_LED_PIN=14 @@ -91,6 +92,7 @@ src_build_flags = [env:esp32] extends = config_nocolor +extra_scripts = verify-configs.py platform = espressif32 board = featheresp32 framework = arduino @@ -170,15 +172,15 @@ lib_deps = ESP8266WiFi ${config_ota.lib_deps} -[env:home_lighting_grb] -extends = env:home_lighting -src_build_flags = - ${env:home_lighting.src_build_flags} - -DRENDERBUG_LED_PACKING=GRB +#[env:home_lighting_grb] +#extends = env:esp8266_wifi config_u8display +#src_build_flags = +# ${env:home_lighting.src_build_flags} +# -DRENDERBUG_LED_PACKING=GRB -[env:home_lighting-12f] -extends = env:home_lighting -board = esp12e +#[env:home_lighting-12f] +#extends = env:esp8266_wifi config_u8display +#board = esp12e ;[env:photon] ;platform = particlephoton diff --git a/verify-configs.py b/verify-configs.py new file mode 100644 index 0000000..6ddfa82 --- /dev/null +++ b/verify-configs.py @@ -0,0 +1,13 @@ +Import("env") + +import fnmatch +import os + +def verify_json(source, target, env): + for root, dirnames, files in os.walk("data"): + for file in files: + if file.endswith(".json"): + if (env.Execute("json_verify < " + root + '/' + file)): + Exit(1) + +env.AddPreAction("buildfs", verify_json)