Skip to content

Commit b57fbf4

Browse files
committed
Exclude folders from build that contain .buildignore file (part of de-fork of mbed HAL+RTOS)
1 parent cd4172a commit b57fbf4

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

tools/toolchains/__init__.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,26 +363,24 @@ def scan_resources(self, path, exclude_paths=None):
363363
for d in copy(dirs):
364364
dir_path = join(root, d)
365365

366-
if d == '.hg':
366+
if d == '.hg' or d == '.git':
367367
resources.repo_dirs.append(dir_path)
368368
resources.repo_files.extend(self.scan_repository(dir_path))
369-
370-
should_exclude_path = False
369+
370+
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
371+
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
372+
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
373+
(d.upper() == 'TESTS') or
374+
exists(join(dir_path, '.buildignore'))):
375+
dirs.remove(d)
371376

372377
if exclude_paths:
373378
for exclude_path in exclude_paths:
374379
rel_path = relpath(dir_path, exclude_path)
375380
if not (rel_path.startswith('..')):
376-
should_exclude_path = True
381+
dirs.remove(d)
377382
break
378383

379-
if ((should_exclude_path) or
380-
(d.startswith('.') or d in self.legacy_ignore_dirs) or
381-
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
382-
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
383-
(d == 'TESTS')):
384-
dirs.remove(d)
385-
386384
# Add root to include paths
387385
resources.inc_dirs.append(root)
388386

0 commit comments

Comments
 (0)