[tools] improve the eclipse project's exclude paths.

This commit is contained in:
armink 2019-10-25 11:57:33 +08:00
parent 3333462d13
commit c8beffeee0
1 changed files with 18 additions and 9 deletions

View File

@ -172,7 +172,7 @@ def HandleToolOption(tools, env, project, reset, mcu_type):
SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': item}) SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': item})
# change the inclue files (default) or definitions # change the inclue files (default) or definitions
if include_files_option is not None: if include_files_option is not None:
option = include_paths_option option = include_files_option
file_header = ''' file_header = '''
#ifndef RTCONFIG_PREINC_H__ #ifndef RTCONFIG_PREINC_H__
#define RTCONFIG_PREINC_H__ #define RTCONFIG_PREINC_H__
@ -313,7 +313,20 @@ def GenExcluding(env, project, mcu_type):
exclude_paths = ExcludePaths(rtt_root, all_paths) exclude_paths = ExcludePaths(rtt_root, all_paths)
elif rtt_root.startswith(bsp_root): elif rtt_root.startswith(bsp_root):
# RT-Thread root folder is in the bsp folder, such as project folder which generate by 'scons --dist' cmd # RT-Thread root folder is in the bsp folder, such as project folder which generate by 'scons --dist' cmd
if mcu_type is None : # BSP mode, not MCU mode
exclude_paths = ExcludePaths(bsp_root, all_paths) exclude_paths = ExcludePaths(bsp_root, all_paths)
else :
check_path = []
exclude_paths = []
# analyze the primary folder which relative to BSP_ROOT and in all_paths
for path in all_paths :
if path.startswith(bsp_root) :
folders = RelativeProjectPath(env, path).split('\\')
if folders[0] != '.' and '\\' + folders[0] not in check_path:
check_path += ['\\' + folders[0]]
# exclue the folder which has managed by scons
for path in check_path:
exclude_paths += ExcludePaths(bsp_root + path, all_paths)
else: else:
exclude_paths = ExcludePaths(rtt_root, all_paths) exclude_paths = ExcludePaths(rtt_root, all_paths)
exclude_paths += ExcludePaths(bsp_root, all_paths) exclude_paths += ExcludePaths(bsp_root, all_paths)
@ -332,19 +345,15 @@ def GenExcluding(env, project, mcu_type):
exclude_paths += [path] exclude_paths += [path]
exclude_paths = [RelativeProjectPath(env, path).replace('\\', '/') for path in exclude_paths] exclude_paths = [RelativeProjectPath(env, path).replace('\\', '/') for path in exclude_paths]
env['ExPaths'] = exclude_paths
all_files = CollectFiles(all_paths, source_pattern) all_files = CollectFiles(all_paths, source_pattern)
src_files = project['FILES'] src_files = project['FILES']
exclude_files = ExcludeFiles(all_files, src_files) exclude_files = ExcludeFiles(all_files, src_files)
exclude_files = [RelativeProjectPath(env, file).replace('\\', '/') for file in exclude_files] exclude_files = [RelativeProjectPath(env, file).replace('\\', '/') for file in exclude_files]
env['ExFiles'] = exclude_files
if mcu_type : env['ExPaths'] = exclude_paths
# TODO save the rt-thread and packages exclude folder only env['ExFiles'] = exclude_files
# TODO exclude the libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/ arm|iar|gcc/xxx.s
pass
return exclude_paths + exclude_files return exclude_paths + exclude_files