diff --git a/HISTORY.rst b/HISTORY.rst index 3443639f..b5b339af 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,8 @@ PlatformIO 4.0 * Added Python 3.5+ support (`issue #895 `_) * 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 `_) PlatformIO 3.0 -------------- 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()}