From 856798488ba990eed7276705c2e3bbd3d3bab855 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 23 Feb 2019 18:39:54 +0200 Subject: [PATCH] Fix an issue when `platformio ci` recompiles project if ``--keep-build-dir`` option is passed // Resolve #2109 --- HISTORY.rst | 2 ++ platformio/commands/ci.py | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 2474c540..8b510cfe 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,8 @@ PlatformIO 3.0 ~~~~~~~~~~~~~~~~~~ * Fixed an issue with slow updating of PlatformIO Core packages on Windows +* Fixed an issue when `platformio ci `__ recompiles project if ``--keep-build-dir`` option is passed + (`issue #2109 `_) 3.6.4 (2019-01-23) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index 0abf72d2..a5f28256 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -84,7 +84,11 @@ def cli( # pylint: disable=too-many-arguments try: app.set_session_var("force_option", True) - _clean_dir(build_dir) + + if not keep_build_dir and isdir(build_dir): + util.rmtree_(build_dir) + if not isdir(build_dir): + makedirs(build_dir) for dir_name, patterns in dict(lib=lib, src=src).items(): if not patterns: @@ -116,11 +120,6 @@ def cli( # pylint: disable=too-many-arguments util.rmtree_(build_dir) -def _clean_dir(dirpath): - util.rmtree_(dirpath) - makedirs(dirpath) - - def _copy_contents(dst_dir, contents): items = {"dirs": set(), "files": set()}