diff --git a/HISTORY.rst b/HISTORY.rst index f9f1ccc3..5ac2772b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,11 @@ Release Notes PlatformIO 4.0 -------------- +4.0.4 (2019-??-??) +~~~~~~~~~~~~~~~~~~ + +* Fixed an issue with project generator for `CLion IDE `__ when 2 environments were used (`issue #2824 `_) + 4.0.3 (2019-08-30) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl index f96163fb..40f31e09 100644 --- a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl @@ -57,7 +57,7 @@ if (CMAKE_BUILD_TYPE MATCHES "{{ env_name }}") %end endif() -% leftover_envs = set(envs) ^ set([env_name]) +% leftover_envs = list(set(envs) ^ set([env_name])) % % ide_data = {} % if leftover_envs: diff --git a/platformio/project/helpers.py b/platformio/project/helpers.py index 7ead95eb..9de1dbe2 100644 --- a/platformio/project/helpers.py +++ b/platformio/project/helpers.py @@ -194,10 +194,11 @@ def compute_project_checksum(config): return checksum.hexdigest() -def load_project_ide_data(project_dir, envs): +def load_project_ide_data(project_dir, env_or_envs): from platformio.commands.run import cli as cmd_run - assert envs - if not isinstance(envs, (list, tuple, set)): + assert env_or_envs + envs = env_or_envs + if not isinstance(envs, list): envs = [envs] args = ["--project-dir", project_dir, "--target", "idedata"] for env in envs: @@ -217,6 +218,6 @@ def load_project_ide_data(project_dir, envs): _data = json.loads(line) if "env_name" in _data: data[_data['env_name']] = _data - if len(envs) == 1 and envs[0] in data: - return data[envs[0]] + if not isinstance(env_or_envs, list) and env_or_envs in data: + return data[env_or_envs] return data or None