Improved project dependency resolving when using the pio project init --ide command

This commit is contained in:
Ivan Kravets
2022-07-22 18:18:26 +03:00
parent 9ff117b0fb
commit e498119e0d
2 changed files with 30 additions and 20 deletions

View File

@ -13,6 +13,11 @@ PlatformIO Core 6
**A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.**
6.1.4 (2022-??-??)
~~~~~~~~~~~~~~~~~~
* Improved project dependency resolving when using the `pio project init --ide <https://docs.platformio.org/en/latest/core/userguide/project/cmd_init.html>`__ command
6.1.3 (2022-07-18)
~~~~~~~~~~~~~~~~~~

View File

@ -79,27 +79,32 @@ def project_init_cmd(
elif board:
update_board_envs(project_dir, board, project_option, env_prefix)
# resolve project dependencies
if not no_install_dependencies and (environment or board):
install_project_dependencies(
options=dict(
project_dir=project_dir,
environments=[environment] if environment else [],
silent=silent,
)
)
if ide:
if not silent:
click.echo(
"Updating metadata for the %s IDE..." % click.style(ide, fg="cyan")
)
with fs.cd(project_dir):
config = ProjectConfig.get_instance(
os.path.join(project_dir, "platformio.ini")
)
with fs.cd(project_dir):
generator = None
config = ProjectConfig.get_instance(os.path.join(project_dir, "platformio.ini"))
if ide:
config.validate()
ProjectGenerator(config, environment, ide, board).generate()
# init generator and pick the best env if user didn't specify
generator = ProjectGenerator(config, environment, ide, board)
if not environment:
environment = generator.env_name
# resolve project dependencies
if not no_install_dependencies and (environment or board):
install_project_dependencies(
options=dict(
project_dir=project_dir,
environments=[environment] if environment else [],
silent=silent,
)
)
if generator:
if not silent:
click.echo(
"Updating metadata for the %s IDE..." % click.style(ide, fg="cyan")
)
generator.generate()
if is_new_project:
init_cvs_ignore(project_dir)