MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / UpdateCproject

Function UpdateCproject

tools/targets/eclipse.py:496–526  ·  view source on GitHub ↗
(env, project, excluding, reset, prj_name)

Source from the content-addressed store, hash-verified

494
495
496def UpdateCproject(env, project, excluding, reset, prj_name):
497 excluding = sorted(excluding)
498
499 cproject = etree.parse('.cproject')
500
501 root = cproject.getroot()
502 cconfigurations = root.findall('storageModule/cconfiguration')
503 for cconfiguration in cconfigurations:
504 tools = cconfiguration.findall('storageModule/configuration/folderInfo/toolChain/tool')
505 HandleToolOption(tools, env, project, reset)
506
507 sourceEntries = cconfiguration.find('storageModule/configuration/sourceEntries')
508 if sourceEntries != None:
509 entry = sourceEntries.find('entry')
510 HandleExcludingOption(entry, sourceEntries, excluding)
511 # update refreshScope
512 if prj_name:
513 prj_name = '/' + prj_name
514 configurations = root.findall('storageModule/configuration')
515 for configuration in configurations:
516 resource = configuration.find('resource')
517 configuration.remove(resource)
518 SubElement(configuration, 'resource', {'resourceType': "PROJECT", 'workspacePath': prj_name})
519
520 # write back to .cproject
521 out = open('.cproject', 'w')
522 out.write('<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n')
523 out.write('<?fileVersion 4.0.0?>')
524 xml_indent(root)
525 out.write(etree.tostring(root, encoding='utf-8').decode('utf-8'))
526 out.close()
527
528
529def TargetEclipse(env, reset=False, prj_name=None):

Callers 1

TargetEclipseFunction · 0.85

Calls 5

xml_indentFunction · 0.90
HandleToolOptionFunction · 0.85
HandleExcludingOptionFunction · 0.85
openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected