-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from espressif/feat/support_build_with_profiles
Feat/support build with profiles
- Loading branch information
Showing
13 changed files
with
230 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import click | ||
|
||
_OPTION_PATHS_HELP = """ | ||
List of directories to process. Support passing multiple times. | ||
\b | ||
Example: | ||
--paths component_1 --paths component_2 | ||
-p component_1 -p component_2 | ||
""" | ||
|
||
|
||
def option_paths(func): | ||
return click.option( | ||
'--paths', | ||
'-p', | ||
multiple=True, | ||
type=click.Path(dir_okay=True, file_okay=False, exists=True), | ||
help=_OPTION_PATHS_HELP, | ||
)(func) | ||
|
||
|
||
_OPTION_PROFILES_HELP = """ | ||
\b | ||
List of profiles to apply. Could be "default" or file path to a custom profile. | ||
Support passing multiple times. The later profiles will override the previous ones. | ||
[default: default] | ||
\b | ||
Example: | ||
--profiles default --profiles custom.toml | ||
""" | ||
|
||
|
||
def option_profiles(func): | ||
return click.option( | ||
'--profiles', | ||
multiple=True, | ||
default=['default'], | ||
show_default=False, | ||
help=_OPTION_PROFILES_HELP, | ||
)(func) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,2 @@ | ||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import click | ||
|
||
|
||
@click.command() | ||
def completions(): | ||
""" | ||
Instructions to enable shell completions for idf-ci | ||
""" | ||
|
||
help_message = """ | ||
To enable autocomplete run the following command: | ||
Bash: | ||
1. Run this command once | ||
_IDF_CI_COMPLETE=bash_source idf-ci > ~/.idf-ci-complete.bash | ||
2. Add the following line to your .bashrc | ||
. ~/.idf-ci-complete.bash | ||
Zsh: | ||
1. Run this command once | ||
_IDF_CI_COMPLETE=zsh_source idf-ci > ~/.idf-ci-complete.zsh | ||
2. Add the following line to your .zshrc | ||
. ~/.idf-ci-complete.zsh | ||
Fish: | ||
1. Run this command once | ||
_IDF_CI_COMPLETE=fish_source idf-ci > ~/.config/fish/completions/idf-ci.fish | ||
After modifying the shell config, you need to start a new shell in order for the changes to be loaded. | ||
""" | ||
click.echo(help_message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import os.path | ||
import subprocess | ||
import typing as t | ||
|
||
from ._compat import UNDEF, PathLike, Undefined | ||
from .profiles import TomlProfileManager | ||
|
||
|
||
def build( | ||
paths: t.List[str], | ||
target: str, | ||
*, | ||
profiles: t.List[PathLike] = UNDEF, # type: ignore | ||
): | ||
if isinstance(profiles, Undefined): | ||
profiles = ['default'] | ||
|
||
profile_o = TomlProfileManager( | ||
profiles=profiles, | ||
default_profile_path=os.path.join(os.path.dirname(__file__), 'templates', 'default_build_profile.toml'), | ||
) | ||
|
||
print(profile_o.merged_profile_path) | ||
|
||
subprocess.run( | ||
[ | ||
'idf-build-apps', | ||
'build', | ||
'-p', | ||
*paths, | ||
'-t', | ||
target, | ||
'--config-file', | ||
profile_o.merged_profile_path, | ||
'-vvv', | ||
], | ||
check=True, | ||
) |
Oops, something went wrong.