diff --git a/HISTORY.rst b/HISTORY.rst index 786634ae..6869230c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -32,6 +32,7 @@ PlatformIO Core 6 * Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode (`issue #4597 `_) * Resolved an issue where native tests would fail if a custom program name was specified (`issue #4546 `_) * Resolved an issue where the PlatformIO |DEBUGGING| solution was not escaping the tool installation process into MI2 correctly (`issue #4565 `_) +* Resolved an issue where multiple targets were not executed sequentially (`issue #4604 `_) 6.1.6 (2023-01-23) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/main.py b/platformio/builder/main.py index e3932be5..86702783 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -250,3 +250,9 @@ if "sizedata" in COMMAND_LINE_TARGETS: ) Default("sizedata") + +# issue #4604: process targets sequentially +for index, target in enumerate( + [t for t in COMMAND_LINE_TARGETS if not t.startswith("__")][1:] +): + env.Depends(target, COMMAND_LINE_TARGETS[index]) diff --git a/platformio/platform/_run.py b/platformio/platform/_run.py index 4fc41f9c..dfd7c406 100644 --- a/platformio/platform/_run.py +++ b/platformio/platform/_run.py @@ -93,6 +93,9 @@ class PlatformRunMixin: args.append("PIOVERBOSE=%d" % int(self.verbose)) # pylint: disable=protected-access args.append("ISATTY=%d" % int(click._compat.isatty(sys.stdout))) + # encode and append variables + for key, value in variables.items(): + args.append("%s=%s" % (key.upper(), self.encode_scons_arg(value))) if set(KNOWN_CLEAN_TARGETS + KNOWN_FULLCLEAN_TARGETS) & set(targets): args.append("--clean") @@ -103,10 +106,6 @@ class PlatformRunMixin: elif targets: args.extend(targets) - # encode and append variables - for key, value in variables.items(): - args.append("%s=%s" % (key.upper(), self.encode_scons_arg(value))) - # force SCons output to Unicode os.environ["PYTHONIOENCODING"] = "utf-8" diff --git a/platformio/run/processor.py b/platformio/run/processor.py index 3d427a1b..329c4bf6 100644 --- a/platformio/run/processor.py +++ b/platformio/run/processor.py @@ -68,7 +68,7 @@ class EnvironmentProcessor: build_vars = self.get_build_variables() is_clean = set(KNOWN_ALLCLEAN_TARGETS) & set(self.targets) - build_targets = list(set(self.targets) - set(KNOWN_ALLCLEAN_TARGETS)) + build_targets = [t for t in self.targets if t not in KNOWN_ALLCLEAN_TARGETS] # pre-clean if is_clean: