4040 MBED_CONFIG_FILE , MBED_LIBRARIES_DRIVERS ,
4141 MBED_LIBRARIES_PLATFORM , MBED_LIBRARIES_HAL ,
4242 BUILD_DIR )
43- from .resources import Resources , FileType , FileRef
43+ from .resources import Resources , FileType , FileRef , PsaManifestResourceFilter
4444from .notifier .mock import MockNotifier
4545from .targets import TARGET_NAMES , TARGET_MAP , CORE_ARCH , Target
4646from .libraries import Library
@@ -514,7 +514,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
514514 report = None , properties = None , project_id = None ,
515515 project_description = None , config = None ,
516516 app_config = None , build_profile = None , stats_depth = None ,
517- ignore = None , spe_build = False ):
517+ ignore = None , resource_filter = None ):
518518 """ Build a project. A project may be a test or a user program.
519519
520520 Positional arguments:
@@ -542,6 +542,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
542542 build_profile - a dict of flags that will be passed to the compiler
543543 stats_depth - depth level for memap to display file/dirs
544544 ignore - list of paths to add to mbedignore
545+ resource_filter - can be used for filtering out resources after scan
545546 """
546547 # Convert src_path to a list if needed
547548 if not isinstance (src_paths , list ):
@@ -584,8 +585,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
584585 try :
585586 resources = Resources (notify ).scan_with_toolchain (
586587 src_paths , toolchain , inc_dirs = inc_dirs )
587- if spe_build :
588- resources . filter_spe ()
588+ resources . filter ( resource_filter )
589+
589590 # Change linker script if specified
590591 if linker_script is not None :
591592 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,
667668 archive = True , notify = None , macros = None , inc_dirs = None , jobs = 1 ,
668669 report = None , properties = None , project_id = None ,
669670 remove_config_header_file = False , app_config = None ,
670- build_profile = None , ignore = None ):
671+ build_profile = None , ignore = None , resource_filter = None ):
671672 """ Build a library
672673
673674 Positional arguments:
@@ -693,6 +694,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
693694 app_config - location of a chosen mbed_app.json file
694695 build_profile - a dict of flags that will be passed to the compiler
695696 ignore - list of paths to add to mbedignore
697+ resource_filter - can be used for filtering out resources after scan
696698 """
697699
698700 # Convert src_path to a list if needed
@@ -753,6 +755,8 @@ def build_library(src_paths, build_path, target, toolchain_name,
753755 try :
754756 res = Resources (notify ).scan_with_toolchain (
755757 src_paths , toolchain , dependencies_paths , inc_dirs = inc_dirs )
758+ res .filter (resource_filter )
759+ res .filter (PsaManifestResourceFilter ())
756760
757761 # Copy headers, objects and static libraries - all files needed for
758762 # static lib
0 commit comments