Skip to content

Commit a9144ff

Browse files
Resolve property as long as possible
This change repeats resolve property process so that consecutive substitutions are possible. That may be required if the property requires multiple iterations to be resolved. For instance the following property requires 2 iterations: compiler.path={runtime.tools.{build.tarch}-{build.target}-elf-gcc.path}/bin After the first iterations the form requires one more substitution compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin
1 parent 953b2e6 commit a9144ff

File tree

2 files changed

+42
-34
lines changed

2 files changed

+42
-34
lines changed

Arduino/Utilities/PropertiesReader.cmake

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -200,43 +200,49 @@ function(_properties_expand_value value return_value namespace)
200200
return()
201201
endif ()
202202

203-
# Get the variables list
204-
string(REGEX MATCHALL "{[^{}/]+}" _var_list "${_value}")
205-
if (NOT "${_var_list}" STREQUAL "")
206-
list(REMOVE_DUPLICATES _var_list)
207-
endif()
208-
foreach(_var_str IN LISTS _var_list)
209-
210-
# Get the variable name
211-
string(REGEX MATCH "^{(.*)}$" _match "${_var_str}")
212-
set(_var_name "${CMAKE_MATCH_1}")
213-
214-
# Check if not resolved already
215-
if (NOT DEFINED "/prop_int_resolved.${_var_name}")
216-
# If such a variable is not in the namespace, no need to resolve
217-
if (NOT DEFINED "${namespace}.${_var_name}")
218-
properties_set_value("/prop_int_unresolved" ${_var_name} "")
219-
continue()
220-
endif()
221-
222-
# Temporarily resolve it to the same variable to handle recursive
223-
# references
224-
properties_set_value("/prop_int_resolved" "${_var_name}"
225-
"{${_var_name}}")
226-
227-
# message("=> Resolve *** ${_var_name} *** : "
228-
# "${${namespace}.${_var_name}}")
229-
_properties_expand_value("${${namespace}.${_var_name}}"
230-
_var_value "${namespace}")
231-
properties_set_value("/prop_int_resolved" "${_var_name}"
232-
"${_var_value}")
233-
# message("=> EXPANDED ${_var_name}: ${_var_value}")
203+
# Set previous value to nothing so that there is at least one iteration
204+
set(_previous_value "")
205+
while(NOT "${_previous_value}" STREQUAL "${_value}")
206+
set(_previous_value "${_value}")
207+
208+
# Get the variables list
209+
string(REGEX MATCHALL "{[^{}/]+}" _var_list "${_value}")
210+
if (NOT "${_var_list}" STREQUAL "")
211+
list(REMOVE_DUPLICATES _var_list)
234212
endif()
213+
foreach(_var_str IN LISTS _var_list)
214+
215+
# Get the variable name
216+
string(REGEX MATCH "^{(.*)}$" _match "${_var_str}")
217+
set(_var_name "${CMAKE_MATCH_1}")
218+
219+
# Check if not resolved already
220+
if (NOT DEFINED "/prop_int_resolved.${_var_name}")
221+
# If such a variable is not in the namespace, no need to resolve
222+
if (NOT DEFINED "${namespace}.${_var_name}")
223+
properties_set_value("/prop_int_unresolved" ${_var_name} "")
224+
continue()
225+
endif()
226+
227+
# Temporarily resolve it to the same variable to handle recursive
228+
# references
229+
properties_set_value("/prop_int_resolved" "${_var_name}"
230+
"{${_var_name}}")
231+
232+
# message("=> Resolve *** ${_var_name} *** : "
233+
# "${${namespace}.${_var_name}}")
234+
_properties_expand_value("${${namespace}.${_var_name}}"
235+
_var_value "${namespace}")
236+
properties_set_value("/prop_int_resolved" "${_var_name}"
237+
"${_var_value}")
238+
# message("=> EXPANDED ${_var_name}: ${_var_value}")
239+
endif()
235240

236-
string(REPLACE "${_var_str}" "${/prop_int_resolved.${_var_name}}"
237-
_value "${_value}")
241+
string(REPLACE "${_var_str}" "${/prop_int_resolved.${_var_name}}"
242+
_value "${_value}")
238243

239-
endforeach()
244+
endforeach()
245+
endwhile()
240246

241247
properties_set_parent_scope("/prop_int_resolved")
242248
properties_set_parent_scope("/prop_int_unresolved")

Tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ function(SetupBoardTests)
218218
set_tests_properties("${distinct_id}" PROPERTIES
219219
FIXTURES_REQUIRED "PlTestResults"
220220
SKIP_RETURN_CODE 100
221+
TIMEOUT 3600
221222
)
222223

223224
if ("${shell_cmd}" STREQUAL "" AND
@@ -354,6 +355,7 @@ function(SetupPlatformTests pl_url ref_url_list return_pl_tests)
354355
set_tests_properties("${test_id}" PROPERTIES
355356
FIXTURES_REQUIRED "TestResults"
356357
SKIP_RETURN_CODE 100
358+
TIMEOUT 3600
357359
)
358360
if ("${shell_cmd}" STREQUAL "" AND
359361
NOT CMAKE_VERSION VERSION_LESS "3.16.0")

0 commit comments

Comments
 (0)