idf_build_apps 1.0.0__tar.gz → 1.0.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/test-build-idf-apps.yml +3 -4
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/CHANGELOG.md +2 -10
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/PKG-INFO +1 -1
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/find_build.md +1 -1
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/manifest.md +6 -62
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/__init__.py +1 -1
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/finder.py +3 -7
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/main.py +72 -37
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/manifest/if_parser.py +0 -5
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/utils.py +1 -1
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/setup.py +1 -1
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/tests/test_build.py +0 -17
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/tests/test_finder.py +0 -82
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.editorconfig +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.git-blame-ignore-revs +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.gitattributes +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/check-pre-commit.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/issue_comment.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/new_issues.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/new_prs.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/publish-pypi.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/test-build-docs.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.gitignore +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.pre-commit-config.yaml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.readthedocs.yml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/CONTRIBUTING.md +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/LICENSE +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/README.md +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/CHANGELOG.md +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/CONTRIBUTING.md +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/Makefile +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/_static/espressif-logo.svg +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/_static/theme_overrides.css +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/_templates/layout.html +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/api.rst +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/conf.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/config_file.md +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/docs/index.rst +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/__main__.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/app.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/config.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/constants.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/log.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/manifest/__init__.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/manifest/manifest.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/idf_build_apps/manifest/soc_header.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/license_header.txt +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/pyproject.toml +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/tests/conftest.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/tests/test_manifest.py +0 -0
- {idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/tests/test_utils.py +0 -0
{idf_build_apps-1.0.0 → idf_build_apps-1.0.0.dev1}/.github/workflows/test-build-idf-apps.yml
RENAMED
|
@@ -66,10 +66,9 @@ jobs:
|
|
|
66
66
|
python -m idf_build_apps build -vv -t esp32 \
|
|
67
67
|
-p $IDF_PATH/examples/get-started/hello_world \
|
|
68
68
|
--size-file size_info.json \
|
|
69
|
-
--ignore-warning-str \
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"Support for Python 2 is deprecated"
|
|
69
|
+
--ignore-warning-str "Python 3 versions older than 3.6 are not supported" \
|
|
70
|
+
--ignore-warning-str "Python 2 is no longer supported" \
|
|
71
|
+
--ignore-warning-str "Support for Python 2 is deprecated"
|
|
73
72
|
|
|
74
73
|
build-apps-on-idf-env:
|
|
75
74
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [1.0.0]
|
|
5
|
+
## [Unreleased - 1.0.0]
|
|
6
6
|
|
|
7
7
|
## Added
|
|
8
8
|
|
|
9
9
|
- Support keyword `depends_filepatterns` in the manifest file
|
|
10
|
-
- Support expanding environment variables in the manifest files
|
|
11
10
|
|
|
12
11
|
## BREAKING CHANGES
|
|
13
12
|
|
|
@@ -24,13 +23,6 @@ All notable changes to this project will be documented in this file.
|
|
|
24
23
|
- CLI Options Renamed
|
|
25
24
|
- `--depends-on-components` renamed to `--modified-components`
|
|
26
25
|
- `--depends-on-files` renamed to `--modified-files`
|
|
27
|
-
- `--ignore-components-dependencies-file-patterns` renamed to `--ignore-app-dependencies-filepatterns`
|
|
28
|
-
- Removed the deprecated CLI call methods, now these options only support space-separated list
|
|
29
|
-
- `--exclude`
|
|
30
|
-
- `--config`
|
|
31
|
-
- `--manifest-file`
|
|
32
|
-
- `--ignore-warning-str`
|
|
33
|
-
- `--default-build-targets`
|
|
34
26
|
|
|
35
27
|
## [0.6.1] (2023-05-10)
|
|
36
28
|
|
|
@@ -130,7 +122,7 @@ This is the last version to support ESP-IDF v4.1 since it's EOL on Feb. 24th, 20
|
|
|
130
122
|
|
|
131
123
|
### Fixed
|
|
132
124
|
|
|
133
|
-
-
|
|
125
|
+
- Ralative path defined in the manifest files depend on the current work path
|
|
134
126
|
|
|
135
127
|
Added `manifest_rootpath` argument in `find_apps()`. Will use this value instead as the root folder for calculating absolute path
|
|
136
128
|
|
|
@@ -114,7 +114,7 @@ By default, `idf-build-apps` would use the project directory as the work directo
|
|
|
114
114
|
|
|
115
115
|
#### Build Directory
|
|
116
116
|
|
|
117
|
-
Build directory is the directory where the binary files output would be generated. If it is set to a relative path, the full path would be calculated based on the work directory. If it is
|
|
117
|
+
Build directory is the directory where the binary files output would be generated. If it is set to a relative path, the full path would be calculated based on the work directory. If it is a absolute path, it would override the work directory settings.
|
|
118
118
|
|
|
119
119
|
By default, `idf-build-apps` would follow what ESP-IDF does, use `build` as the build directory.
|
|
120
120
|
|
|
@@ -23,14 +23,12 @@ One typical manifest file look like this:
|
|
|
23
23
|
|
|
24
24
|
### Operands
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- `INCLUDE_DEFAULT` (The default value of officially supported targets is 1, otherwise is 0)
|
|
33
|
-
- environment variables, default to `0` if not set
|
|
26
|
+
- Variables start with `SOC_`. The value would be parsed from `IDF_PATH/components/soc/[TARGET]/include/soc/*_caps.h`
|
|
27
|
+
- `IDF_TARGET`
|
|
28
|
+
- `IDF_VERSION_MAJOR`
|
|
29
|
+
- `IDF_VERSION_MINOR`
|
|
30
|
+
- `IDF_VERSION_PATCH`
|
|
31
|
+
- `INCLUDE_DEFAULT` (The default value of officially supported targets is 1, otherwise is 0)
|
|
34
32
|
- String, must be double-quoted. e.g., `"esp32"`, `"12345"`
|
|
35
33
|
- Integer, support decimal and hex. e.g., `1`, `0xAB`
|
|
36
34
|
- List of strings or integers, or both types at the same time. e.g., `["esp32", 1]`
|
|
@@ -114,57 +112,3 @@ examples/get-started/blink:
|
|
|
114
112
|
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux"
|
|
115
113
|
reason: This one supports all supported targets and linux
|
|
116
114
|
```
|
|
117
|
-
|
|
118
|
-
## Check App Dependencies
|
|
119
|
-
|
|
120
|
-
`idf-build-apps` also supports building only related apps by checking app dependencies via modified components and modified files.
|
|
121
|
-
|
|
122
|
-
### Basic Usage
|
|
123
|
-
|
|
124
|
-
To enable this feature, you need to declare the modified files or components using the CLI option:
|
|
125
|
-
|
|
126
|
-
- `--modified-files`
|
|
127
|
-
- `--modified-components`
|
|
128
|
-
|
|
129
|
-
To declare the dependencies for an app, you could add two more keywords in the corresponding manifest file:
|
|
130
|
-
|
|
131
|
-
- `depends_components`
|
|
132
|
-
- `depends_filepatterns`
|
|
133
|
-
|
|
134
|
-
One app will be built when:
|
|
135
|
-
|
|
136
|
-
- The app itself is modified (`.md` files are excluded)
|
|
137
|
-
- Any of the specified `depends_components` in the corresponding manifest file are modified
|
|
138
|
-
- Files that matches any of the specified `depends_filepatterns` in the corresponding manifest file are modified
|
|
139
|
-
- Any of the `build_components` are modified. `build_components` are defined in the `project_description.json`, which is generated by running `idf.py reconfigure` or `idf.py build`
|
|
140
|
-
|
|
141
|
-
For example, this is an app `example/foo`, which depends on `comp1`, `comp2`, `comp3` and all files under `common_header_files`:
|
|
142
|
-
|
|
143
|
-
```yaml
|
|
144
|
-
examples/foo:
|
|
145
|
-
depends_components:
|
|
146
|
-
- comp1
|
|
147
|
-
- comp2
|
|
148
|
-
- comp3
|
|
149
|
-
depends_files:
|
|
150
|
-
- "common_header_files/**/*"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
This app will be built with the following CLI options:
|
|
154
|
-
|
|
155
|
-
- `--modified-files examples/foo/main/foo.c`
|
|
156
|
-
- `--modified-components comp1`
|
|
157
|
-
- `--modified-components comp2 comp3`
|
|
158
|
-
- `--modified-files common_header_files/foo.h`
|
|
159
|
-
|
|
160
|
-
This app will not be built with the following CLI options:
|
|
161
|
-
|
|
162
|
-
- `--modified-files examples/foo/main/foo.md`
|
|
163
|
-
- `--modified-components bar`
|
|
164
|
-
- `/tmp/foo.c`
|
|
165
|
-
|
|
166
|
-
### Advanced Usage
|
|
167
|
-
|
|
168
|
-
Sometimes, we have some root dependencies. All apps should be built if these root dependencies are modified.
|
|
169
|
-
|
|
170
|
-
After adding `--ignore-app-dependencies-filepatterns` to the CLI options, if files that matches any of the specified patterns are modified, the check app dependency feature will be disabled.
|
|
@@ -17,7 +17,6 @@ from .app import (
|
|
|
17
17
|
)
|
|
18
18
|
from .utils import (
|
|
19
19
|
config_rules_from_str,
|
|
20
|
-
to_absolute_path,
|
|
21
20
|
to_list,
|
|
22
21
|
)
|
|
23
22
|
|
|
@@ -166,18 +165,15 @@ def _find_apps(
|
|
|
166
165
|
|
|
167
166
|
# The remaining part is for recursive == True
|
|
168
167
|
apps = []
|
|
169
|
-
# handle the exclude list, since the config file might use linux style, but run in windows
|
|
170
|
-
exclude_list = [to_absolute_path(p) for p in exclude_list]
|
|
171
168
|
for root, dirs, _ in os.walk(path):
|
|
172
169
|
LOGGER.debug('Entering %s', root)
|
|
173
|
-
|
|
174
|
-
if root_path in exclude_list:
|
|
170
|
+
if root in exclude_list:
|
|
175
171
|
LOGGER.debug('=> Skipping %s (excluded)', root)
|
|
176
172
|
del dirs[:]
|
|
177
173
|
continue
|
|
178
174
|
|
|
179
|
-
if
|
|
180
|
-
LOGGER.debug('=> Skipping %s (managed components)',
|
|
175
|
+
if root.endswith('managed_components'): # idf-component-manager
|
|
176
|
+
LOGGER.debug('=> Skipping %s (managed components)', root)
|
|
181
177
|
del dirs[:]
|
|
182
178
|
continue
|
|
183
179
|
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
|
+
import io
|
|
5
6
|
import json
|
|
6
7
|
import os
|
|
7
8
|
import re
|
|
8
9
|
import shutil
|
|
9
10
|
import sys
|
|
10
11
|
import textwrap
|
|
12
|
+
import warnings
|
|
11
13
|
from pathlib import (
|
|
12
14
|
Path,
|
|
13
15
|
)
|
|
@@ -53,22 +55,22 @@ def _check_app_dependency(
|
|
|
53
55
|
manifest_rootpath, # type: str
|
|
54
56
|
modified_components, # type: list[str] | None
|
|
55
57
|
modified_files, # type: list[str] | None
|
|
56
|
-
|
|
58
|
+
ignore_component_dependencies_file_patterns, # type: list[str] | None
|
|
57
59
|
): # type: (...) -> bool
|
|
58
60
|
# not check since modified_components and modified_files are not passed
|
|
59
61
|
if modified_components is None and modified_files is None:
|
|
60
62
|
return False
|
|
61
63
|
|
|
62
|
-
# not check since
|
|
64
|
+
# not check since ignore_component_dependencies_file_patterns is passed and matched
|
|
63
65
|
if (
|
|
64
|
-
|
|
66
|
+
ignore_component_dependencies_file_patterns
|
|
65
67
|
and modified_files is not None
|
|
66
|
-
and files_matches_patterns(modified_files,
|
|
68
|
+
and files_matches_patterns(modified_files, ignore_component_dependencies_file_patterns, manifest_rootpath)
|
|
67
69
|
):
|
|
68
70
|
LOGGER.debug(
|
|
69
71
|
'Skipping check component dependencies for apps since files %s matches patterns: %s',
|
|
70
72
|
', '.join(modified_files),
|
|
71
|
-
', '.join(
|
|
73
|
+
', '.join(ignore_component_dependencies_file_patterns),
|
|
72
74
|
)
|
|
73
75
|
return False
|
|
74
76
|
|
|
@@ -93,7 +95,7 @@ def find_apps(
|
|
|
93
95
|
default_build_targets=None, # type: list[str] | str | None
|
|
94
96
|
modified_components=None, # type: list[str] | str | None
|
|
95
97
|
modified_files=None, # type: list[str] | str | None
|
|
96
|
-
|
|
98
|
+
ignore_component_dependencies_file_patterns=None, # type: list[str] | str | None
|
|
97
99
|
sdkconfig_defaults=None, # type: str | None
|
|
98
100
|
): # type: (...) -> list[App]
|
|
99
101
|
"""
|
|
@@ -137,9 +139,9 @@ def find_apps(
|
|
|
137
139
|
:type modified_components: list[str] | str | None
|
|
138
140
|
:param modified_files: modified files
|
|
139
141
|
:type modified_files: list[str] | str | None
|
|
140
|
-
:param
|
|
142
|
+
:param ignore_component_dependencies_file_patterns: file patterns that used for ignoring checking the component
|
|
141
143
|
dependencies
|
|
142
|
-
:type
|
|
144
|
+
:type ignore_component_dependencies_file_patterns: list[str] | str | None
|
|
143
145
|
:param sdkconfig_defaults: semicolon-separated string, pass to idf.py -DSDKCONFIG_DEFAULTS if specified,
|
|
144
146
|
also could be set via environment variables "SDKCONFIG_DEFAULTS"
|
|
145
147
|
:type sdkconfig_defaults: str | None
|
|
@@ -164,7 +166,7 @@ def find_apps(
|
|
|
164
166
|
|
|
165
167
|
modified_components = to_list(modified_components)
|
|
166
168
|
modified_files = to_list(modified_files)
|
|
167
|
-
|
|
169
|
+
ignore_component_dependencies_file_patterns = to_list(ignore_component_dependencies_file_patterns)
|
|
168
170
|
|
|
169
171
|
apps = []
|
|
170
172
|
if target == 'all':
|
|
@@ -193,7 +195,7 @@ def find_apps(
|
|
|
193
195
|
manifest_rootpath=manifest_rootpath,
|
|
194
196
|
modified_components=modified_components,
|
|
195
197
|
modified_files=modified_files,
|
|
196
|
-
|
|
198
|
+
ignore_component_dependencies_file_patterns=ignore_component_dependencies_file_patterns,
|
|
197
199
|
),
|
|
198
200
|
modified_components=modified_components,
|
|
199
201
|
modified_files=modified_files,
|
|
@@ -221,7 +223,7 @@ def build_apps(
|
|
|
221
223
|
manifest_rootpath=None, # type: str | None
|
|
222
224
|
modified_components=None, # type: list[str] | str | None
|
|
223
225
|
modified_files=None, # type: list[str] | str | None
|
|
224
|
-
|
|
226
|
+
ignore_component_dependencies_file_patterns=None, # type: list[str] | str | None
|
|
225
227
|
): # type: (...) -> (int, list[App]) | int
|
|
226
228
|
"""
|
|
227
229
|
Build all the specified apps
|
|
@@ -256,9 +258,9 @@ def build_apps(
|
|
|
256
258
|
:type modified_components: list[str] | str | None
|
|
257
259
|
:param modified_files: modified files
|
|
258
260
|
:type modified_files: list[str] | str | None
|
|
259
|
-
:param
|
|
261
|
+
:param ignore_component_dependencies_file_patterns: file patterns that used for ignoring checking the component
|
|
260
262
|
dependencies
|
|
261
|
-
:type
|
|
263
|
+
:type ignore_component_dependencies_file_patterns: list[str] | str | None
|
|
262
264
|
:return: (exit_code, built_apps) if specified ``modified_components``
|
|
263
265
|
:rtype: int, list[App]
|
|
264
266
|
:return: exit_code if not specified ``modified_components``
|
|
@@ -267,7 +269,7 @@ def build_apps(
|
|
|
267
269
|
apps = to_list(apps) # type: list[App]
|
|
268
270
|
modified_components = to_list(modified_components)
|
|
269
271
|
modified_files = to_list(modified_files)
|
|
270
|
-
|
|
272
|
+
ignore_component_dependencies_file_patterns = to_list(ignore_component_dependencies_file_patterns)
|
|
271
273
|
|
|
272
274
|
ignore_warnings_regexes = []
|
|
273
275
|
if ignore_warning_strs:
|
|
@@ -298,13 +300,27 @@ def build_apps(
|
|
|
298
300
|
app.parallel_count = parallel_count
|
|
299
301
|
|
|
300
302
|
if collect_app_info:
|
|
301
|
-
|
|
303
|
+
if isinstance(collect_app_info, io.TextIOWrapper):
|
|
304
|
+
warnings.warn(
|
|
305
|
+
'"collect_app_info" does not support file stream in idf-build-apps 1.0.0, Please use str instead',
|
|
306
|
+
DeprecationWarning,
|
|
307
|
+
)
|
|
308
|
+
app._collect_app_info = collect_app_info.name
|
|
309
|
+
else:
|
|
310
|
+
app._collect_app_info = collect_app_info
|
|
302
311
|
|
|
303
312
|
if app.collect_app_info not in collect_files:
|
|
304
313
|
collect_files.append(app.collect_app_info)
|
|
305
314
|
|
|
306
315
|
if collect_size_info:
|
|
307
|
-
|
|
316
|
+
if isinstance(collect_size_info, io.TextIOWrapper):
|
|
317
|
+
warnings.warn(
|
|
318
|
+
'"collect_size_info" does not support file stream in idf-build-apps 1.0.0, Please use str instead',
|
|
319
|
+
DeprecationWarning,
|
|
320
|
+
)
|
|
321
|
+
app._collect_size_info = collect_size_info.name
|
|
322
|
+
else:
|
|
323
|
+
app._collect_size_info = collect_size_info
|
|
308
324
|
|
|
309
325
|
if app.collect_size_info not in collect_files:
|
|
310
326
|
collect_files.append(app.collect_size_info)
|
|
@@ -336,7 +352,7 @@ def build_apps(
|
|
|
336
352
|
modified_components=modified_components,
|
|
337
353
|
modified_files=modified_files,
|
|
338
354
|
check_app_dependencies=_check_app_dependency(
|
|
339
|
-
manifest_rootpath, modified_components, modified_files,
|
|
355
|
+
manifest_rootpath, modified_components, modified_files, ignore_component_dependencies_file_patterns
|
|
340
356
|
),
|
|
341
357
|
)
|
|
342
358
|
except BuildError as e:
|
|
@@ -452,7 +468,15 @@ class IdfBuildAppsCliFormatter(argparse.HelpFormatter):
|
|
|
452
468
|
else:
|
|
453
469
|
default_type = type(action.default)
|
|
454
470
|
|
|
455
|
-
if action
|
|
471
|
+
if isinstance(action, argparse._AppendAction): # noqa
|
|
472
|
+
_help += (
|
|
473
|
+
'. Could be specified for multiple times'
|
|
474
|
+
'{} ! DeprecationWarning: will change to space-separated list in idf-build-apps 1.0.0 version'.format(
|
|
475
|
+
self.LINE_SEP
|
|
476
|
+
)
|
|
477
|
+
)
|
|
478
|
+
_type = 'list[{}]'.format(default_type.__name__)
|
|
479
|
+
elif action.nargs in [argparse.ZERO_OR_MORE, argparse.ONE_OR_MORE]:
|
|
456
480
|
_type = 'list[{}]'.format(default_type.__name__)
|
|
457
481
|
else:
|
|
458
482
|
_type = default_type.__name__
|
|
@@ -498,7 +522,11 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
498
522
|
action='store_true',
|
|
499
523
|
help='Look for apps in the specified paths recursively',
|
|
500
524
|
)
|
|
501
|
-
common_args.add_argument(
|
|
525
|
+
common_args.add_argument(
|
|
526
|
+
'--exclude',
|
|
527
|
+
action='append',
|
|
528
|
+
help='Ignore specified directory (if --recursive is given)',
|
|
529
|
+
)
|
|
502
530
|
common_args.add_argument(
|
|
503
531
|
'--work-dir',
|
|
504
532
|
help='If set, the app is first copied into the specified directory, and then built. '
|
|
@@ -520,7 +548,7 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
520
548
|
)
|
|
521
549
|
common_args.add_argument(
|
|
522
550
|
'--config',
|
|
523
|
-
|
|
551
|
+
action='append',
|
|
524
552
|
help='Adds configurations (sdkconfig file names) to build. '
|
|
525
553
|
'This can either be FILENAME[=NAME] or FILEPATTERN. FILENAME is the name of the sdkconfig file, '
|
|
526
554
|
'relative to the project directory, to be used. Optional NAME can be specified, '
|
|
@@ -550,7 +578,7 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
550
578
|
)
|
|
551
579
|
common_args.add_argument(
|
|
552
580
|
'--manifest-file',
|
|
553
|
-
|
|
581
|
+
action='append',
|
|
554
582
|
help='Manifest files which specify the build test rules of the apps',
|
|
555
583
|
)
|
|
556
584
|
common_args.add_argument(
|
|
@@ -562,7 +590,10 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
562
590
|
'--default-build-targets',
|
|
563
591
|
nargs='+',
|
|
564
592
|
help='space-separated list of supported targets. Targets supported in current ESP-IDF branch '
|
|
565
|
-
'(except preview ones) would be used if this option is not set.'
|
|
593
|
+
'(except preview ones) would be used if this option is not set.'
|
|
594
|
+
'{} ! DeprecationWarning: comma-separated list support will be removed in idf-build-apps 1.0.0 version'.format(
|
|
595
|
+
IdfBuildAppsCliFormatter.LINE_SEP
|
|
596
|
+
),
|
|
566
597
|
)
|
|
567
598
|
common_args.add_argument(
|
|
568
599
|
'--modified-components',
|
|
@@ -581,12 +612,13 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
581
612
|
)
|
|
582
613
|
common_args.add_argument(
|
|
583
614
|
'-if',
|
|
584
|
-
'--ignore-
|
|
615
|
+
'--ignore-component-dependencies-file-patterns',
|
|
585
616
|
nargs='*',
|
|
586
617
|
default=None,
|
|
587
|
-
help='space-separated list which specifies the file patterns used for ignoring
|
|
588
|
-
'The `depends_components` and `depends_filepatterns` set in the manifest files will be ignored when any of
|
|
589
|
-
'specified file patterns matches any of the modified files. Must be used together with
|
|
618
|
+
help='space-separated list which specifies the file patterns used for ignoring the component dependencies. '
|
|
619
|
+
'The `depends_components` and `depends_filepatterns` set in the manifest files will be ignored when any of '
|
|
620
|
+
'the specified file patterns matches any of the modified files. Must be used together with '
|
|
621
|
+
'--modified-files',
|
|
590
622
|
)
|
|
591
623
|
|
|
592
624
|
common_args.add_argument(
|
|
@@ -643,7 +675,7 @@ def get_parser(): # type: () -> argparse.ArgumentParser
|
|
|
643
675
|
)
|
|
644
676
|
build_parser.add_argument(
|
|
645
677
|
'--ignore-warning-str',
|
|
646
|
-
|
|
678
|
+
action='append',
|
|
647
679
|
help='Ignore the warning string that match the specified regex in the build output',
|
|
648
680
|
)
|
|
649
681
|
build_parser.add_argument(
|
|
@@ -680,17 +712,20 @@ def validate_args(parser, args): # type: (argparse.ArgumentParser, argparse.Nam
|
|
|
680
712
|
default_build_targets = []
|
|
681
713
|
if args.default_build_targets:
|
|
682
714
|
for target in args.default_build_targets:
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
715
|
+
t_list = [_t.strip() for _t in target.split(',')] if ',' in target else [target.strip()]
|
|
716
|
+
for _t in t_list:
|
|
717
|
+
if _t not in ALL_TARGETS:
|
|
718
|
+
raise InvalidCommand(
|
|
719
|
+
'Unrecognizable target {} specified with "--default-build-targets". '
|
|
720
|
+
'Current ESP-IDF available targets: {}'.format(_t, ALL_TARGETS)
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
if _t not in default_build_targets:
|
|
724
|
+
default_build_targets.append(_t)
|
|
688
725
|
|
|
689
|
-
if target not in default_build_targets:
|
|
690
|
-
default_build_targets.append(target)
|
|
691
726
|
args.default_build_targets = default_build_targets
|
|
692
727
|
|
|
693
|
-
if args.
|
|
728
|
+
if args.ignore_component_dependencies_file_patterns:
|
|
694
729
|
if args.modified_files is None:
|
|
695
730
|
raise InvalidCommand(
|
|
696
731
|
'Must specify "--ignore-component-dependencies-file-patterns" with "--modified-files", '
|
|
@@ -732,7 +767,7 @@ def main():
|
|
|
732
767
|
default_build_targets=args.default_build_targets,
|
|
733
768
|
modified_components=args.modified_components,
|
|
734
769
|
modified_files=args.modified_files,
|
|
735
|
-
|
|
770
|
+
ignore_component_dependencies_file_patterns=args.ignore_component_dependencies_file_patterns,
|
|
736
771
|
sdkconfig_defaults=args.sdkconfig_defaults,
|
|
737
772
|
)
|
|
738
773
|
|
|
@@ -766,7 +801,7 @@ def main():
|
|
|
766
801
|
manifest_rootpath=args.manifest_rootpath,
|
|
767
802
|
modified_components=args.modified_components,
|
|
768
803
|
modified_files=args.modified_files,
|
|
769
|
-
|
|
804
|
+
ignore_component_dependencies_file_patterns=args.ignore_component_dependencies_file_patterns,
|
|
770
805
|
)
|
|
771
806
|
|
|
772
807
|
if args.modified_components is not None:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import os
|
|
5
4
|
from ast import (
|
|
6
5
|
literal_eval,
|
|
7
6
|
)
|
|
@@ -87,10 +86,6 @@ class ChipAttr(Stmt):
|
|
|
87
86
|
if self.attr in SOC_HEADERS[target]:
|
|
88
87
|
return SOC_HEADERS[target][self.attr]
|
|
89
88
|
|
|
90
|
-
# for non-keyword cap words, check if it is defined in the environment variables
|
|
91
|
-
if self.attr in os.environ:
|
|
92
|
-
return os.environ[self.attr]
|
|
93
|
-
|
|
94
89
|
return 0 # default return 0 as false
|
|
95
90
|
|
|
96
91
|
|
|
@@ -213,7 +213,7 @@ def files_matches_patterns(
|
|
|
213
213
|
patterns, # type: list[str] | str
|
|
214
214
|
rootpath=None, # type: str
|
|
215
215
|
): # type: (...) -> bool
|
|
216
|
-
# can't match
|
|
216
|
+
# can't match a absolute pattern with a relative path
|
|
217
217
|
# change all to absolute paths
|
|
218
218
|
files = [to_absolute_path(f, rootpath) for f in to_list(files)]
|
|
219
219
|
patterns = [to_absolute_path(p, rootpath) for p in to_list(patterns)]
|
|
@@ -26,7 +26,7 @@ entry_points = \
|
|
|
26
26
|
{'console_scripts': ['idf-build-apps = idf_build_apps:main.main']}
|
|
27
27
|
|
|
28
28
|
setup(name='idf-build-apps',
|
|
29
|
-
version='1.0.0',
|
|
29
|
+
version='1.0.0.dev1',
|
|
30
30
|
description='Tools for building ESP-IDF related apps.',
|
|
31
31
|
author=None,
|
|
32
32
|
author_email='Fu Hanxi <fuhanxi@espressif.com>',
|
|
@@ -4,9 +4,6 @@ import shutil
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from idf_build_apps import (
|
|
8
|
-
find_apps,
|
|
9
|
-
)
|
|
10
7
|
from idf_build_apps.app import (
|
|
11
8
|
CMakeApp,
|
|
12
9
|
)
|
|
@@ -77,20 +74,6 @@ class TestBuild:
|
|
|
77
74
|
|
|
78
75
|
assert built == is_built
|
|
79
76
|
|
|
80
|
-
def test_build_without_modified_components_but_ignored_app_dependency_check(self):
|
|
81
|
-
test_dir = str(IDF_PATH / 'examples' / 'get-started' / 'hello_world')
|
|
82
|
-
|
|
83
|
-
apps = find_apps(
|
|
84
|
-
test_dir,
|
|
85
|
-
'esp32',
|
|
86
|
-
modified_components=[],
|
|
87
|
-
modified_files=['foo.c'],
|
|
88
|
-
ignore_app_dependencies_filepatterns=['foo.c'],
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
for app in apps:
|
|
92
|
-
assert app.build()
|
|
93
|
-
|
|
94
77
|
|
|
95
78
|
@pytest.mark.skipif(not shutil.which('idf.py'), reason='idf.py not found')
|
|
96
79
|
def test_idf_version_keywords_type():
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
|
-
import tempfile
|
|
7
6
|
from pathlib import (
|
|
8
7
|
Path,
|
|
9
8
|
)
|
|
@@ -418,84 +417,3 @@ class TestFindWithSdkconfigFiles:
|
|
|
418
417
|
assert apps[0].sdkconfig_files == [
|
|
419
418
|
str(tmp_path / 'test1' / 'sdkconfig.defaults'),
|
|
420
419
|
]
|
|
421
|
-
|
|
422
|
-
def test_env_var(self, tmp_path, monkeypatch):
|
|
423
|
-
create_project('test1', tmp_path)
|
|
424
|
-
|
|
425
|
-
(tmp_path / 'test1' / 'sdkconfig.ci.foo').touch()
|
|
426
|
-
(tmp_path / 'test1' / 'sdkconfig.ci.bar').touch()
|
|
427
|
-
(tmp_path / 'test1' / 'sdkconfig.ci.baz').touch()
|
|
428
|
-
|
|
429
|
-
yaml_file = tmp_path / 'test.yml'
|
|
430
|
-
yaml_file.write_text(
|
|
431
|
-
f'''
|
|
432
|
-
{tmp_path}:
|
|
433
|
-
enable:
|
|
434
|
-
- if: CONFIG_NAME == "foo" and IDF_TARGET == "esp32"
|
|
435
|
-
- if: CONFIG_NAME == "bar" and IDF_TARGET == "esp32s2"
|
|
436
|
-
- if: TEST_ENV_VAR == "1"
|
|
437
|
-
- if: CONFIG_NAME == "baz" and TEST_ENV_VAR == 0
|
|
438
|
-
''',
|
|
439
|
-
encoding='utf8',
|
|
440
|
-
)
|
|
441
|
-
|
|
442
|
-
# in case you set it...
|
|
443
|
-
monkeypatch.delenv('CONFIG_NAME', raising=False)
|
|
444
|
-
monkeypatch.delenv('TEST_ENV_VAR', raising=False)
|
|
445
|
-
|
|
446
|
-
# CONFIG_NAME should NOT be overridden by env var
|
|
447
|
-
monkeypatch.setenv('CONFIG_NAME', 'bar')
|
|
448
|
-
apps = find_apps(
|
|
449
|
-
str(tmp_path / 'test1'),
|
|
450
|
-
'esp32',
|
|
451
|
-
config_rules_str=['sdkconfig.ci=default', 'sdkconfig.ci.*='],
|
|
452
|
-
manifest_files=yaml_file,
|
|
453
|
-
)
|
|
454
|
-
assert len(apps) == 2
|
|
455
|
-
assert apps[0].sdkconfig_files == [
|
|
456
|
-
str(tmp_path / 'test1' / 'sdkconfig.ci.baz'),
|
|
457
|
-
]
|
|
458
|
-
assert apps[1].sdkconfig_files == [
|
|
459
|
-
str(tmp_path / 'test1' / 'sdkconfig.ci.foo'),
|
|
460
|
-
]
|
|
461
|
-
monkeypatch.delenv('CONFIG_NAME')
|
|
462
|
-
|
|
463
|
-
# env var should be expanded
|
|
464
|
-
monkeypatch.setenv('TEST_ENV_VAR', '1')
|
|
465
|
-
apps = find_apps(
|
|
466
|
-
str(tmp_path / 'test1'),
|
|
467
|
-
'esp32',
|
|
468
|
-
config_rules_str=['sdkconfig.ci=default', 'sdkconfig.ci.*='],
|
|
469
|
-
manifest_files=yaml_file,
|
|
470
|
-
)
|
|
471
|
-
assert len(apps) == 3
|
|
472
|
-
monkeypatch.delenv('TEST_ENV_VAR')
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
@pytest.mark.parametrize(
|
|
476
|
-
'exclude_list, apps_count',
|
|
477
|
-
[
|
|
478
|
-
(['test1'], 3), # not excluded
|
|
479
|
-
(['folder1/test2'], 2),
|
|
480
|
-
(['folder1'], 1),
|
|
481
|
-
(['folder2/test2'], 2),
|
|
482
|
-
],
|
|
483
|
-
)
|
|
484
|
-
def test_find_apps_with_exclude(tmp_path, exclude_list, apps_count):
|
|
485
|
-
(tmp_path / 'folder1').mkdir()
|
|
486
|
-
(tmp_path / 'folder2').mkdir()
|
|
487
|
-
|
|
488
|
-
create_project('test1', tmp_path / 'folder1')
|
|
489
|
-
create_project('test2', tmp_path / 'folder1')
|
|
490
|
-
create_project('test2', tmp_path / 'folder2')
|
|
491
|
-
|
|
492
|
-
os.chdir(tmp_path)
|
|
493
|
-
apps = find_apps(str(tmp_path), 'esp32', recursive=True, exclude_list=exclude_list)
|
|
494
|
-
assert len(apps) == apps_count
|
|
495
|
-
|
|
496
|
-
# or with absolute_path
|
|
497
|
-
exclude_list = [os.path.abspath(x) for x in exclude_list]
|
|
498
|
-
tmp_path = os.path.abspath(tmp_path)
|
|
499
|
-
os.chdir(tempfile.tempdir)
|
|
500
|
-
apps = find_apps(str(tmp_path), 'esp32', recursive=True, exclude_list=exclude_list)
|
|
501
|
-
assert len(apps) == apps_count
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|