mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 20:57:20 +08:00
+2
-2
@@ -169,12 +169,12 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
|||||||
AddOption('--project-path',
|
AddOption('--project-path',
|
||||||
dest = 'project-path',
|
dest = 'project-path',
|
||||||
type = 'string',
|
type = 'string',
|
||||||
default = False,
|
default = None,
|
||||||
help = 'set dist-ide project output path')
|
help = 'set dist-ide project output path')
|
||||||
AddOption('--project-name',
|
AddOption('--project-name',
|
||||||
dest = 'project-name',
|
dest = 'project-name',
|
||||||
type = 'string',
|
type = 'string',
|
||||||
default = False,
|
default = None,
|
||||||
help = 'set project name')
|
help = 'set project name')
|
||||||
AddOption('--reset-project-config',
|
AddOption('--reset-project-config',
|
||||||
dest = 'reset-project-config',
|
dest = 'reset-project-config',
|
||||||
|
|||||||
+38
-13
@@ -399,7 +399,34 @@ def RelativeProjectPath(env, path):
|
|||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
def UpdateCproject(env, project, excluding, reset):
|
def HandleExcludingOption(entry, sourceEntries, excluding):
|
||||||
|
old_excluding = []
|
||||||
|
if entry != None:
|
||||||
|
old_excluding = entry.get('excluding').split('|')
|
||||||
|
sourceEntries.remove(entry)
|
||||||
|
|
||||||
|
value = ''
|
||||||
|
for item in old_excluding:
|
||||||
|
if item.startswith('//') :
|
||||||
|
old_excluding.remove(item)
|
||||||
|
else :
|
||||||
|
if value == '':
|
||||||
|
value = item
|
||||||
|
else:
|
||||||
|
value += '|' + item
|
||||||
|
|
||||||
|
for item in excluding:
|
||||||
|
# add special excluding path prefix for RT-Thread
|
||||||
|
item = '//' + item
|
||||||
|
if value == '':
|
||||||
|
value = item
|
||||||
|
else:
|
||||||
|
value += '|' + item
|
||||||
|
|
||||||
|
SubElement(sourceEntries, 'entry', {'excluding': value, 'flags': 'VALUE_WORKSPACE_PATH|RESOLVED', 'kind':'sourcePath', 'name':""})
|
||||||
|
|
||||||
|
|
||||||
|
def UpdateCproject(env, project, excluding, reset, prj_name):
|
||||||
excluding = sorted(excluding)
|
excluding = sorted(excluding)
|
||||||
|
|
||||||
cproject = etree.parse('.cproject')
|
cproject = etree.parse('.cproject')
|
||||||
@@ -412,17 +439,15 @@ def UpdateCproject(env, project, excluding, reset):
|
|||||||
|
|
||||||
sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries')
|
sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries')
|
||||||
entry = sourceEntries.find('entry')
|
entry = sourceEntries.find('entry')
|
||||||
if entry != None:
|
HandleExcludingOption(entry, sourceEntries, excluding)
|
||||||
sourceEntries.remove(entry)
|
# update refreshScope
|
||||||
|
if prj_name:
|
||||||
value = ''
|
prj_name = '/' + prj_name
|
||||||
for item in excluding:
|
configurations = root.findall('storageModule/configuration')
|
||||||
if value == '':
|
for configuration in configurations:
|
||||||
value = item
|
resource = configuration.find('resource')
|
||||||
else:
|
configuration.remove(resource)
|
||||||
value += '|' + item
|
SubElement(configuration, 'resource', {'resourceType': "PROJECT", 'workspacePath': prj_name})
|
||||||
|
|
||||||
SubElement(sourceEntries, 'entry', {'excluding': value, 'flags': 'VALUE_WORKSPACE_PATH|RESOLVED', 'kind':'sourcePath', 'name':""})
|
|
||||||
|
|
||||||
# write back to .cproject
|
# write back to .cproject
|
||||||
out = open('.cproject', 'w')
|
out = open('.cproject', 'w')
|
||||||
@@ -451,7 +476,7 @@ def TargetEclipse(env, reset = False, prj_name = None):
|
|||||||
excluding = GenExcluding(env, project)
|
excluding = GenExcluding(env, project)
|
||||||
|
|
||||||
# update the project configuration on '.cproject' file
|
# update the project configuration on '.cproject' file
|
||||||
UpdateCproject(env, project, excluding, reset)
|
UpdateCproject(env, project, excluding, reset, prj_name)
|
||||||
|
|
||||||
print('done!')
|
print('done!')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user