mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Rename "load_project_ide_data" to the "load_build_metadata"
This commit is contained in:
@ -232,7 +232,7 @@ if set(["_idedata", "idedata"]) & set(COMMAND_LINE_TARGETS):
|
||||
except: # pylint: disable=bare-except
|
||||
projenv = env
|
||||
data = projenv.DumpIntegrationData(env)
|
||||
# dump to file for the further reading by project.helpers.load_project_ide_data
|
||||
# dump to file for the further reading by project.helpers.load_build_metadata
|
||||
with open(
|
||||
projenv.subst(os.path.join("$BUILD_DIR", "idedata.json")),
|
||||
mode="w",
|
||||
|
@ -22,7 +22,7 @@ from platformio import fs, proc
|
||||
from platformio.commands.check.defect import DefectItem
|
||||
from platformio.package.manager.core import get_core_package_dir
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.project.helpers import load_project_ide_data
|
||||
from platformio.project.helpers import load_build_metadata
|
||||
|
||||
|
||||
class CheckToolBase(object): # pylint: disable=too-many-instance-attributes
|
||||
@ -57,7 +57,7 @@ class CheckToolBase(object): # pylint: disable=too-many-instance-attributes
|
||||
]
|
||||
|
||||
def _load_cpp_data(self, project_dir):
|
||||
data = load_project_ide_data(project_dir, self.envname)
|
||||
data = load_build_metadata(project_dir, self.envname)
|
||||
if not data:
|
||||
return
|
||||
self.cc_flags = click.parser.split_arg_string(data.get("cc_flags", ""))
|
||||
|
@ -26,7 +26,7 @@ from platformio.commands.device.command import device_monitor as cmd_device_moni
|
||||
from platformio.commands.run.helpers import clean_build_dir, handle_legacy_libdeps
|
||||
from platformio.commands.run.processor import EnvironmentProcessor
|
||||
from platformio.project.config import ProjectConfig
|
||||
from platformio.project.helpers import find_project_dir_above, load_project_ide_data
|
||||
from platformio.project.helpers import find_project_dir_above, load_build_metadata
|
||||
from platformio.test.runners.base import CTX_META_TEST_IS_RUNNING
|
||||
|
||||
# pylint: disable=too-many-arguments,too-many-locals,too-many-branches
|
||||
@ -294,7 +294,7 @@ def print_processing_summary(results, verbose=False):
|
||||
|
||||
def print_target_list(envs):
|
||||
tabular_data = []
|
||||
for env, data in load_project_ide_data(os.getcwd(), envs).items():
|
||||
for env, data in load_build_metadata(os.getcwd(), envs).items():
|
||||
tabular_data.extend(
|
||||
sorted(
|
||||
[
|
||||
|
@ -20,7 +20,7 @@ from platformio.compat import string_types
|
||||
from platformio.debug.exception import DebugInvalidOptionsError
|
||||
from platformio.debug.helpers import reveal_debug_port
|
||||
from platformio.project.config import ProjectConfig
|
||||
from platformio.project.helpers import load_project_ide_data
|
||||
from platformio.project.helpers import load_build_metadata
|
||||
from platformio.project.options import ProjectOptions
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ class DebugConfigBase: # pylint: disable=too-many-instance-attributes
|
||||
)
|
||||
|
||||
def _load_build_data(self):
|
||||
data = load_project_ide_data(os.getcwd(), self.env_name, cache=True)
|
||||
data = load_build_metadata(os.getcwd(), self.env_name)
|
||||
if data:
|
||||
return data
|
||||
raise DebugInvalidOptionsError("Could not load a build configuration")
|
||||
|
@ -21,7 +21,7 @@ from tabulate import tabulate
|
||||
from platformio import fs
|
||||
from platformio.project.config import ProjectConfig
|
||||
from platformio.project.exception import NotPlatformIOProjectError
|
||||
from platformio.project.helpers import is_platformio_project, load_project_ide_data
|
||||
from platformio.project.helpers import is_platformio_project, load_build_metadata
|
||||
|
||||
|
||||
@click.command("data", short_help="Dump data intended for IDE extensions/plugins")
|
||||
@ -42,7 +42,7 @@ def project_data_cmd(project_dir, environment, json_output):
|
||||
environment = list(environment or config.envs())
|
||||
|
||||
if json_output:
|
||||
return click.echo(json.dumps(load_project_ide_data(project_dir, environment)))
|
||||
return click.echo(json.dumps(load_build_metadata(project_dir, environment)))
|
||||
|
||||
for envname in environment:
|
||||
click.echo("Environment: " + click.style(envname, fg="cyan", bold=True))
|
||||
@ -51,9 +51,7 @@ def project_data_cmd(project_dir, environment, json_output):
|
||||
tabulate(
|
||||
[
|
||||
(click.style(name, bold=True), "=", json.dumps(value, indent=2))
|
||||
for name, value in load_project_ide_data(
|
||||
project_dir, envname
|
||||
).items()
|
||||
for name, value in load_build_metadata(project_dir, envname).items()
|
||||
],
|
||||
tablefmt="plain",
|
||||
)
|
||||
|
@ -119,7 +119,7 @@ def compute_project_checksum(config):
|
||||
return checksum.hexdigest()
|
||||
|
||||
|
||||
def load_project_ide_data(project_dir, env_or_envs, cache=False):
|
||||
def load_build_metadata(project_dir, env_or_envs, cache=True):
|
||||
assert env_or_envs
|
||||
env_names = env_or_envs
|
||||
if not isinstance(env_names, list):
|
||||
@ -129,14 +129,18 @@ def load_project_ide_data(project_dir, env_or_envs, cache=False):
|
||||
result = _load_cached_project_ide_data(project_dir, env_names) if cache else {}
|
||||
missed_env_names = set(env_names) - set(result.keys())
|
||||
if missed_env_names:
|
||||
result.update(_load_project_ide_data(project_dir, missed_env_names))
|
||||
result.update(_load_build_metadata(project_dir, missed_env_names))
|
||||
|
||||
if not isinstance(env_or_envs, list) and env_or_envs in result:
|
||||
return result[env_or_envs]
|
||||
return result or None
|
||||
|
||||
|
||||
def _load_project_ide_data(project_dir, env_names):
|
||||
# Backward compatibiility with dev-platforms
|
||||
load_project_ide_data = load_build_metadata
|
||||
|
||||
|
||||
def _load_build_metadata(project_dir, env_names):
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from platformio.commands.run.command import cli as cmd_run
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
% import os
|
||||
% import re
|
||||
%
|
||||
% from platformio.project.helpers import load_project_ide_data
|
||||
% from platformio.project.helpers import load_build_metadata
|
||||
%
|
||||
% def _normalize_path(path):
|
||||
% if project_dir in path:
|
||||
@ -97,7 +97,7 @@ endif()
|
||||
%
|
||||
% ide_data = {}
|
||||
% if leftover_envs:
|
||||
% ide_data = load_project_ide_data(project_dir, leftover_envs)
|
||||
% ide_data = load_build_metadata(project_dir, leftover_envs)
|
||||
% end
|
||||
%
|
||||
% for env, data in ide_data.items():
|
||||
|
Reference in New Issue
Block a user