Generate project.json file
(env)
| 288 | return |
| 289 | |
| 290 | def 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 | |
| 325 | def GenerateVSCode(env): |
| 326 | print('Update setting files for VSCode...') |
no test coverage detected