40
40
MBED_CONFIG_FILE , MBED_LIBRARIES_DRIVERS ,
41
41
MBED_LIBRARIES_PLATFORM , MBED_LIBRARIES_HAL ,
42
42
BUILD_DIR )
43
- from .resources import Resources , FileType , FileRef
43
+ from .resources import Resources , FileType , FileRef , PsaManifestResourceFilter
44
44
from .notifier .mock import MockNotifier
45
45
from .targets import TARGET_NAMES , TARGET_MAP , CORE_ARCH , Target
46
46
from .libraries import Library
@@ -514,7 +514,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
514
514
report = None , properties = None , project_id = None ,
515
515
project_description = None , config = None ,
516
516
app_config = None , build_profile = None , stats_depth = None ,
517
- ignore = None , spe_build = False ):
517
+ ignore = None , resource_filter = None ):
518
518
""" Build a project. A project may be a test or a user program.
519
519
520
520
Positional arguments:
@@ -542,6 +542,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
542
542
build_profile - a dict of flags that will be passed to the compiler
543
543
stats_depth - depth level for memap to display file/dirs
544
544
ignore - list of paths to add to mbedignore
545
+ resource_filter - can be used for filtering out resources after scan
545
546
"""
546
547
# Convert src_path to a list if needed
547
548
if not isinstance (src_paths , list ):
@@ -584,8 +585,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
584
585
try :
585
586
resources = Resources (notify ).scan_with_toolchain (
586
587
src_paths , toolchain , inc_dirs = inc_dirs )
587
- if spe_build :
588
- resources . filter_spe ()
588
+ resources . filter ( resource_filter )
589
+
589
590
# Change linker script if specified
590
591
if linker_script is not None :
591
592
resources .add_file_ref (FileType .LD_SCRIPT , linker_script , linker_script )
@@ -667,7 +668,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
667
668
archive = True , notify = None , macros = None , inc_dirs = None , jobs = 1 ,
668
669
report = None , properties = None , project_id = None ,
669
670
remove_config_header_file = False , app_config = None ,
670
- build_profile = None , ignore = None ):
671
+ build_profile = None , ignore = None , resource_filter = None ):
671
672
""" Build a library
672
673
673
674
Positional arguments:
@@ -693,6 +694,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
693
694
app_config - location of a chosen mbed_app.json file
694
695
build_profile - a dict of flags that will be passed to the compiler
695
696
ignore - list of paths to add to mbedignore
697
+ resource_filter - can be used for filtering out resources after scan
696
698
"""
697
699
698
700
# Convert src_path to a list if needed
@@ -753,6 +755,8 @@ def build_library(src_paths, build_path, target, toolchain_name,
753
755
try :
754
756
res = Resources (notify ).scan_with_toolchain (
755
757
src_paths , toolchain , dependencies_paths , inc_dirs = inc_dirs )
758
+ res .filter (resource_filter )
759
+ res .filter (PsaManifestResourceFilter ())
756
760
757
761
# Copy headers, objects and static libraries - all files needed for
758
762
# static lib
0 commit comments