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

Function GenerateProjectFiles

tools/targets/vsc.py:290–323  ·  view source on GitHub ↗

Generate project.json file

(env)

Source from the content-addressed store, hash-verified

288 return
289
290def GenerateProjectFiles(env):
291 """
292 Generate project.json file
293 """
294 if not os.path.exists('.vscode'):
295 os.mkdir('.vscode')
296
297 project = env['project']
298 with open('.vscode/project.json', 'w') as vsc_file:
299 groups = []
300 for group in project:
301 if len(group['src']) > 0:
302 item = {}
303 item['name'] = group['name']
304 item['path'] = _make_path_relative(os.getcwd(), group['path'])
305 item['files'] = []
306
307 for fn in group['src']:
308 item['files'].append(str(fn))
309
310 # append SConscript if exist
311 if os.path.exists(os.path.join(item['path'], 'SConscript')):
312 item['files'].append(os.path.join(item['path'], 'SConscript'))
313
314 groups.append(item)
315
316 json_dict = {}
317 json_dict['RT-Thread'] = env['RTT_ROOT']
318 json_dict['Groups'] = groups
319
320 # write groups to project.json
321 vsc_file.write(json.dumps(json_dict, ensure_ascii=False, indent=4))
322
323 return
324
325def GenerateVSCode(env):
326 print('Update setting files for VSCode...')

Callers 1

GenerateVSCodeFunction · 0.85

Calls 4

_make_path_relativeFunction · 0.90
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected