Skip to content

Commit 49ab2b8

Browse files
committed
Add c_cpp_properties file to gen_files for zipping
1 parent e657222 commit 49ab2b8

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

tools/export/vscode/__init__.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,6 @@ def generate(self):
3030
"""Generate Makefile and VSCode launch and task files
3131
"""
3232
super(VSCode, self).generate()
33-
ctx = {
34-
'name': self.project_name,
35-
'elf_location': join('BUILD', self.project_name)+'.elf',
36-
'c_symbols': self.toolchain.get_symbols(),
37-
'asm_symbols': self.toolchain.get_symbols(True),
38-
'target': self.target,
39-
'include_paths': self.resources.inc_dirs,
40-
'load_exe': str(self.LOAD_EXE).lower()
41-
}
42-
43-
if not exists(join(self.export_dir, '.vscode')):
44-
makedirs(join(self.export_dir, '.vscode'))
45-
46-
config_files = ['launch', 'settings', 'tasks']
47-
for file in config_files:
48-
if not exists('.vscode/%s.json' % file):
49-
self.gen_file('vscode/%s.tmpl' % file, ctx,
50-
'.vscode/%s.json' % file)
51-
else:
52-
print('Keeping existing %s.json' % file)
5333

5434
# So.... I want all .h and .hpp files in self.resources.inc_dirs
5535
all_directories = []
@@ -96,8 +76,27 @@ def generate(self):
9676
]
9777
}
9878

99-
with open(join(self.export_dir, '.vscode', 'c_cpp_properties.json'), 'w') as outfile:
100-
json.dump(cpp_props, outfile, indent=4, separators=(',', ': '))
79+
ctx = {
80+
'name': self.project_name,
81+
'elf_location': join('BUILD', self.project_name)+'.elf',
82+
'c_symbols': self.toolchain.get_symbols(),
83+
'asm_symbols': self.toolchain.get_symbols(True),
84+
'target': self.target,
85+
'include_paths': self.resources.inc_dirs,
86+
'load_exe': str(self.LOAD_EXE).lower(),
87+
'cpp_props': json.dumps(cpp_props, indent=4, separators=(',', ': '))
88+
}
89+
90+
if not exists(join(self.export_dir, '.vscode')):
91+
makedirs(join(self.export_dir, '.vscode'))
92+
93+
config_files = ['launch', 'settings', 'tasks', 'c_cpp_properties']
94+
for file in config_files:
95+
if not exists('.vscode/%s.json' % file):
96+
self.gen_file('vscode/%s.tmpl' % file, ctx,
97+
'.vscode/%s.json' % file)
98+
else:
99+
print('Keeping existing %s.json' % file)
101100

102101
@staticmethod
103102
def clean(_):
@@ -116,5 +115,3 @@ class VSCodeArmc5(VSCode, Armc5):
116115
class VSCodeIAR(VSCode, IAR):
117116
LOAD_EXE = True
118117
NAME = "VSCode-IAR"
119-
120-

0 commit comments

Comments
 (0)