-
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.
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 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
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 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, | ||
) |