File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 10
10
import sys
11
11
import textwrap
12
12
import typing as t
13
+ from pathlib import Path
13
14
14
15
import argcomplete
15
16
from pydantic import (
@@ -170,6 +171,13 @@ def build_apps(
170
171
LOGGER .debug ('Remove existing collect file %s' , f )
171
172
172
173
exit_code = 0
174
+
175
+ # create empty files, avoid no file when no app is built
176
+ if build_arguments .collect_app_info :
177
+ Path (build_arguments .collect_app_info ).touch ()
178
+ if build_arguments .collect_size_info :
179
+ Path (build_arguments .collect_size_info ).touch ()
180
+
173
181
for i , app in enumerate (apps ):
174
182
index = i + 1 # we use 1-based
175
183
if index < start or index > stop :
Original file line number Diff line number Diff line change 1
- # SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
4
import os
22
22
from idf_build_apps .app import (
23
23
CMakeApp ,
24
24
)
25
+ from idf_build_apps .args import BuildArguments
25
26
from idf_build_apps .constants import (
26
27
IDF_PATH ,
27
28
BuildStatus ,
@@ -202,3 +203,18 @@ def test_build_apps_without_passing_apps(self, tmp_path):
202
203
assert test_suite .attrib ['skipped' ] == '0'
203
204
204
205
assert test_suite .findall ('testcase' )[0 ].attrib ['name' ] == 'foo/bar/build'
206
+
207
+
208
+ def test_build_apps_collect_files_when_no_apps_built (tmp_path ):
209
+ os .chdir (tmp_path )
210
+
211
+ build_apps (
212
+ build_arguments = BuildArguments (
213
+ target = 'esp32' ,
214
+ collect_app_info_filename = 'app_info.txt' ,
215
+ collect_size_info_filename = 'size_info.txt' ,
216
+ )
217
+ )
218
+
219
+ assert os .path .exists ('app_info.txt' )
220
+ assert os .path .exists ('size_info.txt' )
You can’t perform that action at this time.
0 commit comments