diff options
| author | Bernard Xiong <[email protected]> | 2019-11-28 21:12:05 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-11-28 21:12:05 +0800 |
| commit | 4b40c8096dca8530ea984b4a0701e1da70044ece (patch) | |
| tree | 4f95762c96875b9e8a55b1cf005eb0011c87b8a4 /tools/eclipse.py | |
| parent | 6b5af71e62fdb2444b43c2a7fd9c2935cc8933c4 (diff) | |
| parent | 470372c5be170d8cbf262bd4560577d308cae25f (diff) | |
Merge pull request #3226 from armink/fix_eclipse
Fix eclipse
Diffstat (limited to 'tools/eclipse.py')
| -rw-r--r-- | tools/eclipse.py | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/tools/eclipse.py b/tools/eclipse.py index 191cfc2b3a..daac72befe 100644 --- a/tools/eclipse.py +++ b/tools/eclipse.py @@ -399,7 +399,34 @@ def RelativeProjectPath(env, 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) cproject = etree.parse('.cproject') @@ -412,17 +439,15 @@ def UpdateCproject(env, project, excluding, reset): sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries') entry = sourceEntries.find('entry') - if entry != None: - sourceEntries.remove(entry) - - value = '' - for item in excluding: - if value == '': - value = item - else: - value += '|' + item - - SubElement(sourceEntries, 'entry', {'excluding': value, 'flags': 'VALUE_WORKSPACE_PATH|RESOLVED', 'kind':'sourcePath', 'name':""}) + HandleExcludingOption(entry, sourceEntries, excluding) + # update refreshScope + if prj_name: + prj_name = '/' + prj_name + configurations = root.findall('storageModule/configuration') + for configuration in configurations: + resource = configuration.find('resource') + configuration.remove(resource) + SubElement(configuration, 'resource', {'resourceType': "PROJECT", 'workspacePath': prj_name}) # write back to .cproject out = open('.cproject', 'w') @@ -451,7 +476,7 @@ def TargetEclipse(env, reset = False, prj_name = None): excluding = GenExcluding(env, project) # update the project configuration on '.cproject' file - UpdateCproject(env, project, excluding, reset) + UpdateCproject(env, project, excluding, reset, prj_name) print('done!') |
