Skip to content

Commit a4cc320

Browse files
committed
Add get_file_paths res API and use it
1 parent 28dbbd6 commit a4cc320

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tools/resources/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ def get_file_refs(self, file_type):
275275
def get_file_names(self, file_type):
276276
return [f.name for f in self.get_file_refs(file_type)]
277277

278+
def get_file_paths(self, file_type):
279+
return [f.path for f in self.get_file_refs(file_type)]
280+
278281
def add_files_to_type(self, file_type, files):
279282
for f in files:
280283
self.add_file_ref(file_type, f, f)

tools/toolchains/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ def compile_sources(self, resources, inc_dirs=None):
374374

375375
self.notify.cc_verbose("Macros: "+' '.join(['-D%s' % s for s in self.get_symbols()]))
376376

377-
inc_paths = [path for _, path
378-
in resources.get_file_refs(FileType.INC_DIR)]
377+
inc_paths = resources.get_file_paths(FileType.INC_DIR)
379378
if inc_dirs is not None:
380379
if isinstance(inc_dirs, list):
381380
inc_paths.extend(inc_dirs)
@@ -628,14 +627,13 @@ def link_program(self, r, tmp_path, name):
628627
bin = None if ext == 'elf' else full_path
629628
map = join(tmp_path, name + '.map')
630629

631-
objects = sorted(set([path for _, path
632-
in r.get_file_refs(FileType.OBJECT)]))
630+
objects = sorted(set(r.get_file_paths(FileType.OBJECT)))
633631
config_file = ([self.config.app_config_location]
634632
if self.config.app_config_location else [])
635633
linker_script = [path for _, path in r.get_file_refs(FileType.LD_SCRIPT)
636634
if path.endswith(self.LINKER_EXT)][-1]
637-
lib_dirs = [path for _, path in r.get_file_refs(FileType.LIB_DIR)]
638-
libraries = [path for _, path in r.get_file_refs(FileType.LIB)]
635+
lib_dirs = r.get_file_paths(FileType.LIB_DIR)
636+
libraries = r.get_file_paths(FileType.LIB)
639637
dependencies = objects + libraries + [linker_script] + config_file
640638
dependencies.append(join(self.build_dir, self.PROFILE_FILE_NAME + "-ld"))
641639
if self.need_update(elf, dependencies):

0 commit comments

Comments
 (0)