Skip to content

Commit

Permalink
Merge pull request #115 from espressif/fix/defined_depends_filepatter…
Browse files Browse the repository at this point in the history
…n_but_not_modified_any_component
  • Loading branch information
hfudev authored Jan 15, 2024
2 parents 2a8e60c + db9a851 commit 5707dd2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion idf_build_apps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ def _check_should_build(
self._checked_should_build = True
return

if modified_components == []: # noqa # it's different from `not modified_components`
# if didn't modify any components, and no `depends_filepatterns` defined, skip
if modified_components == [] and not self.depends_filepatterns:
self.build_status = BuildStatus.SKIPPED
self.build_comment = 'current build does not modify any components'
self._checked_should_build = True
Expand Down
36 changes: 35 additions & 1 deletion tests/test_finder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

import logging
Expand Down Expand Up @@ -281,6 +281,40 @@ def test_with_depends_components_and_filepatterns(
else:
assert not filtered_apps

@pytest.mark.parametrize(
'modified_files',
[
'examples/wifi/getting_started/softAP/main/softap_example_main.c',
'examples/wifi/getting_started/station/main/station_example_main.c',
],
)
def test_depends_filepatterns_only_on_parent_dir(self, tmp_path, modified_files):
test_dir = os.path.join(IDF_PATH, 'examples', 'wifi', 'getting_started')

apps = find_apps(test_dir, 'esp32', recursive=True)
assert apps

yaml_file = tmp_path / 'test.yml'
with open(yaml_file, 'w') as fw:
fw.write(
'''
examples/wifi/getting_started:
depends_filepatterns:
- examples/wifi/getting_started/**/*
''',
)

filtered_apps = find_apps(
test_dir,
'esp32',
recursive=True,
modified_components=[],
modified_files=[modified_files],
manifest_rootpath=IDF_PATH,
manifest_files=[yaml_file],
)
assert len(filtered_apps) == len(apps)

@pytest.mark.parametrize(
'modified_files, could_find_apps',
[
Expand Down

0 comments on commit 5707dd2

Please sign in to comment.