Skip to content

Commit b6f3d78

Browse files
committed
change: make debug info clearer, improving logging messages
1 parent af4ddb8 commit b6f3d78

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

idf_build_apps/junit/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Apache-2.0
33

44
"""
@@ -211,4 +211,4 @@ def create_test_report(self) -> None:
211211
xml.append(test_suite.to_xml_elem())
212212

213213
ElementTree.ElementTree(xml).write(self.filepath, encoding='utf-8')
214-
LOGGER.info('Test report written to %s', self.filepath)
214+
LOGGER.info('Generated build junit report at: %s', self.filepath)

idf_build_apps/main.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def find_apps(
7676
## `preserve`
7777
if 'preserve' in kwargs:
7878
LOGGER.warning(
79-
'Passing "preserve" directly is deprecated. '
79+
'DEPRECATED: Passing "preserve" directly is deprecated. '
8080
'Pass "no_preserve" instead to disable preserving the build directory'
8181
)
8282
kwargs['no_preserve'] = not kwargs.pop('preserve')
@@ -103,11 +103,14 @@ def find_apps(
103103
apps: t.Set[App] = set()
104104
if find_arguments.target == 'all':
105105
targets = ALL_TARGETS
106+
LOGGER.info('Searching for apps by all targets')
106107
else:
107108
targets = [find_arguments.target]
109+
LOGGER.info('Searching for apps by target: %s', find_arguments.target)
108110

109111
for _t in targets:
110112
for _p in find_arguments.paths:
113+
LOGGER.debug('Searching for apps in path %s for target %s', _p, _t)
111114
apps.update(
112115
_find_apps(
113116
_p,
@@ -117,7 +120,7 @@ def find_apps(
117120
)
118121
)
119122

120-
LOGGER.info(f'Found {len(apps)} apps in total')
123+
LOGGER.info('Found %d apps in total', len(apps))
121124

122125
return sorted(apps)
123126

@@ -141,7 +144,7 @@ def build_apps(
141144
## `check_app_dependencies`
142145
if 'check_app_dependencies' in kwargs:
143146
LOGGER.warning(
144-
'Passing "check_app_dependencies" directly is deprecated. '
147+
'DEPRECATED: Passing "check_app_dependencies" directly is deprecated. '
145148
'Pass "modified_components" instead to enable dependency-driven build feature'
146149
)
147150
kwargs.pop('check_app_dependencies')
@@ -162,20 +165,22 @@ def build_apps(
162165
test_suite = TestSuite('build_apps')
163166

164167
start, stop = get_parallel_start_stop(len(apps), build_arguments.parallel_count, build_arguments.parallel_index)
165-
LOGGER.info('Total %s apps. running build for app %s-%s', len(apps), start, stop)
168+
LOGGER.info('Processing %d total apps: building apps %d-%d', len(apps), start, stop)
166169

167170
# cleanup collect files if exists at this early-stage
168171
for f in (build_arguments.collect_app_info, build_arguments.collect_size_info, build_arguments.junitxml):
169172
if f and os.path.isfile(f):
173+
LOGGER.debug('Removing existing collect file: %s', f)
170174
os.remove(f)
171-
LOGGER.debug('Remove existing collect file %s', f)
172175

173176
exit_code = 0
174177

175178
# create empty files, avoid no file when no app is built
176179
if build_arguments.collect_app_info:
180+
LOGGER.debug('Creating empty app info file: %s', build_arguments.collect_app_info)
177181
Path(build_arguments.collect_app_info).touch()
178182
if build_arguments.collect_size_info:
183+
LOGGER.debug('Creating empty size info file: %s', build_arguments.collect_size_info)
179184
Path(build_arguments.collect_size_info).touch()
180185

181186
for i, app in enumerate(apps):
@@ -189,7 +194,7 @@ def build_apps(
189194
app.verbose = build_arguments.build_verbose
190195
app.copy_sdkconfig = build_arguments.copy_sdkconfig
191196

192-
LOGGER.info('(%s/%s) Building app: %s', index, len(apps), app)
197+
LOGGER.info('(%d/%d) Building app: %s', index, len(apps), app)
193198

194199
app.build(
195200
manifest_rootpath=build_arguments.manifest_rootpath,
@@ -207,12 +212,14 @@ def build_apps(
207212
if build_arguments.collect_app_info:
208213
with open(build_arguments.collect_app_info, 'a') as fw:
209214
fw.write(app.to_json() + '\n')
210-
LOGGER.debug('Recorded app info in %s', build_arguments.collect_app_info)
215+
LOGGER.debug('Recorded app info in file: %s', build_arguments.collect_app_info)
211216

212217
if app.build_status == BuildStatus.FAILED:
213218
if not build_arguments.keep_going:
219+
LOGGER.error('Build failed and keep_going=False, stopping build process')
214220
return 1
215221
else:
222+
LOGGER.warning('Build failed but keep_going=True, continuing with next app')
216223
exit_code = 1
217224
elif app.build_status == BuildStatus.SUCCESS:
218225
if build_arguments.collect_size_info and app.size_json_path:
@@ -229,13 +236,12 @@ def build_apps(
229236
)
230237
+ '\n'
231238
)
232-
LOGGER.debug('Recorded size info file path in %s', build_arguments.collect_size_info)
239+
LOGGER.debug('Recorded size info file path: %s', build_arguments.collect_size_info)
233240

234241
LOGGER.info('') # add one empty line for separating different builds
235242

236243
if build_arguments.junitxml:
237244
TestReport([test_suite], build_arguments.junitxml).create_test_report()
238-
LOGGER.info('Generated junit report for build apps: %s', build_arguments.junitxml)
239245

240246
return exit_code
241247

0 commit comments

Comments
 (0)