Skip to content

Commit b5caf60

Browse files
authored
local cache
1 parent b5ff939 commit b5caf60

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

builder/frameworks/arduino.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,34 @@ def check_reinstall_framework() -> bool:
182182
def shorthen_includes(env, node):
183183
"""Optimize include paths for Windows builds."""
184184
if IS_INTEGRATION_DUMP:
185+
# Don't shorten include paths for IDE integrations
185186
return node
186187

187-
includes = [fs.to_unix_path(inc) for inc in env.get("CPPPATH", [])]
188+
# Local references for better performance
189+
env_get = env.get
190+
to_unix_path = fs.to_unix_path
191+
ccflags = env["CCFLAGS"]
192+
asflags = env["ASFLAGS"]
193+
194+
includes = [to_unix_path(inc) for inc in env_get("CPPPATH", [])]
188195
shortened_includes = []
189196
generic_includes = []
190197

191198
for inc in includes:
192199
if is_framework_subfolder(inc):
193-
rel_path = fs.to_unix_path(os.path.relpath(inc, FRAMEWORK_SDK_DIR))
194-
shortened_includes.append(f"-iwithprefix/{rel_path}")
200+
shortened_includes.append(
201+
"-iwithprefix/" + to_unix_path(relpath(inc, FRAMEWORK_SDK_DIR))
202+
)
195203
else:
196204
generic_includes.append(inc)
197205

198206
common_flags = ["-iprefix", FRAMEWORK_SDK_DIR] + shortened_includes
207+
199208
return env.Object(
200209
node,
201210
CPPPATH=generic_includes,
202-
CCFLAGS=env["CCFLAGS"] + common_flags,
203-
ASFLAGS=env["ASFLAGS"] + common_flags,
211+
CCFLAGS=ccflags + common_flags,
212+
ASFLAGS=asflags + common_flags,
204213
)
205214

206215
def is_framework_subfolder(potential_subfolder: str) -> bool:

0 commit comments

Comments
 (0)