Require notifier in resources

pull/7183/head
Jimmy Brisson 2018-05-04 13:06:49 -05:00
parent 7c42302854
commit 4c7cf21feb
3 changed files with 10 additions and 8 deletions

View File

@ -43,6 +43,7 @@ from .paths import (MBED_CMSIS_PATH, MBED_TARGETS_PATH, MBED_LIBRARIES,
MBED_LIBRARIES_PLATFORM, MBED_LIBRARIES_HAL, MBED_LIBRARIES_PLATFORM, MBED_LIBRARIES_HAL,
BUILD_DIR) BUILD_DIR)
from .resources import Resources from .resources import Resources
from .notifier.mock import MockNotifier
from .targets import TARGET_NAMES, TARGET_MAP from .targets import TARGET_NAMES, TARGET_MAP
from .libraries import Library from .libraries import Library
from .toolchains import TOOLCHAIN_CLASSES from .toolchains import TOOLCHAIN_CLASSES
@ -137,7 +138,7 @@ def get_config(src_paths, target, toolchain_name, app_config=None):
toolchain = prepare_toolchain(src_paths, None, target, toolchain_name, toolchain = prepare_toolchain(src_paths, None, target, toolchain_name,
app_config=app_config) app_config=app_config)
res = Resources().scan_with_toolchain(src_paths, toolchain, exclude=False) res = Resources(MockNotifier()).scan_with_toolchain(src_paths, toolchain, exclude=False)
if toolchain.config.has_regions: if toolchain.config.has_regions:
_ = list(toolchain.config.regions) _ = list(toolchain.config.regions)
@ -516,7 +517,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
try: try:
# Call unified scan_resources # Call unified scan_resources
resources = Resources().scan_with_toolchain(src_paths, toolchain, inc_dirs=inc_dirs) resources = Resources(notify).scan_with_toolchain(
src_paths, toolchain, inc_dirs=inc_dirs)
# Change linker script if specified # Change linker script if specified
if linker_script is not None: if linker_script is not None:
@ -675,7 +677,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
try: try:
# Call unified scan_resources # Call unified scan_resources
resources = Resources().scan_with_toolchain( resources = Resources(notify).scan_with_toolchain(
src_paths, toolchain, dependencies_paths, inc_dirs=inc_dirs) src_paths, toolchain, dependencies_paths, inc_dirs=inc_dirs)
# Copy headers, objects and static libraries - all files needed for # Copy headers, objects and static libraries - all files needed for

View File

@ -133,7 +133,8 @@ class LazyDict(object):
self.eager = {} self.eager = {}
class Resources(object): class Resources(object):
def __init__(self, base_path=None, collect_ignores=False): def __init__(self, notify, base_path=None, collect_ignores=False):
self.notify = notify
self.base_path = base_path self.base_path = base_path
self.collect_ignores = collect_ignores self.collect_ignores = collect_ignores
@ -421,6 +422,7 @@ class Resources(object):
bottom-up mode the directories in dirnames are generated before dirpath bottom-up mode the directories in dirnames are generated before dirpath
itself is generated. itself is generated.
""" """
self.notify.progress("scan", abspath(path))
if base_path is None: if base_path is None:
base_path = path base_path = path
for root, dirs, files in walk(path, followlinks=True): for root, dirs, files in walk(path, followlinks=True):
@ -553,11 +555,9 @@ class Resources(object):
inc_dirs - additional include directories which should be added to inc_dirs - additional include directories which should be added to
the scanner resources the scanner resources
""" """
print(src_paths)
self.add_toolchain_labels(toolchain) self.add_toolchain_labels(toolchain)
for path in src_paths: for path in src_paths:
if exists(path): if exists(path):
toolchain.progress("scan", abspath(path))
if exclude: if exclude:
self.add_directory(path, base_path, exclude_paths=[toolchain.build_dir]) self.add_directory(path, base_path, exclude_paths=[toolchain.build_dir])
else: else:

View File

@ -2083,7 +2083,7 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
commons = [] commons = []
# Scan the directory for paths to probe for 'TESTS' folders # Scan the directory for paths to probe for 'TESTS' folders
base_resources = Resources() base_resources = Resources(MockNotifier())
base_resources.add_directory(base_dir, None) base_resources.add_directory(base_dir, None)
dirs = base_resources.inc_dirs dirs = base_resources.inc_dirs
@ -2093,7 +2093,7 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
# If the directory contains a subdirectory called 'TESTS', scan it for test cases # If the directory contains a subdirectory called 'TESTS', scan it for test cases
if 'TESTS' in subdirs: if 'TESTS' in subdirs:
walk_base_dir = join(directory, 'TESTS') walk_base_dir = join(directory, 'TESTS')
test_resources = Resources() test_resources = Resources(MockNotifier())
test_resources.add_directory(walk_base_dir, base_dir) test_resources.add_directory(walk_base_dir, base_dir)
# Loop through all subdirectories # Loop through all subdirectories