@@ -301,7 +301,7 @@ def target_supports_toolchain(target, toolchain_name):
301
301
def prepare_toolchain (src_paths , build_dir , target , toolchain_name ,
302
302
macros = None , clean = False , jobs = 1 ,
303
303
notify = None , config = None , app_config = None ,
304
- build_profile = None ):
304
+ build_profile = None , ignore = None ):
305
305
""" Prepares resource related objects - toolchain, target, config
306
306
307
307
Positional arguments:
@@ -317,6 +317,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
317
317
config - a Config object to use instead of creating one
318
318
app_config - location of a chosen mbed_app.json file
319
319
build_profile - a list of mergeable build profiles
320
+ ignore - list of paths to add to mbedignore
320
321
"""
321
322
322
323
# We need to remove all paths which are repeated to avoid
@@ -348,6 +349,9 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
348
349
toolchain .jobs = jobs
349
350
toolchain .build_all = clean
350
351
352
+ if ignore :
353
+ toolchain .add_ignore_patterns (root = "." , base_path = "." , patterns = ignore )
354
+
351
355
return toolchain
352
356
353
357
def _printihex (ihex ):
@@ -502,7 +506,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
502
506
notify = None , name = None , macros = None , inc_dirs = None , jobs = 1 ,
503
507
report = None , properties = None , project_id = None ,
504
508
project_description = None , config = None ,
505
- app_config = None , build_profile = None , stats_depth = None ):
509
+ app_config = None , build_profile = None , stats_depth = None , ignore = None ):
506
510
""" Build a project. A project may be a test or a user program.
507
511
508
512
Positional arguments:
@@ -529,6 +533,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
529
533
app_config - location of a chosen mbed_app.json file
530
534
build_profile - a dict of flags that will be passed to the compiler
531
535
stats_depth - depth level for memap to display file/dirs
536
+ ignore - list of paths to add to mbedignore
532
537
"""
533
538
534
539
# Convert src_path to a list if needed
@@ -546,7 +551,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
546
551
toolchain = prepare_toolchain (
547
552
src_paths , build_path , target , toolchain_name , macros = macros ,
548
553
clean = clean , jobs = jobs , notify = notify , config = config ,
549
- app_config = app_config , build_profile = build_profile )
554
+ app_config = app_config , build_profile = build_profile , ignore = ignore )
550
555
551
556
# The first path will give the name to the library
552
557
name = (name or toolchain .config .name or
@@ -643,7 +648,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
643
648
archive = True , notify = None , macros = None , inc_dirs = None , jobs = 1 ,
644
649
report = None , properties = None , project_id = None ,
645
650
remove_config_header_file = False , app_config = None ,
646
- build_profile = None ):
651
+ build_profile = None , ignore = None ):
647
652
""" Build a library
648
653
649
654
Positional arguments:
@@ -668,6 +673,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
668
673
remove_config_header_file - delete config header file when done building
669
674
app_config - location of a chosen mbed_app.json file
670
675
build_profile - a dict of flags that will be passed to the compiler
676
+ ignore - list of paths to add to mbedignore
671
677
"""
672
678
673
679
# Convert src_path to a list if needed
@@ -691,7 +697,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
691
697
toolchain = prepare_toolchain (
692
698
src_paths , build_path , target , toolchain_name , macros = macros ,
693
699
clean = clean , jobs = jobs , notify = notify , app_config = app_config ,
694
- build_profile = build_profile )
700
+ build_profile = build_profile , ignore = ignore )
695
701
696
702
# The first path will give the name to the library
697
703
if name is None :
@@ -793,7 +799,7 @@ def mbed2_obj_path(target_name, toolchain_name):
793
799
794
800
def build_lib (lib_id , target , toolchain_name , clean = False , macros = None ,
795
801
notify = None , jobs = 1 , report = None , properties = None ,
796
- build_profile = None ):
802
+ build_profile = None , ignore = None ):
797
803
""" Legacy method for building mbed libraries
798
804
799
805
Positional arguments:
@@ -809,6 +815,7 @@ def build_lib(lib_id, target, toolchain_name, clean=False, macros=None,
809
815
report - a dict where a result may be appended
810
816
properties - UUUUHHHHH beats me
811
817
build_profile - a dict of flags that will be passed to the compiler
818
+ ignore - list of paths to add to mbedignore
812
819
"""
813
820
lib = Library (lib_id )
814
821
if not lib .is_supported (target , toolchain_name ):
@@ -872,7 +879,8 @@ def build_lib(lib_id, target, toolchain_name, clean=False, macros=None,
872
879
873
880
toolchain = prepare_toolchain (
874
881
src_paths , tmp_path , target , toolchain_name , macros = macros ,
875
- notify = notify , build_profile = build_profile , jobs = jobs , clean = clean )
882
+ notify = notify , build_profile = build_profile , jobs = jobs , clean = clean ,
883
+ ignore = ignore )
876
884
877
885
notify .info ("Building library %s (%s, %s)" %
878
886
(name .upper (), target .name , toolchain_name ))
@@ -948,7 +956,7 @@ def build_lib(lib_id, target, toolchain_name, clean=False, macros=None,
948
956
# library
949
957
def build_mbed_libs (target , toolchain_name , clean = False , macros = None ,
950
958
notify = None , jobs = 1 , report = None , properties = None ,
951
- build_profile = None ):
959
+ build_profile = None , ignore = None ):
952
960
""" Function returns True is library was built and false if building was
953
961
skipped
954
962
@@ -964,6 +972,7 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
964
972
report - a dict where a result may be appended
965
973
properties - UUUUHHHHH beats me
966
974
build_profile - a dict of flags that will be passed to the compiler
975
+ ignore - list of paths to add to mbedignore
967
976
"""
968
977
969
978
if report != None :
@@ -1007,7 +1016,7 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
1007
1016
1008
1017
toolchain = prepare_toolchain (
1009
1018
["" ], tmp_path , target , toolchain_name , macros = macros , notify = notify ,
1010
- build_profile = build_profile , jobs = jobs , clean = clean )
1019
+ build_profile = build_profile , jobs = jobs , clean = clean , ignore = ignore )
1011
1020
1012
1021
# Take into account the library configuration (MBED_CONFIG_FILE)
1013
1022
config = toolchain .config
0 commit comments