提交 3d0ccf62 编写于 作者: armink_ztl's avatar armink_ztl

[tools] change the eclipse default paths exclude mode.

上级 c8beffee
...@@ -181,11 +181,6 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ ...@@ -181,11 +181,6 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'reset the project configurations to default') help = 'reset the project configurations to default')
AddOption('--mcu-type',
dest = 'mcu-type',
type = 'string',
default = False,
help = 'set mcu type name')
AddOption('--cscope', AddOption('--cscope',
dest = 'cscope', dest = 'cscope',
action = 'store_true', action = 'store_true',
...@@ -857,7 +852,7 @@ def GenTargetProject(program = None): ...@@ -857,7 +852,7 @@ def GenTargetProject(program = None):
if GetOption('target') == 'eclipse': if GetOption('target') == 'eclipse':
from eclipse import TargetEclipse from eclipse import TargetEclipse
TargetEclipse(Env, GetOption('reset-project-config'), GetOption('project-name'), GetOption('mcu-type')) TargetEclipse(Env, GetOption('reset-project-config'), GetOption('project-name'))
def EndBuilding(target, program = None): def EndBuilding(target, program = None):
......
...@@ -128,7 +128,7 @@ def ConverToEclipsePathFormat(path): ...@@ -128,7 +128,7 @@ def ConverToEclipsePathFormat(path):
return '"${workspace_loc:/${ProjName}/' + path + '}"' return '"${workspace_loc:/${ProjName}/' + path + '}"'
def HandleToolOption(tools, env, project, reset, mcu_type): def HandleToolOption(tools, env, project, reset):
BSP_ROOT = os.path.abspath(env['BSP_ROOT']) BSP_ROOT = os.path.abspath(env['BSP_ROOT'])
CPPDEFINES = project['CPPDEFINES'] CPPDEFINES = project['CPPDEFINES']
...@@ -302,7 +302,8 @@ def UpdateProjectStructure(env, prj_name): ...@@ -302,7 +302,8 @@ def UpdateProjectStructure(env, prj_name):
return return
def GenExcluding(env, project, mcu_type):
def GenExcluding(env, project):
rtt_root = os.path.abspath(env['RTT_ROOT']) rtt_root = os.path.abspath(env['RTT_ROOT'])
bsp_root = os.path.abspath(env['BSP_ROOT']) bsp_root = os.path.abspath(env['BSP_ROOT'])
coll_dirs = CollectPaths(project['DIRS']) coll_dirs = CollectPaths(project['DIRS'])
...@@ -313,20 +314,17 @@ def GenExcluding(env, project, mcu_type): ...@@ -313,20 +314,17 @@ 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 check_path = []
exclude_paths = ExcludePaths(bsp_root, all_paths) exclude_paths = []
else : # analyze the primary folder which relative to BSP_ROOT and in all_paths
check_path = [] for path in all_paths :
exclude_paths = [] if path.startswith(bsp_root) :
# analyze the primary folder which relative to BSP_ROOT and in all_paths folders = RelativeProjectPath(env, path).split('\\')
for path in all_paths : if folders[0] != '.' and '\\' + folders[0] not in check_path:
if path.startswith(bsp_root) : check_path += ['\\' + folders[0]]
folders = RelativeProjectPath(env, path).split('\\') # exclue the folder which has managed by scons
if folders[0] != '.' and '\\' + folders[0] not in check_path: for path in check_path:
check_path += ['\\' + folders[0]] exclude_paths += ExcludePaths(bsp_root + path, all_paths)
# 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)
...@@ -374,7 +372,7 @@ def RelativeProjectPath(env, path): ...@@ -374,7 +372,7 @@ def RelativeProjectPath(env, path):
return path return path
def UpdateCproject(env, project, excluding, reset, mcu_type): def UpdateCproject(env, project, excluding, reset):
excluding = sorted(excluding) excluding = sorted(excluding)
cproject = etree.parse('.cproject') cproject = etree.parse('.cproject')
...@@ -383,7 +381,7 @@ def UpdateCproject(env, project, excluding, reset, mcu_type): ...@@ -383,7 +381,7 @@ def UpdateCproject(env, project, excluding, reset, mcu_type):
cconfigurations = root.findall('storageModule/cconfiguration') cconfigurations = root.findall('storageModule/cconfiguration')
for cconfiguration in cconfigurations: for cconfiguration in cconfigurations:
tools = cconfiguration.findall('storageModule/configuration/folderInfo/toolChain/tool') tools = cconfiguration.findall('storageModule/configuration/folderInfo/toolChain/tool')
HandleToolOption(tools, env, project, reset, mcu_type) HandleToolOption(tools, env, project, reset)
sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries') sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries')
entry = sourceEntries.find('entry') entry = sourceEntries.find('entry')
...@@ -408,7 +406,7 @@ def UpdateCproject(env, project, excluding, reset, mcu_type): ...@@ -408,7 +406,7 @@ def UpdateCproject(env, project, excluding, reset, mcu_type):
out.close() out.close()
def TargetEclipse(env, reset = False, prj_name = None, mcu_type = None): def TargetEclipse(env, reset = False, prj_name = None):
global source_pattern global source_pattern
print('Update eclipse setting...') print('Update eclipse setting...')
...@@ -423,10 +421,10 @@ def TargetEclipse(env, reset = False, prj_name = None, mcu_type = None): ...@@ -423,10 +421,10 @@ def TargetEclipse(env, reset = False, prj_name = None, mcu_type = None):
UpdateProjectStructure(env, prj_name) UpdateProjectStructure(env, prj_name)
# generate the exclude paths and files # generate the exclude paths and files
excluding = GenExcluding(env, project, mcu_type) excluding = GenExcluding(env, project)
# update the project configuration on '.cproject' file # update the project configuration on '.cproject' file
UpdateCproject(env, project, excluding, reset, mcu_type) UpdateCproject(env, project, excluding, reset)
print('done!') print('done!')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册