mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-23 19:12:23 +00:00
Default optional debug flags safely in strict shells
This commit is contained in:
1 parent
eee4fa9e98
commit
326f8cdf78
2 files changed
+27
-2
No files matched your search
+2
-2
@@ -2644,8 +2644,8 @@ disable_debug_flags() {
|
||||
usb_logging_undefs=""
|
||||
fi
|
||||
|
||||
if [ "$DISABLE_DEBUG" == "1" ]; then
|
||||
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} ${usb_logging_undefs} -UBLE_DEBUG_LOGGING -UWIFI_DEBUG_LOGGING -UBRIDGE_DEBUG -UGPS_NMEA_DEBUG -UCORE_DEBUG_LEVEL -UESPNOW_DEBUG_LOGGING -UDEBUG_RP2040_WIRE -UDEBUG_RP2040_SPI -UDEBUG_RP2040_CORE -UDEBUG_RP2040_PORT -URADIOLIB_DEBUG_SPI -DCFG_DEBUG=0 -URADIOLIB_DEBUG_BASIC -URADIOLIB_DEBUG_PROTOCOL"
|
||||
if [ "${DISABLE_DEBUG:-0}" == "1" ]; then
|
||||
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS:-} ${usb_logging_undefs} -UBLE_DEBUG_LOGGING -UWIFI_DEBUG_LOGGING -UBRIDGE_DEBUG -UGPS_NMEA_DEBUG -UCORE_DEBUG_LEVEL -UESPNOW_DEBUG_LOGGING -UDEBUG_RP2040_WIRE -UDEBUG_RP2040_SPI -UDEBUG_RP2040_CORE -UDEBUG_RP2040_PORT -URADIOLIB_DEBUG_SPI -DCFG_DEBUG=0 -URADIOLIB_DEBUG_BASIC -URADIOLIB_DEBUG_PROTOCOL"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,31 @@ fail() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Optional debug settings must remain usable by strict shell callers before
|
||||
# any PlatformIO flags have been initialized.
|
||||
(
|
||||
unset DISABLE_DEBUG PLATFORMIO_BUILD_FLAGS
|
||||
disable_debug_flags
|
||||
[ -z "${PLATFORMIO_BUILD_FLAGS+x}" ] \
|
||||
|| fail "default debug policy unexpectedly set build flags"
|
||||
DISABLE_DEBUG=0
|
||||
PLATFORMIO_BUILD_FLAGS=-DKEEP_CALLER_FLAG=1
|
||||
disable_debug_flags
|
||||
[ "$PLATFORMIO_BUILD_FLAGS" = -DKEEP_CALLER_FLAG=1 ] \
|
||||
|| fail "disabled debug override changed caller flags"
|
||||
DISABLE_DEBUG=1
|
||||
unset PLATFORMIO_BUILD_FLAGS
|
||||
disable_debug_flags
|
||||
[[ "$PLATFORMIO_BUILD_FLAGS" == *"-UMESH_DEBUG -UMESH_PACKET_LOGGING"* ]] \
|
||||
|| fail "explicit debug disable lost the USB debug undefines"
|
||||
[[ "$PLATFORMIO_BUILD_FLAGS" == *"-DCFG_DEBUG=0"* ]] \
|
||||
|| fail "explicit debug disable lost CFG_DEBUG"
|
||||
PLATFORMIO_BUILD_FLAGS=-DKEEP_CALLER_FLAG=1
|
||||
disable_debug_flags
|
||||
[[ "$PLATFORMIO_BUILD_FLAGS" == -DKEEP_CALLER_FLAG=1* ]] \
|
||||
|| fail "explicit debug disable discarded caller flags"
|
||||
)
|
||||
|
||||
[ "$OPTION3_BUILD_WORKERS" -eq 1 ] \
|
||||
|| fail "logging matrix permits concurrent PlatformIO target builds"
|
||||
|
||||
|
||||
Reference in new issue
Block a user