diff --git a/HISTORY.rst b/HISTORY.rst index 85709451..a2c8f297 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -37,6 +37,7 @@ PlatformIO Core 6 * Improved a serial port finder for a board with predefined HWIDs * Fixed an issue when the `build_unflags `__ operation ignores a flag value (`issue #4309 `_) * Fixed an issue when the `build_unflags `__ option was not applied to the ``ASPPFLAGS`` scope +* Fixed an issue on Windows OS when flags were wrapped to the temporary file while generating the `Compilation database "compile_commands.json" `__ 6.0.2 (2022-06-01) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 9cbd387b..e46dd079 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -59,13 +59,13 @@ DEFAULT_ENV_OPTIONS = dict( "pioplatform", "piotest", "piotarget", - "piomaxlen", "piolib", "pioupload", "piosize", "pioino", "piomisc", "piointegration", + "piomaxlen", ], toolpath=[os.path.join(fs.get_source_dir(), "builder", "tools")], variables=clivars, diff --git a/platformio/builder/tools/piomaxlen.py b/platformio/builder/tools/piomaxlen.py index c7360418..b6a0ebb0 100644 --- a/platformio/builder/tools/piomaxlen.py +++ b/platformio/builder/tools/piomaxlen.py @@ -19,6 +19,7 @@ import os import re from SCons.Platform import TempFileMunge # pylint: disable=import-error +from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error from SCons.Subst import quote_spaces # pylint: disable=import-error from platformio.compat import IS_WINDOWS, hashlib_encode_data @@ -70,11 +71,13 @@ def _file_long_data(env, data): return tmp_file -def exists(_): - return True +def exists(env): + return "compiledb" not in COMMAND_LINE_TARGETS and not env.IsIntegrationDump() def generate(env): + if not exists(env): + return env kwargs = dict( _long_sources_hook=long_sources_hook, TEMPFILE=TempFileMunge,